Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #AI_Move_EffectScores_1, change this line:
- when "LowerTargetSpDef1"
- #to:
- when "LowerTargetSpDef1", "LowerTargetSpDef1AlwaysHitsInRain"
- #Under this section
- #---------------------------------------------------------------------------
- when "RaiseTargetAtkSpAtk2"
- if target.opposes?(user)
- score -= 100
- elsif skill >= PBTrainerAI.mediumSkill && target.hasActiveAbility?(:CONTRARY)
- score -= 90
- else
- score -= target.stages[:ATTACK] * 20
- score -= target.stages[:SPECIAL_ATTACK] * 20
- end
- #add
- #---------------------------------------------------------------------------
- when "RaiseTargetAtkSpAtk1"
- if target.opposes?(user)
- score -= 100
- elsif skill >= PBTrainerAI.mediumSkill && target.hasActiveAbility?(:CONTRARY)
- score -= 90
- else
- score -= target.stages[:ATTACK] * 10
- score -= target.stages[:SPECIAL_ATTACK] * 10
- end
- #---------------------------------------------------------------------------
- when "RaiseTargetAtkSpeed1"
- if target.opposes?(user)
- score -= 100
- elsif skill >= PBTrainerAI.mediumSkill && target.hasActiveAbility?(:CONTRARY)
- score -= 90
- else
- score -= target.stages[:ATTACK] * 10
- score -= target.stages[:SPEED] * 10
- end
- #---------------------------------------------------------------------------
- when "RaiseTargetSpAtkSpeed1"
- if target.opposes?(user)
- score -= 100
- elsif skill >= PBTrainerAI.mediumSkill && target.hasActiveAbility?(:CONTRARY)
- score -= 90
- else
- score -= target.stages[:SPECIAL_ATTACK] * 10
- score -= target.stages[:SPEED] * 10
- end
- #Under
- #---------------------------------------------------------------------------
- when "LowerTargetAtkSpAtk1"
- avg = target.stages[:ATTACK] * 10
- avg += target.stages[:SPECIAL_ATTACK] * 10
- score += avg / 2
- #add
- #---------------------------------------------------------------------------
- when "LowerTargetSpAtkSpDef1"
- avg = target.stages[:SPECIAL_ATTACK] * 10
- avg += target.stages[:SPECIAL_DEFENSE] * 10
- score += avg / 2
- #Under
- #---------------------------------------------------------------------------
- when "RaiseUserAtkAcc1"
- if user.statStageAtMax?(:ATTACK) &&
- user.statStageAtMax?(:ACCURACY)
- score -= 90
- else
- score -= user.stages[:ATTACK] * 10
- score -= user.stages[:ACCURACY] * 10
- if skill >= PBTrainerAI.mediumSkill
- hasPhysicalAttack = false
- user.eachMove do |m|
- next if !m.physicalMove?(m.type)
- hasPhysicalAttack = true
- break
- end
- if hasPhysicalAttack
- score += 20
- elsif skill >= PBTrainerAI.highSkill
- score -= 90
- end
- end
- end
- #add
- #---------------------------------------------------------------------------
- when "RaiseUserSpAtkAcc1"
- if user.statStageAtMax?(:SPECIAL_ATTACK) &&
- user.statStageAtMax?(:ACCURACY)
- score -= 90
- else
- score -= user.stages[:SPECIAL_ATTACK] * 10
- score -= user.stages[:ACCURACY] * 10
- if skill >= PBTrainerAI.mediumSkill
- hasSpecialAttack = false
- user.eachMove do |m|
- next if !m.specialMove?(m.type)
- hasSpecialAttack = true
- break
- end
- if hasSpecialAttack
- score += 20
- elsif skill >= PBTrainerAI.highSkill
- score -= 90
- end
- end
- end
- #Under this section:
- #---------------------------------------------------------------------------
- when "RaiseUserAtkSpAtk1", "RaiseUserAtkSpAtk1Or2InSun"
- if user.statStageAtMax?(:ATTACK) &&
- user.statStageAtMax?(:SPECIAL_ATTACK)
- score -= 90
- else
- score -= user.stages[:ATTACK] * 10
- score -= user.stages[:SPECIAL_ATTACK] * 10
- if skill >= PBTrainerAI.mediumSkill
- hasDamagingAttack = false
- user.eachMove do |m|
- next if !m.damagingMove?
- hasDamagingAttack = true
- break
- end
- if hasDamagingAttack
- score += 20
- elsif skill >= PBTrainerAI.highSkill
- score -= 90
- end
- end
- if move.function == "RaiseUserAtkSpAtk1Or2InSun" # Growth
- score += 20 if [:Sun, :HarshSun].include?(user.effectiveWeather)
- end
- end
- #add
- #---------------------------------------------------------------------------
- when "RaiseUserDefSpDef1Or2InHailSand"
- if user.statStageAtMax?(:DEFENSE) &&
- user.statStageAtMax?(:SPECIAL_DEFENSE)
- score -= 90
- else
- score -= user.stages[:DEFENSE] * 10
- score -= user.stages[:SPECIAL_DEFENSE] * 10
- if move.function == "RaiseUserDefSpDef1Or2InHailSand" # Crystallize
- score += 20 if [:Sandstorm, :Hail].include?(user.effectiveWeather)
- end
- end
- #Under this section:
- #---------------------------------------------------------------------------
- when "RaiseUserSpAtkSpDefSpd1"
- if user.statStageAtMax?(:SPEED) &&
- user.statStageAtMax?(:SPECIAL_ATTACK) &&
- user.statStageAtMax?(:SPECIAL_DEFENSE)
- score -= 90
- else
- score -= user.stages[:SPECIAL_ATTACK] * 10
- score -= user.stages[:SPECIAL_DEFENSE] * 10
- score -= user.stages[:SPEED] * 10
- if skill >= PBTrainerAI.mediumSkill
- hasSpecicalAttack = false
- user.eachMove do |m|
- next if !m.specialMove?(m.type)
- hasSpecicalAttack = true
- break
- end
- if hasSpecicalAttack
- score += 20
- elsif skill >= PBTrainerAI.highSkill
- score -= 90
- end
- end
- if skill >= PBTrainerAI.highSkill
- aspeed = pbRoughStat(user, :SPEED, skill)
- ospeed = pbRoughStat(target, :SPEED, skill)
- if aspeed < ospeed && aspeed * 2 > ospeed
- score += 20
- end
- end
- end
- #add
- #---------------------------------------------------------------------------
- when "RaiseUserSpAtkSpd1"
- if user.statStageAtMax?(:SPEED) &&
- user.statStageAtMax?(:SPECIAL_ATTACK)
- score -= 90
- else
- score -= user.stages[:SPECIAL_ATTACK] * 10
- score -= user.stages[:SPEED] * 10
- if skill >= PBTrainerAI.mediumSkill
- hasSpecicalAttack = false
- user.eachMove do |m|
- next if !m.specialMove?(m.type)
- hasSpecicalAttack = true
- break
- end
- if hasSpecicalAttack
- score += 20
- elsif skill >= PBTrainerAI.highSkill
- score -= 90
- end
- end
- if skill >= PBTrainerAI.highSkill
- aspeed = pbRoughStat(user, :SPEED, skill)
- ospeed = pbRoughStat(target, :SPEED, skill)
- if aspeed < ospeed && aspeed * 2 > ospeed
- score += 20
- end
- end
- end
- #Under this section
- #---------------------------------------------------------------------------
- when "RaiseTargetSpDef1"
- if target.statStageAtMax?(:SPECIAL_DEFENSE)
- score -= 90
- else
- score -= target.stages[:SPECIAL_DEFENSE] * 10
- end
- #add
- #---------------------------------------------------------------------------
- when "RaiseTargetSpeed1"
- if target.statStageAtMax?(:SPEED)
- score -= 90
- else
- score -= target.stages[:SPEED] * 10
- end
- #Under this section:
- #---------------------------------------------------------------------------
- when "RaiseUserSpDef1PowerUpElectricMove"
- foundMove = false
- user.eachMove do |m|
- next if m.type != :ELECTRIC || !m.damagingMove?
- foundMove = true
- break
- end
- score += 20 if foundMove
- if move.statusMove?
- if user.statStageAtMax?(:SPECIAL_DEFENSE)
- score -= 90
- else
- score -= user.stages[:SPECIAL_DEFENSE] * 20
- end
- elsif user.stages[:SPECIAL_DEFENSE] < 0
- score += 20
- end
- #add
- #---------------------------------------------------------------------------
- when "RaiseUserSpDef1PowerUpFireMove"
- foundMove = false
- user.eachMove do |m|
- next if m.type != :FIRE || !m.damagingMove?
- foundMove = true
- break
- end
- score += 20 if foundMove
- if move.statusMove?
- if user.statStageAtMax?(:SPECIAL_DEFENSE)
- score -= 90
- else
- score -= user.stages[:SPECIAL_DEFENSE] * 20
- end
- elsif user.stages[:SPECIAL_DEFENSE] < 0
- score += 20
- end
- #AI_Move_EffectScores_2, under this section:
- #---------------------------------------------------------------------------
- when "SetTargetTypesToWater"
- if target.effects[PBEffects::Substitute] > 0 || !target.canChangeType?
- score -= 90
- elsif !target.pbHasOtherType?(:WATER)
- score -= 90
- end
- #add:
- #---------------------------------------------------------------------------
- when "SetTargetTypesToRock"
- if target.effects[PBEffects::Substitute] > 0 || !target.canChangeType?
- score -= 90
- elsif !target.pbHasOtherType?(:ROCK)
- score -= 90
- end
- #AI_Move_EffectScores_2, in this section
- #---------------------------------------------------------------------------
- when "ParalyzeTarget", "ParalyzeTargetIfNotTypeImmune",
- "ParalyzeTargetAlwaysHitsInRainHitsTargetInSky", "ParalyzeFlinchTarget"
- #add EffectivenessIncludesDarkTypeParalyzeFlinchTarget, like so
- #---------------------------------------------------------------------------
- when "ParalyzeTarget", "ParalyzeTargetIfNotTypeImmune",
- "ParalyzeTargetAlwaysHitsInRainHitsTargetInSky", "ParalyzeFlinchTarget",
- "EffectivenessIncludesDarkTypeParalyzeFlinchTarget"
- #AI_Move_EffectScores_2,
- #---------------------------------------------------------------------------
- when "ParalyzeBurnOrFreezeTarget"
- score += 30 if target.status == :NONE
- #add ParalyzeOrBurnTarget and RandomStatusTarget, like so
- #---------------------------------------------------------------------------
- when "ParalyzeBurnOrFreezeTarget", "ParalyzeOrBurnTarget", "RandomStatusTarget"
- score += 30 if target.status == :NONE
- #In AI_Move_EffectScores_3, under this section
- #---------------------------------------------------------------------------
- when "HealUserDependingOnWeather"
- if user.hp == user.totalhp || (skill >= PBTrainerAI.mediumSkill && !user.canHeal?)
- score -= 90
- else
- case user.effectiveWeather
- when :Sun, :HarshSun
- score += 30
- when :None
- else
- score -= 30
- end
- score += 50
- score -= user.hp * 100 / user.totalhp
- end
- #add
- #---------------------------------------------------------------------------
- when "HealUserDependingOnWeather"
- if user.hp == user.totalhp || (skill >= PBTrainerAI.mediumSkill && !user.canHeal?)
- score -= 90
- else
- case user.effectiveWeather
- when :Rain, :HeavyRain
- score += 30
- when :None
- else
- score -= 30
- end
- score += 50
- score -= user.hp * 100 / user.totalhp
- end
- #In this section
- when "RecoilThirdOfDamageDealtParalyzeTarget"
- score -= 30
- if target.pbCanParalyze?(user, false)
- score += 30
- if skill >= PBTrainerAI.mediumSkill
- aspeed = pbRoughStat(user, :SPEED, skill)
- ospeed = pbRoughStat(target, :SPEED, skill)
- if aspeed < ospeed
- score += 30
- elsif aspeed > ospeed
- score -= 40
- end
- end
- if skill >= PBTrainerAI.highSkill
- score -= 40 if target.hasActiveAbility?([:GUTS, :MARVELSCALE, :QUICKFEET])
- end
- end
- #add RecoilHalfOfDamageDealtParalyzeTarget, like so
- when "RecoilThirdOfDamageDealtParalyzeTarget", "RecoilHalfOfDamageDealtParalyzeTarget"
- score -= 30
- if target.pbCanParalyze?(user, false)
- score += 30
- if skill >= PBTrainerAI.mediumSkill
- aspeed = pbRoughStat(user, :SPEED, skill)
- ospeed = pbRoughStat(target, :SPEED, skill)
- if aspeed < ospeed
- score += 30
- elsif aspeed > ospeed
- score -= 40
- end
- end
- if skill >= PBTrainerAI.highSkill
- score -= 40 if target.hasActiveAbility?([:GUTS, :MARVELSCALE, :QUICKFEET])
- end
- end
- #Under this section
- #---------------------------------------------------------------------------
- when "DoublePowerIfTargetAsleepCureTarget"
- score -= 20 if target.status == :SLEEP && # Will cure status
- target.statusCount > 1
- #add
- #---------------------------------------------------------------------------
- when "DoublePowerIfTargetFrozenCureTarget"
- score -= 20 if target.status == :FROZEN && # Will cure status
- target.statusCount > 1
- #AI_Move_Utilities, under this line
- "PowerHigherWithUserHappiness",
- #add
- "PowerHigherWithUserCoolness", #Amaze and Dragon Dive
- "PowerHigherWithTargetSpAtk", #Brain Squeeze
- "PowerHigherWithUserSmart", #Confound, Phantasmata
- "PowerHigherWithUserCuteness", #Dazzle, Prism Shower
- "PowerHigherWithUserToughness", #Demolish, Wild Maul
- "PowerHigherWithUserBeauty", #Elegant Wave and Enthrall
- "DoublePowerIfTargetFrozenCureTarget", #Ice Drill
- "DoublePowerIfTargetDarkDragonFairy", #Knight Sword
- #AI_Move_Utilities, change this line:
- when "AlwaysCriticalHit", "HitTwoTimes", "HitTwoTimesPoisonTarget" # Frost Breath, Double Kick, Twineedle
- #to
- when "AlwaysCriticalHit", "HitTwoTimes", "HitTwoTimesPoisonTarget", "TwoTurnAttackInvulnerableAlwaysCriticalHit" # Frost Breath, Double Kick, Twineedle, Backstab
- #Under this section
- when "TwoTurnAttackOneTurnInSun" # Solar Beam
- baseDmg = move.pbBaseDamageMultiplier(baseDmg, user, target)
- #add
- when "TwoTurnAttackOneTurnInSun", "TwoTurnAttackOneTurnInHail" # Solar Beam, Glacier Rush
- baseDmg = move.pbBaseDamageMultiplier(baseDmg, user, target)
- #AI_Move_Utilities, this section:
- when "DoublePowerIfTargetUnderwater", "DoublePowerIfTargetUnderground",
- "BindTargetDoublePowerIfTargetUnderwater"
- baseDmg = move.pbModifyDamage(baseDmg, user, target)
- #add DamageTargetAllyDoublePowerIfTargetUnderwater to the list
- when "DoublePowerIfTargetUnderwater", "DoublePowerIfTargetUnderground",
- "BindTargetDoublePowerIfTargetUnderwater", "DamageTargetAllyDoublePowerIfTargetUnderwater"
- baseDmg = move.pbModifyDamage(baseDmg, user, target)
- #AI_Move_Utilities, under this section:
- when "EffectivenessIncludesFlyingType" # Flying Press
- if GameData::Type.exists?(:FLYING)
- if skill >= PBTrainerAI.highSkill
- targetTypes = target.pbTypes(true)
- mult = Effectiveness.calculate(
- :FLYING, targetTypes[0], targetTypes[1], targetTypes[2]
- )
- else
- mult = Effectiveness.calculate(
- :FLYING, target.types[0], target.types[1], target.effects[PBEffects::Type3]
- )
- end
- baseDmg = (baseDmg.to_f * mult / Effectiveness::NORMAL_EFFECTIVE).round
- end
- baseDmg *= 2 if skill >= PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]
- #add:
- when "EffectivenessIncludesDarkTypeParalyzeFlinchTarget" # Flying Press
- if GameData::Type.exists?(:DARK)
- if skill >= PBTrainerAI.highSkill
- targetTypes = target.pbTypes(true)
- mult = Effectiveness.calculate(
- :DARK, targetTypes[0], targetTypes[1], targetTypes[2]
- )
- else
- mult = Effectiveness.calculate(
- :DARK, target.types[0], target.types[1], target.effects[PBEffects::Type3]
- )
- end
- baseDmg = (baseDmg.to_f * mult / Effectiveness::NORMAL_EFFECTIVE).round
- end
- baseDmg *= 2 if skill >= PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]
- #Under this section:
- # Charge
- if skill >= PBTrainerAI.mediumSkill &&
- user.effects[PBEffects::Charge] > 0 && type == :ELECTRIC
- multipliers[:base_damage_multiplier] *= 2
- end
- #add
- # Stoke
- if skill >= PBTrainerAI.mediumSkill &&
- user.effects[PBEffects::Stoke] > 0 && type == :FIRE
- multipliers[:base_damage_multiplier] *= 2
- end
- #In AI_Move, change this line
- elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableRemoveProtections")
- to
- elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableRemoveProtections", "TwoTurnAttackInvulnerableAlwaysCriticalHit")
- #and this line
- elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater")
- to
- elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater","TwoTurnAttackInvulnerableUnderwaterTargetCannotAct")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement