Fixed using pkmn.species= with a form's internal name not setting the actual species. Fixed Shadow Pokémon not being able to have different Shadow Moves for particular forms.

This commit is contained in:
Maruno17
2020-11-11 21:07:26 +00:00
parent c87a578021
commit 5534f338e7
3 changed files with 13 additions and 11 deletions

View File

@@ -629,7 +629,7 @@ class PokeBattle_Pokemon
#============================================================================= #=============================================================================
def species=(value) def species=(value)
hasNickname = nicknamed? hasNickname = nicknamed?
@species = value @species, @form = pbGetSpeciesFromFSpecies(value)
@name = PBSpecies.getName(@species) unless hasNickname @name = PBSpecies.getName(@species) unless hasNickname
@level = nil # In case growth rate is different for the new species @level = nil # In case growth rate is different for the new species
@forcedForm = nil @forcedForm = nil

View File

@@ -290,12 +290,14 @@ class PokeBattle_Pokemon
self.savedev = [0,0,0,0,0,0] self.savedev = [0,0,0,0,0,0]
self.shadowmoves = [0,0,0,0,0,0,0,0] self.shadowmoves = [0,0,0,0,0,0,0,0]
# Retrieve shadow moves # Retrieve shadow moves
moves = pbLoadShadowMovesets shadow_movesets = pbLoadShadowMovesets
if moves[self.species] && moves[self.species].length>0 shadow_moves = shadow_movesets[self.fSpecies]
for i in 0...[4,moves[self.species].length].min shadow_moves = shadow_movesets[self.species] if !shadow_moves || shadow_moves.length == 0
self.shadowmoves[i] = moves[self.species][i] if shadow_moves && shadow_moves.length > 0
for i in 0...[4,shadow_moves.length].min
self.shadowmoves[i] = shadow_moves[i]
end end
self.shadowmovenum = moves[self.species].length self.shadowmovenum = shadow_moves.length
else else
# No special shadow moves # No special shadow moves
self.shadowmoves[0] = getConst(PBMoves,:SHADOWRUSH) || 0 self.shadowmoves[0] = getConst(PBMoves,:SHADOWRUSH) || 0

View File

@@ -1336,7 +1336,7 @@ end
# Save Shadow move data to PBS file # Save Shadow move data to PBS file
#=============================================================================== #===============================================================================
def pbSaveShadowMoves def pbSaveShadowMoves
moves = pbLoadShadowMovesets shadow_movesets = pbLoadShadowMovesets
File.open("PBS/shadowmoves.txt","wb") { |f| File.open("PBS/shadowmoves.txt","wb") { |f|
f.write(0xEF.chr) f.write(0xEF.chr)
f.write(0xBB.chr) f.write(0xBB.chr)
@@ -1344,14 +1344,14 @@ def pbSaveShadowMoves
f.write("\# "+_INTL("See the documentation on the wiki to learn how to edit this file.")) f.write("\# "+_INTL("See the documentation on the wiki to learn how to edit this file."))
f.write("\r\n") f.write("\r\n")
f.write("\#-------------------------------\r\n") f.write("\#-------------------------------\r\n")
for i in 0...moves.length for i in 0...shadow_movesets.length
move = moves[i] moveset = shadow_movesets[i]
next if !move || moves.length==0 next if !moveset || moveset.length==0
constname = (getConstantName(PBSpecies,i) rescue pbGetSpeciesConst(i) rescue nil) constname = (getConstantName(PBSpecies,i) rescue pbGetSpeciesConst(i) rescue nil)
next if !constname next if !constname
f.write(sprintf("%s = ",constname)) f.write(sprintf("%s = ",constname))
movenames = [] movenames = []
for m in move for m in moveset
movenames.push((getConstantName(PBMoves,m) rescue pbGetMoveConst(m) rescue nil)) movenames.push((getConstantName(PBMoves,m) rescue pbGetMoveConst(m) rescue nil))
end end
f.write(sprintf("%s\r\n",movenames.compact.join(","))) f.write(sprintf("%s\r\n",movenames.compact.join(",")))