From c5cc1eadacbd66fe713886c03cff37a873e04106 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Mon, 3 May 2021 18:58:02 +0100 Subject: [PATCH] =?UTF-8?q?Fixed=20not=20being=20able=20to=20detect=20a=20?= =?UTF-8?q?Pok=C3=A9mon=20being=20a=20Mega=20Evolution,=20fixed=20inadequa?= =?UTF-8?q?te=20checking=20if=20a=20Mega=20Stone=20is=20unlosable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../011_Battle/001_Battler/001_PokeBattle_Battler.rb | 10 +++++++++- .../011_Battle/003_Battle/009_Battle_Action_Other.rb | 2 +- Data/Scripts/014_Pokemon/002_Pokemon_MegaEvolution.rb | 7 +++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb index a63e93b6c..f53c32d17 100644 --- a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb +++ b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb @@ -421,7 +421,15 @@ class PokeBattle_Battler return true if GameData::Item.get(check_item).is_mail? return false if @effects[PBEffects::Transform] # Items that change a Pokémon's form - return true if @pokemon && @pokemon.getMegaForm(true) > 0 # Mega Stone + if mega? # Check if item was needed for this Mega Evolution + return true if @pokemon.species_data.mega_stone == check_item + else # Check if item could cause a Mega Evolution + GameData::Species.each do |data| + next if data.species != @species || data.unmega_form != @form + return true if data.mega_stone == check_item + end + end + # Other unlosable items return GameData::Item.get(check_item).unlosable?(@species, self.ability) end diff --git a/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb b/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb index 17f869977..13e00b374 100644 --- a/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb +++ b/Data/Scripts/011_Battle/003_Battle/009_Battle_Action_Other.rb @@ -147,7 +147,7 @@ class PokeBattle_Battle @scene.pbRefreshOne(idxBattler) pbCommonAnimation("MegaEvolution2",battler) megaName = battler.pokemon.megaName - megaName = _INTL("Mega {1}", battler.pokemon.speciesName) nil_or_empty?(megaName) + megaName = _INTL("Mega {1}", battler.pokemon.speciesName) if nil_or_empty?(megaName) pbDisplay(_INTL("{1} has Mega Evolved into {2}!",battler.pbThis,megaName)) side = battler.idxOwnSide owner = pbGetOwnerIndexFromBattlerIndex(idxBattler) diff --git a/Data/Scripts/014_Pokemon/002_Pokemon_MegaEvolution.rb b/Data/Scripts/014_Pokemon/002_Pokemon_MegaEvolution.rb index 8f00ccda7..3f9db2dd3 100644 --- a/Data/Scripts/014_Pokemon/002_Pokemon_MegaEvolution.rb +++ b/Data/Scripts/014_Pokemon/002_Pokemon_MegaEvolution.rb @@ -3,14 +3,14 @@ class Pokemon # Mega Evolution # NOTE: These are treated as form changes in Essentials. #============================================================================= - def getMegaForm(checkItemOnly = false) + def getMegaForm ret = 0 GameData::Species.each do |data| next if data.species != @species || data.unmega_form != form_simple if data.mega_stone && hasItem?(data.mega_stone) ret = data.form break - elsif !checkItemOnly && data.mega_move && hasMove?(data.mega_move) + elsif data.mega_move && hasMove?(data.mega_move) ret = data.form break end @@ -28,8 +28,7 @@ class Pokemon end def mega? - megaForm = self.getMegaForm - return megaForm > 0 && megaForm == form_simple + return (species_data.mega_stone || species_data.mega_move) ? true : false end def makeMega