Fixed X items not working, fixed Knock Off being able to remove usable Mega Stones

This commit is contained in:
Maruno17
2022-04-24 21:04:22 +01:00
parent 8062b8ed6c
commit ad29dc6dc4
2 changed files with 6 additions and 5 deletions

View File

@@ -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)

View File

@@ -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