Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AbilityEffects = map[ability.Abilities]AbilityModifier{ ability.DrySkin: func(m map[Type]float64) { m[Water] = 0 if m[Fire] != 0 { m[Fire] *= 1.25 } }, ability.EarthEater: func(m map[Type]float64) { m[Ground] = 0 }, ability.Filter: filterVariants, ability.FlashFire: fireImmunityVariants, ability.Heatproof: func(m map[Type]float64) { m[Fire] *= 0.5 }, ability.Levitate: func(m map[Type]float64) { m[Ground] = 0 }, ability.LightningRod: electricImmunityVariants, ability.PrismArmor: filterVariants, ability.SapSipper: func(m map[Type]float64) { m[Grass] *= 0 }, ability.SolidRock: filterVariants, ability.ThickFat: func(m map[Type]float64) { m[Fire] *= 0.5 m[Ice] *= 0.5 }, ability.VoltAbsorb: electricImmunityVariants, ability.WaterAbsorb: func(m map[Type]float64) { m[Water] *= 0 }, ability.WellBakedBody: fireImmunityVariants, ability.WonderGuard: func(m map[Type]float64) { for t, v := range m { if v <= 1 { m[t] = 0 } } }, }
Takes possible abilities that affect damage output and overrides its values. Should be used AFTER base calculation is done, otherwise these values won't be properly calculated.
Best to keep the values as lambdas instead of hardcoded values.
View Source
var Effect = map[Type]Effectiveness{ Bug: { Weaknesses: []Type{Fire, Flying, Rock}, Resistances: []Type{Fighting, Grass, Ground}, }, Dark: { Weaknesses: []Type{Bug, Fairy, Fighting}, Resistances: []Type{Ghost, Dark}, Immunities: []Type{Psychic}, }, Dragon: { Weaknesses: []Type{Dragon, Fairy, Ice}, Resistances: []Type{Electric, Fire, Grass, Water}, }, Electric: { Weaknesses: []Type{Ground}, Resistances: []Type{Electric, Flying, Steel}, }, Fairy: { Weaknesses: []Type{Poison, Steel}, Resistances: []Type{Bug, Dark, Fighting}, Immunities: []Type{Dragon}, }, Fighting: { Weaknesses: []Type{Fairy, Flying, Psychic}, Resistances: []Type{Bug, Dark, Rock}, }, Fire: { Weaknesses: []Type{Ground, Rock, Water}, Resistances: []Type{Bug, Fairy, Fire, Grass, Ice, Steel}, }, Flying: { Weaknesses: []Type{Electric, Ice, Rock}, Resistances: []Type{Bug, Fighting, Grass}, Immunities: []Type{Ground}, }, Ghost: { Weaknesses: []Type{Dark, Ghost}, Resistances: []Type{Bug, Poison}, Immunities: []Type{Fighting, Normal}, }, Grass: { Weaknesses: []Type{Bug, Fire, Flying, Ice, Poison}, Resistances: []Type{Electric, Grass, Ground, Water}, }, Ground: { Weaknesses: []Type{Grass, Ice, Water}, Resistances: []Type{Fire, Poison, Rock}, Immunities: []Type{Electric}, }, Ice: { Weaknesses: []Type{Fighting, Fire, Rock, Steel}, Resistances: []Type{Ice}, }, Normal: { Weaknesses: []Type{Fighting}, Immunities: []Type{Ghost}, }, Poison: { Weaknesses: []Type{Ground, Psychic}, Resistances: []Type{Bug, Fairy, Fighting, Grass, Poison}, }, Psychic: { Weaknesses: []Type{Bug, Dark, Ghost}, Resistances: []Type{Fighting, Psychic}, }, Rock: { Weaknesses: []Type{Fighting, Grass, Ground, Steel}, Resistances: []Type{Fire, Flying, Normal, Poison}, }, Steel: { Weaknesses: []Type{Fighting, Fire, Ground}, Resistances: []Type{Bug, Dragon, Fairy, Flying, Grass, Ice, Normal, Psychic, Rock, Steel}, Immunities: []Type{Poison}, }, Water: { Weaknesses: []Type{Electric, Grass}, Resistances: []Type{Fire, Ice, Steel, Water}, }, }
Functions ¶
func CalculateEffectiveness ¶
CalculateEffectiveness calculates the effectiveness in a defensive way. It takes a mandatory first type, and a slice for secondary type (though it should work with any amount of variants, if they ever come to exist).
It also takes a pointer to ability.Abilities for any ability that can modify the effectiveness output. If no ability matching the criteria is found, ability will be nil.
Types ¶
type AbilityModifier ¶
type Effectiveness ¶
type Type ¶
type Type string
Pokémon types enum
var ( Bug Type = "Bug" Dark Type = "Dark" Dragon Type = "Dragon" Electric Type = "Electric" Fairy Type = "Fairy" Fighting Type = "Fighting" Fire Type = "Fire" Flying Type = "Flying" Ghost Type = "Ghost" Grass Type = "Grass" Ground Type = "Ground" Ice Type = "Ice" Normal Type = "Normal" Poison Type = "Poison" Psychic Type = "Psychic" Rock Type = "Rock" Steel Type = "Steel" Water Type = "Water" )
Click to show internal directories.
Click to hide internal directories.