Fixed error in PokeBattle_Battler#pbHasMoveType?

This commit is contained in:
Maruno17
2020-09-09 20:37:08 +01:00
parent 925c12c831
commit b43b8a907d

View File

@@ -384,13 +384,13 @@ class PokeBattle_Battler
alias hasWorkingItem hasActiveItem? alias hasWorkingItem hasActiveItem?
# Returns whether the specified item will be unlosable for this Pokémon. # Returns whether the specified item will be unlosable for this Pokémon.
def unlosableItem?(item) def unlosableItem?(check_item)
return false if item<=0 return false if check_item <= 0
return true if pbIsMail?(item) return true if pbIsMail?(check_item)
return false if @effects[PBEffects::Transform] return false if @effects[PBEffects::Transform]
# Items that change a Pokémon's form # Items that change a Pokémon's form
return true if @pokemon && @pokemon.getMegaForm(true) > 0 # Mega Stone return true if @pokemon && @pokemon.getMegaForm(true) > 0 # Mega Stone
return pbIsUnlosableItem?(item,@species,@ability) return pbIsUnlosableItem?(check_item, @species, @ability)
end end
def eachMove def eachMove
@@ -401,22 +401,22 @@ class PokeBattle_Battler
@moves.each_with_index { |m, i| yield m, i if m && m.id != 0 } @moves.each_with_index { |m, i| yield m, i if m && m.id != 0 }
end end
def pbHasMove?(id) def pbHasMove?(move_id)
id = getID(PBMoves,id) move_id = getID(PBMoves, move_id)
return false if !id || id<=0 return false if !move_id || move_id <= 0
eachMove { |m| return true if m.id==id } eachMove { |m| return true if m.id == move_id }
return false return false
end end
def pbHasMoveType?(type) def pbHasMoveType?(check_type)
type = getConst(PBTypes,type) check_type = getConst(PBTypes, check_type)
return false if !type || type<0 return false if !check_type || check_type < 0
eachMove { |m| return true if m.type==type } eachMove { |m| return true if m.type == check_type }
return false return false
end end
def pbHasMoveFunction?(*arg) def pbHasMoveFunction?(*arg)
return false if !code return false if !arg
eachMove do |m| eachMove do |m|
arg.each { |code| return true if m.function == code } arg.each { |code| return true if m.function == code }
end end