Fixed broken AI for Camouflage, minor tweaks to some other AI

This commit is contained in:
Maruno17
2021-05-12 21:06:23 +01:00
parent 481e051234
commit 52e7f7b51a

View File

@@ -1353,39 +1353,61 @@ class PokeBattle_AI
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "060" when "060"
if user.ability == :MULTITYPE || user.ability == :RKSSYSTEM if !user.canChangeType?
score -= 90 score -= 90
elsif skill>=PBTrainerAI.mediumSkill elsif skill>=PBTrainerAI.mediumSkill
envtypes = [ new_type = nil
:NORMAL, # None case @battle.field.terrain
:GRASS, # Grass when :Electric
:GRASS, # Tall grass new_type = :ELECTRIC if GameData::Type.exists?(:ELECTRIC)
:WATER, # Moving water when :Grassy
:WATER, # Still water new_type = :GRASS if GameData::Type.exists?(:GRASS)
:WATER, # Underwater when :Misty
:ROCK, # Rock new_type = :FAIRY if GameData::Type.exists?(:FAIRY)
:ROCK, # Cave when :Psychic
:GROUND # Sand new_type = :PSYCHIC if GameData::Type.exists?(:PSYCHIC)
] end
type = envtypes[@battle.environment] if !new_type
score -= 90 if user.pbHasType?(type) envtypes = {
:None => :NORMAL,
:Grass => :GRASS,
:TallGrass => :GRASS,
:MovingWater => :WATER,
:StillWater => :WATER,
:Puddle => :WATER,
:Underwater => :WATER,
:Cave => :ROCK,
:Rock => :GROUND,
:Sand => :GROUND,
:Forest => :BUG,
:ForestGrass => :BUG,
:Snow => :ICE,
:Ice => :ICE,
:Volcano => :FIRE,
:Graveyard => :GHOST,
:Sky => :FLYING,
:Space => :DRAGON,
:UltraSpace => :PSYCHIC
}
new_type = envtypes[@battle.environment]
new_type = nil if !GameData::Type.exists?(new_type)
new_type ||= :NORMAL
end
score -= 90 if !user.pbHasOtherType?(new_type)
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "061" when "061"
if target.effects[PBEffects::Substitute]>0 || if target.effects[PBEffects::Substitute]>0 || !target.canChangeType?
target.ability == :MULTITYPE || target.ability == :RKSSYSTEM
score -= 90 score -= 90
elsif target.pbHasType?(:WATER) elsif !target.pbHasOtherType?(:WATER)
score -= 90 score -= 90
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "062" when "062"
if user.ability == :MULTITYPE || user.ability == :RKSSYSTEM if !user.canChangeType? || target.pbTypes(true).length == 0
score -= 90 score -= 90
elsif user.pbHasType?(target.type1) && elsif user.pbTypes == target.pbTypes &&
user.pbHasType?(target.type2) && user.effects[PBEffects::Type3] == target.effects[PBEffects::Type3]
target.pbHasType?(user.type1) &&
target.pbHasType?(user.type2)
score -= 90 score -= 90
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -1393,7 +1415,7 @@ class PokeBattle_AI
if target.effects[PBEffects::Substitute]>0 if target.effects[PBEffects::Substitute]>0
score -= 90 score -= 90
elsif skill>=PBTrainerAI.mediumSkill elsif skill>=PBTrainerAI.mediumSkill
if [:MULTITYPE, :RKSSYSTEM, :SIMPLE, :TRUANT].include?(target.ability_id) if target.unstoppableAbility? || [:TRUANT, :SIMPLE].include?(target.ability)
score -= 90 score -= 90
end end
end end
@@ -1402,7 +1424,7 @@ class PokeBattle_AI
if target.effects[PBEffects::Substitute]>0 if target.effects[PBEffects::Substitute]>0
score -= 90 score -= 90
elsif skill>=PBTrainerAI.mediumSkill elsif skill>=PBTrainerAI.mediumSkill
if [:INSOMNIA, :MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability_id) if target.unstoppableAbility? || [:TRUANT, :INSOMNIA].include?(target.ability_id)
score -= 90 score -= 90
end end
end end