mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-26 00:06:00 +00:00
Implemented GameData::Nature, improved registration of GameData entries
This commit is contained in:
@@ -34,7 +34,7 @@ class PBPokemon
|
||||
pieces=insp.split(/\s*;\s*/)
|
||||
species = (GameData::Species.exists?(pieces[0])) ? GameData::Species.get(pieces[0]).id : nil
|
||||
item = (GameData::Item.exists?(pieces[1])) ? GameData::Item.get(pieces[1]).id : nil
|
||||
nature=PBNatures.const_get(pieces[2])
|
||||
nature = (GameData::Nature.exists?(pieces[2])) ? GameData::Nature.get(pieces[2]).id : nil
|
||||
ev=pieces[3].split(/\s*,\s*/)
|
||||
evvalue=0
|
||||
for i in 0...6
|
||||
@@ -94,7 +94,7 @@ class PBPokemon
|
||||
s=str.split(/\s*,\s*/)
|
||||
species=GameData::Species.get(s[1]).id
|
||||
item=s[2].to_sym
|
||||
nature=self.constFromStr(PBNatures,s[3])
|
||||
nature=GameData::Nature.get(s[3]).id
|
||||
move1=GameData::Move.get(s[4]).id
|
||||
move2=(s.length>=12) ? GameData::Move.get(s[5]).id : nil
|
||||
move3=(s.length>=13) ? GameData::Move.get(s[6]).id : nil
|
||||
@@ -128,7 +128,7 @@ class PBPokemon
|
||||
def inspect
|
||||
c1=GameData::Species.get(@species).id.to_s
|
||||
c2=(@item) ? GameData::Item.get(@item).id.to_s : ""
|
||||
c3=getConstantName(PBNatures,@nature)
|
||||
c3=(@nature) ? GameData::Nature.get(@nature).id.to_s : ""
|
||||
evlist=""
|
||||
for i in 0...@ev
|
||||
if ((@ev&(1<<i))!=0)
|
||||
|
||||
@@ -270,17 +270,22 @@ def pbRandomPokemonFromRule(rule,trainer)
|
||||
break
|
||||
end
|
||||
ev=rand(63)+1
|
||||
nature=0
|
||||
nature = nil
|
||||
keys = GameData::Nature::DATA.keys
|
||||
loop do
|
||||
nature = rand(25)
|
||||
nd5 = PBNatures.getStatRaised(nature)
|
||||
nm5 = PBNatures.getStatLowered(nature)
|
||||
if nd5==nm5 || nature==PBNatures::LAX || nature==PBNatures::GENTLE
|
||||
# Neutral nature, Lax, or Gentle
|
||||
next if rand(20)<19
|
||||
nature = keys[rand(keys.length)]
|
||||
nature_data = GameData::Nature.get(nature)
|
||||
if [:LAX, :GENTLE].include?(nature_data.id) || nature_data.stat_changes.length == 0
|
||||
next if rand(20) < 19
|
||||
else
|
||||
next if rand(10)<6 if ((ev>>nd5)&1)==0 # If stat to increase isn't emphasized
|
||||
next if rand(10)<9 if ((ev>>nm5)&1)!=0 # If stat to decrease is emphasized
|
||||
raised_emphasis = false
|
||||
lowered_emphasis = false
|
||||
nature_data.stat_changes.each do |change|
|
||||
raised_emphasis = true if change[1] > 0 && ((ev >> change[0]) & 1) != 0
|
||||
lowered_emphasis = true if change[1] < 0 && ((ev >> change[0]) & 1) != 0
|
||||
end
|
||||
next if rand(10) < 6 && !raised_emphasis
|
||||
next if rand(10) < 9 && lowered_emphasis
|
||||
end
|
||||
break
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user