mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-11 07:04:59 +00:00
Moved species data constants into module SpeciesData
This commit is contained in:
@@ -269,7 +269,7 @@ def pbBugContestScore(pokemon)
|
||||
for i in pokemon.iv; ivscore+=i; end
|
||||
ivscore=(ivscore*100/186).floor
|
||||
hpscore=(100*pokemon.hp/pokemon.totalhp).floor
|
||||
rareness = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesRareness)
|
||||
rareness = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesData::RARENESS)
|
||||
rarescore=60
|
||||
rarescore+=20 if rareness<=120
|
||||
rarescore+=20 if rareness<=60
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
def pbBaseStatTotal(species)
|
||||
baseStats = pbGetSpeciesData(species,0,SpeciesBaseStats)
|
||||
baseStats = pbGetSpeciesData(species,0,SpeciesData::BASE_STATS)
|
||||
ret = 0
|
||||
baseStats.each { |s| ret += s }
|
||||
return ret
|
||||
@@ -12,14 +12,14 @@ end
|
||||
def pbTooTall?(pkmn,maxHeightInMeters)
|
||||
species = (pkmn.is_a?(Pokemon)) ? pkmn.species : pkmn
|
||||
form = (pkmn.is_a?(Pokemon)) ? pkmn.form : 0
|
||||
height = pbGetSpeciesData(species,form,SpeciesHeight)
|
||||
height = pbGetSpeciesData(species,form,SpeciesData::HEIGHT)
|
||||
return height>(maxHeightInMeters*10).round
|
||||
end
|
||||
|
||||
def pbTooHeavy?(pkmn,maxWeightInKg)
|
||||
species = (pkmn.is_a?(Pokemon)) ? pkmn.species : pkmn
|
||||
form = (pkmn.is_a?(Pokemon)) ? pkmn.form : 0
|
||||
weight = pbGetSpeciesData(species,form,SpeciesWeight)
|
||||
weight = pbGetSpeciesData(species,form,SpeciesData::WEIGHT)
|
||||
return weight>(maxWeightInKg*10).round
|
||||
end
|
||||
|
||||
@@ -396,7 +396,7 @@ class StandardRestriction
|
||||
def isValid?(pokemon)
|
||||
return false if !pokemon || pokemon.egg?
|
||||
# Species with disadvantageous abilities are not banned
|
||||
abilities = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesAbilities)
|
||||
abilities = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesData::ABILITIES)
|
||||
abilities = [abilities] if !abilities.is_a?(Array)
|
||||
abilities.each do |a|
|
||||
return true if isConst?(a,PBAbilities,:TRUANT) ||
|
||||
@@ -413,7 +413,7 @@ class StandardRestriction
|
||||
return false if pokemon.isSpecies?(i)
|
||||
end
|
||||
# Species with total base stat 600 or more are banned
|
||||
baseStats = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesBaseStats)
|
||||
baseStats = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesData::BASE_STATS)
|
||||
bst = 0
|
||||
baseStats.each { |s| bst += s }
|
||||
return false if bst>=600
|
||||
|
||||
@@ -190,7 +190,7 @@ end
|
||||
class NonlegendaryRestriction
|
||||
def isValid?(pkmn)
|
||||
return true if !pkmn.genderless?
|
||||
compatibility = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesCompatibility)
|
||||
compatibility = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesData::COMPATIBILITY)
|
||||
compatibility = [compatibility] if !compatibility.is_a?(Array)
|
||||
compatibility.each { |c| return false if isConst?(c,PBEggGroups,:Undiscovered) }
|
||||
return true
|
||||
@@ -499,8 +499,8 @@ def pbRandomPokemonFromRule(rule,trainer)
|
||||
item=getID(PBItems,:LEFTOVERS)
|
||||
end
|
||||
if isConst?(item,PBItems,:BLACKSLUDGE)
|
||||
type1 = pbGetSpeciesData(species,0,SpeciesType1)
|
||||
type2 = pbGetSpeciesData(species,0,SpeciesType2) || type1
|
||||
type1 = pbGetSpeciesData(species,0,SpeciesData::TYPE1)
|
||||
type2 = pbGetSpeciesData(species,0,SpeciesData::TYPE2) || type1
|
||||
if !isConst?(type1,PBTypes,:POISON) && !isConst?(type2,PBTypes,:POISON)
|
||||
item=getID(PBItems,:LEFTOVERS)
|
||||
end
|
||||
@@ -956,8 +956,8 @@ def pbRuledBattle(team1,team2,rule)
|
||||
end
|
||||
|
||||
def getTypes(species)
|
||||
type1 = pbGetSpeciesData(species,0,SpeciesType1)
|
||||
type2 = pbGetSpeciesData(species,0,SpeciesType2) || type1
|
||||
type1 = pbGetSpeciesData(species,0,SpeciesData::TYPE1)
|
||||
type2 = pbGetSpeciesData(species,0,SpeciesData::TYPE2) || type1
|
||||
return type1==type2 ? [type1] : [type1,type2]
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user