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