From 5534f338e7473d86f35514fa64ef3f1c8ef38bac Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Wed, 11 Nov 2020 21:07:26 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20using=20pkmn.species=3D=20with=20a=20fo?= =?UTF-8?q?rm's=20internal=20name=20not=20setting=20the=20actual=20species?= =?UTF-8?q?.=20Fixed=20Shadow=20Pok=C3=A9mon=20not=20being=20able=20to=20h?= =?UTF-8?q?ave=20different=20Shadow=20Moves=20for=20particular=20forms.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb | 2 +- .../Scripts/016_Pokemon/004_Pokemon_ShadowPokemon.rb | 12 +++++++----- Data/Scripts/021_Debug/005_Editor_SaveData.rb | 10 +++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb b/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb index 491517874..eeadb5e8f 100644 --- a/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb +++ b/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb @@ -629,7 +629,7 @@ class PokeBattle_Pokemon #============================================================================= def species=(value) hasNickname = nicknamed? - @species = value + @species, @form = pbGetSpeciesFromFSpecies(value) @name = PBSpecies.getName(@species) unless hasNickname @level = nil # In case growth rate is different for the new species @forcedForm = nil diff --git a/Data/Scripts/016_Pokemon/004_Pokemon_ShadowPokemon.rb b/Data/Scripts/016_Pokemon/004_Pokemon_ShadowPokemon.rb index a41b3f8cf..18c4da352 100644 --- a/Data/Scripts/016_Pokemon/004_Pokemon_ShadowPokemon.rb +++ b/Data/Scripts/016_Pokemon/004_Pokemon_ShadowPokemon.rb @@ -290,12 +290,14 @@ class PokeBattle_Pokemon self.savedev = [0,0,0,0,0,0] self.shadowmoves = [0,0,0,0,0,0,0,0] # Retrieve shadow moves - moves = pbLoadShadowMovesets - if moves[self.species] && moves[self.species].length>0 - for i in 0...[4,moves[self.species].length].min - self.shadowmoves[i] = moves[self.species][i] + shadow_movesets = pbLoadShadowMovesets + shadow_moves = shadow_movesets[self.fSpecies] + shadow_moves = shadow_movesets[self.species] if !shadow_moves || shadow_moves.length == 0 + if shadow_moves && shadow_moves.length > 0 + for i in 0...[4,shadow_moves.length].min + self.shadowmoves[i] = shadow_moves[i] end - self.shadowmovenum = moves[self.species].length + self.shadowmovenum = shadow_moves.length else # No special shadow moves self.shadowmoves[0] = getConst(PBMoves,:SHADOWRUSH) || 0 diff --git a/Data/Scripts/021_Debug/005_Editor_SaveData.rb b/Data/Scripts/021_Debug/005_Editor_SaveData.rb index d162b4944..2dd6be5db 100644 --- a/Data/Scripts/021_Debug/005_Editor_SaveData.rb +++ b/Data/Scripts/021_Debug/005_Editor_SaveData.rb @@ -1336,7 +1336,7 @@ end # Save Shadow move data to PBS file #=============================================================================== def pbSaveShadowMoves - moves = pbLoadShadowMovesets + shadow_movesets = pbLoadShadowMovesets File.open("PBS/shadowmoves.txt","wb") { |f| f.write(0xEF.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("\r\n") f.write("\#-------------------------------\r\n") - for i in 0...moves.length - move = moves[i] - next if !move || moves.length==0 + for i in 0...shadow_movesets.length + moveset = shadow_movesets[i] + next if !moveset || moveset.length==0 constname = (getConstantName(PBSpecies,i) rescue pbGetSpeciesConst(i) rescue nil) next if !constname f.write(sprintf("%s = ",constname)) movenames = [] - for m in move + for m in moveset movenames.push((getConstantName(PBMoves,m) rescue pbGetMoveConst(m) rescue nil)) end f.write(sprintf("%s\r\n",movenames.compact.join(",")))