From ad29dc6dc4432db9a5bc61c6ade6b977092be523 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 24 Apr 2022 21:04:22 +0100 Subject: [PATCH] Fixed X items not working, fixed Knock Off being able to remove usable Mega Stones --- Data/Scripts/011_Battle/001_Battle/001_Battle.rb | 2 +- .../Scripts/011_Battle/002_Battler/001_Battle_Battler.rb | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Data/Scripts/011_Battle/001_Battle/001_Battle.rb b/Data/Scripts/011_Battle/001_Battle/001_Battle.rb index 45f30a037..65f3e969d 100644 --- a/Data/Scripts/011_Battle/001_Battle/001_Battle.rb +++ b/Data/Scripts/011_Battle/001_Battle/001_Battle.rb @@ -485,7 +485,7 @@ class Battle # This method only counts the player's Pokémon, not a partner trainer's. def pbPlayerBattlerCount - return allSameSideBattlers(idxBattler).select { |b| b.pbOwnedByPlayer? }.length + return allSameSideBattlers.select { |b| b.pbOwnedByPlayer? }.length end def pbCheckGlobalAbility(abil) diff --git a/Data/Scripts/011_Battle/002_Battler/001_Battle_Battler.rb b/Data/Scripts/011_Battle/002_Battler/001_Battle_Battler.rb index dab483b94..09185db96 100644 --- a/Data/Scripts/011_Battle/002_Battler/001_Battle_Battler.rb +++ b/Data/Scripts/011_Battle/002_Battler/001_Battle_Battler.rb @@ -431,19 +431,20 @@ class Battle::Battler # Returns whether the specified item will be unlosable for this Pokémon. def unlosableItem?(check_item) return false if !check_item - return true if GameData::Item.get(check_item).is_mail? + item_data = GameData::Item.get(check_item) + return true if item_data.is_mail? return false if @effects[PBEffects::Transform] # Items that change a Pokémon's form if mega? # Check if item was needed for this Mega Evolution - return true if @pokemon.species_data.mega_stone == check_item + return true if @pokemon.species_data.mega_stone == item_data.id 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 + return true if data.mega_stone == item_data.id end end # Other unlosable items - return GameData::Item.get(check_item).unlosable?(@species, self.ability) + return item_data.unlosable?(@species, self.ability) end def eachMove