GithubHelp home page GithubHelp logo

Axie Stats about agp-npm HOT 1 OPEN

shanemaglangit avatar shanemaglangit commented on September 22, 2024
Axie Stats

from agp-npm.

Comments (1)

ShaneMaglangit avatar ShaneMaglangit commented on September 22, 2024 1

For temporary means, you can use the following code as a reference to perform it outside of the library.

var baseStatsMap = map[agp.Class]map[string]int{
	agp.Aquatic: {"hp": 39, "speed": 39, "skill": 35, "morale": 27},
	agp.Beast:   {"hp": 31, "speed": 35, "skill": 31, "morale": 43},
	agp.Bird:    {"hp": 27, "speed": 43, "skill": 35, "morale": 35},
	agp.Bug:     {"hp": 35, "speed": 31, "skill": 35, "morale": 39},
	agp.Plant:   {"hp": 43, "speed": 31, "skill": 31, "morale": 35},
	agp.Reptile: {"hp": 39, "speed": 35, "skill": 31, "morale": 35},
	agp.Dawn:    {"hp": 35, "speed": 35, "skill": 39, "morale": 31},
	agp.Dusk:    {"hp": 43, "speed": 39, "skill": 27, "morale": 31},
	agp.Mech:    {"hp": 31, "speed": 39, "skill": 43, "morale": 27},
}

func getStatsFromGenes(genes agp.Genes) (int, int, int, int) {
	hp := baseStatsMap[genes.Class]["hp"] + getBonusStats(genes, "hp")
	speed := baseStatsMap[genes.Class]["speed"] + getBonusStats(genes, "speed")
	skill := baseStatsMap[genes.Class]["skill"] + getBonusStats(genes, "skill")
	morale := baseStatsMap[genes.Class]["morale"] + getBonusStats(genes, "morale")
	return hp, speed, skill, morale
}

var bonusStatsMap = map[agp.Class]map[string]int{
	agp.Aquatic: {"hp": 1, "speed": 3, "skill": 0, "morale": 0},
	agp.Beast:   {"hp": 0, "speed": 1, "skill": 0, "morale": 3},
	agp.Bird:    {"hp": 0, "speed": 3, "skill": 0, "morale": 1},
	agp.Bug:     {"hp": 1, "speed": 0, "skill": 0, "morale": 3},
	agp.Plant:   {"hp": 3, "speed": 0, "skill": 0, "morale": 1},
	agp.Reptile: {"hp": 3, "speed": 1, "skill": 0, "morale": 0},
}

func getBonusStats(genes agp.Genes, stat string) int {
	bonusStat := 0
	bonusStat += bonusStatsMap[genes.Eyes.D.Class][stat]
	bonusStat += bonusStatsMap[genes.Ears.D.Class][stat]
	bonusStat += bonusStatsMap[genes.Horn.D.Class][stat]
	bonusStat += bonusStatsMap[genes.Mouth.D.Class][stat]
	bonusStat += bonusStatsMap[genes.Back.D.Class][stat]
	bonusStat += bonusStatsMap[genes.Tail.D.Class][stat]
	return bonusStat
}

This is from the Go library and would most likely get the feature earlier than the NPM one.

from agp-npm.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.