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,47 +384,47 @@ 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
@moves.each { |m| yield m if m && m.id!=0 } @moves.each { |m| yield m if m && m.id != 0 }
end end
def eachMoveWithIndex def eachMoveWithIndex
@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
return false return false
end end
def hasMoldBreaker? def hasMoldBreaker?
return hasActiveAbility?([:MOLDBREAKER,:TERAVOLT,:TURBOBLAZE]) return hasActiveAbility?([:MOLDBREAKER, :TERAVOLT, :TURBOBLAZE])
end end
def canChangeType? def canChangeType?
@@ -437,12 +437,12 @@ class PokeBattle_Battler
return false if hasActiveItem?(:IRONBALL) return false if hasActiveItem?(:IRONBALL)
return false if @effects[PBEffects::Ingrain] return false if @effects[PBEffects::Ingrain]
return false if @effects[PBEffects::SmackDown] return false if @effects[PBEffects::SmackDown]
return false if @battle.field.effects[PBEffects::Gravity]>0 return false if @battle.field.effects[PBEffects::Gravity] > 0
return true if pbHasType?(:FLYING) return true if pbHasType?(:FLYING)
return true if hasActiveAbility?(:LEVITATE) && !@battle.moldBreaker return true if hasActiveAbility?(:LEVITATE) && !@battle.moldBreaker
return true if hasActiveItem?(:AIRBALLOON) return true if hasActiveItem?(:AIRBALLOON)
return true if @effects[PBEffects::MagnetRise]>0 return true if @effects[PBEffects::MagnetRise] > 0
return true if @effects[PBEffects::Telekinesis]>0 return true if @effects[PBEffects::Telekinesis] > 0
return false return false
end end