Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
class PokeBattle_AI #============================================================================= # Get a score for the given move based on its effect #============================================================================= def pbGetMoveScoreFunctionCode(score,move,user,target,skill=100) case move.function #--------------------------------------------------------------------------- when "000" # No extra effect #--------------------------------------------------------------------------- when "001" score -= 95 score = 0 if skill>=PBTrainerAI.highSkill #--------------------------------------------------------------------------- when "002" # Struggle #--------------------------------------------------------------------------- when "003" if target.pbCanSleep?(user,false) score += 30 if skill>=PBTrainerAI.mediumSkill score -= 30 if target.effects[PBEffects::Yawn]>0 end if skill>=PBTrainerAI.highSkill score -= 30 if target.hasActiveAbility?(:MARVELSCALE) end if skill>=PBTrainerAI.bestSkill if target.pbHasMoveFunction?("011","0B4") # Snore, Sleep Talk score -= 50 end end else if skill>=PBTrainerAI.mediumSkill score -= 90 if move.statusMove? end end #--------------------------------------------------------------------------- when "004" if target.effects[PBEffects::Yawn]>0 || !target.pbCanSleep?(user,false) score -= 90 if skill>=PBTrainerAI.mediumSkill else score += 30 if skill>=PBTrainerAI.highSkill score -= 30 if target.hasActiveAbility?(:MARVELSCALE) end if skill>=PBTrainerAI.bestSkill if target.pbHasMoveFunction?("011","0B4") # Snore, Sleep Talk score -= 50 end end end #--------------------------------------------------------------------------- when "005", "006", "0BE" if target.pbCanPoison?(user,false) score += 30 if skill>=PBTrainerAI.mediumSkill score += 30 if target.hp<=target.totalhp/4 score += 50 if target.hp<=target.totalhp/8 score -= 40 if target.effects[PBEffects::Yawn]>0 end if skill>=PBTrainerAI.highSkill score += 10 if pbRoughStat(target,:DEFENSE,skill)>100 score += 10 if pbRoughStat(target,:SPECIAL_DEFENSE,skill)>100 score -= 40 if target.hasActiveAbility?([:GUTS,:MARVELSCALE,:TOXICBOOST]) end else if skill>=PBTrainerAI.mediumSkill score -= 90 if move.statusMove? end end #--------------------------------------------------------------------------- when "007", "008", "009", "0C5" if target.pbCanParalyze?(user,false) && !(skill>=PBTrainerAI.mediumSkill && move.id == :THUNDERWAVE && Effectiveness.ineffective?(pbCalcTypeMod(move.type,user,target))) score += 30 if skill>=PBTrainerAI.mediumSkill aspeed = pbRoughStat(user,:SPEED,skill) ospeed = pbRoughStat(target,:SPEED,skill) if aspeed
ospeed score -= 40 end end if skill>=PBTrainerAI.highSkill score -= 40 if target.hasActiveAbility?([:GUTS,:MARVELSCALE,:QUICKFEET]) end else if skill>=PBTrainerAI.mediumSkill score -= 90 if move.statusMove? end end #--------------------------------------------------------------------------- when "00A", "00B", "0C6" if target.pbCanBurn?(user,false) score += 30 if skill>=PBTrainerAI.highSkill score -= 40 if target.hasActiveAbility?([:GUTS,:MARVELSCALE,:QUICKFEET,:FLAREBOOST]) end else if skill>=PBTrainerAI.mediumSkill score -= 90 if move.statusMove? end end #--------------------------------------------------------------------------- when "00C", "00D", "00E" if target.pbCanFreeze?(user,false) score += 30 if skill>=PBTrainerAI.highSkill score -= 20 if target.hasActiveAbility?(:MARVELSCALE) end else if skill>=PBTrainerAI.mediumSkill score -= 90 if move.statusMove? end end #--------------------------------------------------------------------------- when "00F" score += 30 if skill>=PBTrainerAI.highSkill score += 30 if !target.hasActiveAbility?(:INNERFOCUS) && target.effects[PBEffects::Substitute]==0 end #--------------------------------------------------------------------------- when "010" if skill>=PBTrainerAI.highSkill score += 30 if !target.hasActiveAbility?(:INNERFOCUS) && target.effects[PBEffects::Substitute]==0 end score += 30 if target.effects[PBEffects::Minimize] #--------------------------------------------------------------------------- when "011" if user.asleep? score += 100 # Because it can only be used while asleep if skill>=PBTrainerAI.highSkill score += 30 if !target.hasActiveAbility?(:INNERFOCUS) && target.effects[PBEffects::Substitute]==0 end else score -= 90 # Because it will fail here score = 0 if skill>=PBTrainerAI.bestSkill end #--------------------------------------------------------------------------- when "012" if user.turnCount==0 if skill>=PBTrainerAI.highSkill score += 30 if !target.hasActiveAbility?(:INNERFOCUS) && target.effects[PBEffects::Substitute]==0 end else score -= 90 # Because it will fail here score = 0 if skill>=PBTrainerAI.bestSkill end #--------------------------------------------------------------------------- when "013", "014", "015" if target.pbCanConfuse?(user,false) score += 30 else if skill>=PBTrainerAI.mediumSkill score -= 90 if move.statusMove? end end #--------------------------------------------------------------------------- when "016" canattract = true agender = user.gender ogender = target.gender if agender==2 || ogender==2 || agender==ogender score -= 90; canattract = false elsif target.effects[PBEffects::Attract]>=0 score -= 80; canattract = false elsif skill>=PBTrainerAI.bestSkill && target.hasActiveAbility?(:OBLIVIOUS) score -= 80; canattract = false end if skill>=PBTrainerAI.highSkill if canattract && target.hasActiveItem?(:DESTINYKNOT) && user.pbCanAttract?(target,false) score -= 30 end end #--------------------------------------------------------------------------- when "017" score += 30 if target.status == :NONE #--------------------------------------------------------------------------- when "018" case user.status when :POISON score += 40 if skill>=PBTrainerAI.mediumSkill if user.hp
=PBTrainerAI.highSkill && user.hp<(user.effects[PBEffects::Toxic]+1)*user.totalhp/16 score += 60 end end #when :BURN, :PARALYSIS when :BURN, :PARALYSIS, :FROSTBITE, :DROWSY score += 40 else score -= 90 end #--------------------------------------------------------------------------- when "019" statuses = 0 @battle.pbParty(user.index).each do |pkmn| statuses += 1 if pkmn && pkmn.status != :NONE end if statuses==0 score -= 80 else score += 20*statuses end #--------------------------------------------------------------------------- when "01A" if user.pbOwnSide.effects[PBEffects::Safeguard]>0 score -= 80 elsif user.status != :NONE score -= 40 else score += 30 end #--------------------------------------------------------------------------- when "01B" if user.status == :NONE score -= 90 else score += 40 end #--------------------------------------------------------------------------- when "01C" if move.statusMove? if user.statStageAtMax?(:ATTACK) score -= 90 else score -= user.stages[:ATTACK]*20 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 else score += 20 if user.stages[:ATTACK]<0 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 #--------------------------------------------------------------------------- when "01D", "01E", "0C8" if move.statusMove? if user.statStageAtMax?(:DEFENSE) score -= 90 else score -= user.stages[:DEFENSE]*20 end else score += 20 if user.stages[:DEFENSE]<0 end #--------------------------------------------------------------------------- when "01F" if move.statusMove? if user.statStageAtMax?(:SPEED) score -= 90 else score -= user.stages[:SPEED]*10 if skill>=PBTrainerAI.highSkill aspeed = pbRoughStat(user,:SPEED,skill) ospeed = pbRoughStat(target,:SPEED,skill) score += 30 if aspeed
ospeed end end else score += 20 if user.stages[:SPEED]<0 end #--------------------------------------------------------------------------- when "020" if move.statusMove? if user.statStageAtMax?(:SPECIAL_ATTACK) score -= 90 else score -= user.stages[:SPECIAL_ATTACK]*20 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 end else score += 20 if user.stages[:SPECIAL_ATTACK]<0 if skill>=PBTrainerAI.mediumSkill hasSpecicalAttack = false user.eachMove do |m| next if !m.specialMove?(m.type) hasSpecicalAttack = true break end score += 20 if hasSpecicalAttack end end #--------------------------------------------------------------------------- when "021" 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 else score += 20 if user.stages[:SPECIAL_DEFENSE]<0 end #--------------------------------------------------------------------------- when "022" if move.statusMove? if user.statStageAtMax?(:EVASION) score -= 90 else score -= user.stages[:EVASION]*10 end else score += 20 if user.stages[:EVASION]<0 end #--------------------------------------------------------------------------- when "023" if move.statusMove? if user.effects[PBEffects::FocusEnergy]>=2 score -= 80 else score += 30 end else score += 30 if user.effects[PBEffects::FocusEnergy]<2 end #--------------------------------------------------------------------------- when "024" if user.statStageAtMax?(:ATTACK) && user.statStageAtMax?(:DEFENSE) score -= 90 else score -= user.stages[:ATTACK]*10 score -= user.stages[:DEFENSE]*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 #--------------------------------------------------------------------------- when "025" if user.statStageAtMax?(:ATTACK) && user.statStageAtMax?(:DEFENSE) && user.statStageAtMax?(:ACCURACY) score -= 90 else score -= user.stages[:ATTACK]*10 score -= user.stages[:DEFENSE]*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 #--------------------------------------------------------------------------- when "026" score += 40 if user.turnCount==0 # Dragon Dance tends to be popular if user.statStageAtMax?(:ATTACK) && user.statStageAtMax?(:SPEED) score -= 90 else score -= user.stages[:ATTACK]*10 score -= user.stages[:SPEED]*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 if skill>=PBTrainerAI.highSkill aspeed = pbRoughStat(user,:SPEED,skill) ospeed = pbRoughStat(target,:SPEED,skill) score += 20 if aspeed
ospeed end end #--------------------------------------------------------------------------- when "027", "028" 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=="028" # Growth score += 20 if [:Sun, :HarshSun].include?(@battle.pbWeather) end end #--------------------------------------------------------------------------- when "029" 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 #--------------------------------------------------------------------------- when "02A" if user.statStageAtMax?(:DEFENSE) && user.statStageAtMax?(:SPECIAL_DEFENSE) score -= 90 else score -= user.stages[:DEFENSE]*10 score -= user.stages[:SPECIAL_DEFENSE]*10 end #--------------------------------------------------------------------------- when "02B" 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 score += 20 end end end #--------------------------------------------------------------------------- when "02C" if user.statStageAtMax?(:SPECIAL_ATTACK) && user.statStageAtMax?(:SPECIAL_DEFENSE) score -= 90 else score += 40 if user.turnCount==0 # Calm Mind tends to be popular score -= user.stages[:SPECIAL_ATTACK]*10 score -= user.stages[:SPECIAL_DEFENSE]*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 end #--------------------------------------------------------------------------- when "02D" GameData::Stat.each_main_battle { |s| score += 10 if user.stages[s.id] < 0 } if skill>=PBTrainerAI.mediumSkill hasDamagingAttack = false user.eachMove do |m| next if !m.damagingMove? hasDamagingAttack = true break end score += 20 if hasDamagingAttack end #--------------------------------------------------------------------------- when "02E" if move.statusMove? if user.statStageAtMax?(:ATTACK) score -= 90 else score += 40 if user.turnCount==0 score -= user.stages[:ATTACK]*20 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 else score += 10 if user.turnCount==0 score += 20 if user.stages[:ATTACK]<0 if skill>=PBTrainerAI.mediumSkill hasPhysicalAttack = false user.eachMove do |m| next if !m.physicalMove?(m.type) hasPhysicalAttack = true break end score += 20 if hasPhysicalAttack end end #--------------------------------------------------------------------------- when "02F" if move.statusMove? if user.statStageAtMax?(:DEFENSE) score -= 90 else score += 40 if user.turnCount==0 score -= user.stages[:DEFENSE]*20 end else score += 10 if user.turnCount==0 score += 20 if user.stages[:DEFENSE]<0 end #--------------------------------------------------------------------------- when "030", "031" if move.statusMove? if user.statStageAtMax?(:SPEED) score -= 90 else score += 20 if user.turnCount==0 score -= user.stages[:SPEED]*10 if skill>=PBTrainerAI.highSkill aspeed = pbRoughStat(user,:SPEED,skill) ospeed = pbRoughStat(target,:SPEED,skill) score += 30 if aspeed
ospeed end end else score += 10 if user.turnCount==0 score += 20 if user.stages[:SPEED]<0 end #--------------------------------------------------------------------------- when "032" if move.statusMove? if user.statStageAtMax?(:SPECIAL_ATTACK) score -= 90 else score += 40 if user.turnCount==0 score -= user.stages[:SPECIAL_ATTACK]*20 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 end else score += 10 if user.turnCount==0 score += 20 if user.stages[:SPECIAL_ATTACK]<0 if skill>=PBTrainerAI.mediumSkill hasSpecicalAttack = false user.eachMove do |m| next if !m.specialMove?(m.type) hasSpecicalAttack = true break end score += 20 if hasSpecicalAttack end end #--------------------------------------------------------------------------- when "033" if move.statusMove? if user.statStageAtMax?(:SPECIAL_DEFENSE) score -= 90 else score += 40 if user.turnCount==0 score -= user.stages[:SPECIAL_DEFENSE]*20 end else score += 10 if user.turnCount==0 score += 20 if user.stages[:SPECIAL_DEFENSE]<0 end #--------------------------------------------------------------------------- when "034" if move.statusMove? if user.statStageAtMax?(:EVASION) score -= 90 else score += 40 if user.turnCount==0 score -= user.stages[:EVASION]*10 end else score += 10 if user.turnCount==0 score += 20 if user.stages[:EVASION]<0 end #--------------------------------------------------------------------------- when "035" score -= user.stages[:ATTACK]*20 score -= user.stages[:SPEED]*20 score -= user.stages[:SPECIAL_ATTACK]*20 score += user.stages[:DEFENSE]*10 score += user.stages[:SPECIAL_DEFENSE]*10 if skill>=PBTrainerAI.mediumSkill hasDamagingAttack = false user.eachMove do |m| next if !m.damagingMove? hasDamagingAttack = true break end score += 20 if hasDamagingAttack end #--------------------------------------------------------------------------- when "036" if user.statStageAtMax?(:ATTACK) && user.statStageAtMax?(:SPEED) score -= 90 else score -= user.stages[:ATTACK]*10 score -= user.stages[:SPEED]*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 if skill>=PBTrainerAI.highSkill aspeed = pbRoughStat(user,:SPEED,skill) ospeed = pbRoughStat(target,:SPEED,skill) score += 30 if aspeed
ospeed end end #--------------------------------------------------------------------------- when "037" avgStat = 0; canChangeStat = false GameData::Stat.each_battle do |s| next if target.statStageAtMax?(s.id) avgStat -= target.stages[s.id] canChangeStat = true end if canChangeStat avgStat = avgStat/2 if avgStat<0 # More chance of getting even better score += avgStat*10 else score -= 90 end #--------------------------------------------------------------------------- when "038" if move.statusMove? if user.statStageAtMax?(:DEFENSE) score -= 90 else score += 40 if user.turnCount==0 score -= user.stages[:DEFENSE]*30 end else score += 10 if user.turnCount==0 score += 30 if user.stages[:DEFENSE]<0 end #--------------------------------------------------------------------------- when "039" if move.statusMove? if user.statStageAtMax?(:SPECIAL_ATTACK) score -= 90 else score += 40 if user.turnCount==0 score -= user.stages[:SPECIAL_ATTACK]*30 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 end else score += 10 if user.turnCount==0 score += 30 if user.stages[:SPECIAL_ATTACK]<0 if skill>=PBTrainerAI.mediumSkill hasSpecicalAttack = false user.eachMove do |m| next if !m.specialMove?(m.type) hasSpecicalAttack = true break end score += 30 if hasSpecicalAttack end end #--------------------------------------------------------------------------- when "03A" if user.statStageAtMax?(:ATTACK) || user.hp<=user.totalhp/2 score -= 100 else score += (6-user.stages[:ATTACK])*10 if skill>=PBTrainerAI.mediumSkill hasPhysicalAttack = false user.eachMove do |m| next if !m.physicalMove?(m.type) hasPhysicalAttack = true break end if hasPhysicalAttack score += 40 elsif skill>=PBTrainerAI.highSkill score -= 90 end end end #--------------------------------------------------------------------------- when "03B" avg = user.stages[:ATTACK]*10 avg += user.stages[:DEFENSE]*10 score += avg/2 #--------------------------------------------------------------------------- when "03C" avg = user.stages[:DEFENSE]*10 avg += user.stages[:SPECIAL_DEFENSE]*10 score += avg/2 #--------------------------------------------------------------------------- when "03D" avg = user.stages[:DEFENSE]*10 avg += user.stages[:SPEED]*10 avg += user.stages[:SPECIAL_DEFENSE]*10 score += (avg/3).floor #--------------------------------------------------------------------------- when "03E" score += user.stages[:SPEED]*10 #--------------------------------------------------------------------------- when "03F" score += user.stages[:SPECIAL_ATTACK]*10 #--------------------------------------------------------------------------- when "040" if !target.pbCanConfuse?(user,false) score -= 90 else score += 30 if target.stages[:SPECIAL_ATTACK]<0 end #--------------------------------------------------------------------------- when "041" if !target.pbCanConfuse?(user,false) score -= 90 else score += 30 if target.stages[:ATTACK]<0 end #--------------------------------------------------------------------------- when "042" if move.statusMove? if !target.pbCanLowerStatStage?(:ATTACK,user) score -= 90 else score += target.stages[:ATTACK]*20 if skill>=PBTrainerAI.mediumSkill hasPhysicalAttack = false target.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 else score += 20 if target.stages[:ATTACK]>0 if skill>=PBTrainerAI.mediumSkill hasPhysicalAttack = false target.eachMove do |m| next if !m.physicalMove?(m.type) hasPhysicalAttack = true break end score += 20 if hasPhysicalAttack end end #--------------------------------------------------------------------------- when "043" if move.statusMove? if !target.pbCanLowerStatStage?(:DEFENSE,user) score -= 90 else score += target.stages[:DEFENSE]*20 end else score += 20 if target.stages[:DEFENSE]>0 end #--------------------------------------------------------------------------- when "044" if move.statusMove? if !target.pbCanLowerStatStage?(:SPEED,user) score -= 90 else score += target.stages[:SPEED]*10 if skill>=PBTrainerAI.highSkill aspeed = pbRoughStat(user,:SPEED,skill) ospeed = pbRoughStat(target,:SPEED,skill) score += 30 if aspeed
ospeed end end else score += 20 if user.stages[:SPEED]>0 end #--------------------------------------------------------------------------- when "045" if move.statusMove? if !target.pbCanLowerStatStage?(:SPECIAL_ATTACK,user) score -= 90 else score += user.stages[:SPECIAL_ATTACK]*20 if skill>=PBTrainerAI.mediumSkill hasSpecicalAttack = false target.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 end else score += 20 if user.stages[:SPECIAL_ATTACK]>0 if skill>=PBTrainerAI.mediumSkill hasSpecicalAttack = false target.eachMove do |m| next if !m.specialMove?(m.type) hasSpecicalAttack = true break end score += 20 if hasSpecicalAttack end end #--------------------------------------------------------------------------- when "046" if move.statusMove? if !target.pbCanLowerStatStage?(:SPECIAL_DEFENSE,user) score -= 90 else score += target.stages[:SPECIAL_DEFENSE]*20 end else score += 20 if target.stages[:SPECIAL_DEFENSE]>0 end #--------------------------------------------------------------------------- when "047" if move.statusMove? if !target.pbCanLowerStatStage?(:ACCURACY,user) score -= 90 else score += target.stages[:ACCURACY]*10 end else score += 20 if target.stages[:ACCURACY]>0 end #--------------------------------------------------------------------------- when "048" if move.statusMove? if !target.pbCanLowerStatStage?(:EVASION,user) score -= 90 else score += target.stages[:EVASION]*10 end else score += 20 if target.stages[:EVASION]>0 end #--------------------------------------------------------------------------- when "049" if move.statusMove? if !target.pbCanLowerStatStage?(:EVASION,user) score -= 90 else score += target.stages[:EVASION]*10 end else score += 20 if target.stages[:EVASION]>0 end score += 30 if target.pbOwnSide.effects[PBEffects::AuroraVeil]>0 || target.pbOwnSide.effects[PBEffects::Reflect]>0 || target.pbOwnSide.effects[PBEffects::LightScreen]>0 || target.pbOwnSide.effects[PBEffects::Mist]>0 || target.pbOwnSide.effects[PBEffects::Safeguard]>0 score -= 30 if target.pbOwnSide.effects[PBEffects::Spikes]>0 || target.pbOwnSide.effects[PBEffects::ToxicSpikes]>0 || target.pbOwnSide.effects[PBEffects::StealthRock] #--------------------------------------------------------------------------- when "04A" avg = target.stages[:ATTACK]*10 avg += target.stages[:DEFENSE]*10 score += avg/2 #--------------------------------------------------------------------------- when "04B" if move.statusMove? if !target.pbCanLowerStatStage?(:ATTACK,user) score -= 90 else score += 40 if user.turnCount==0 score += target.stages[:ATTACK]*20 if skill>=PBTrainerAI.mediumSkill hasPhysicalAttack = false target.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 else score += 10 if user.turnCount==0 score += 20 if target.stages[:ATTACK]>0 if skill>=PBTrainerAI.mediumSkill hasPhysicalAttack = false target.eachMove do |m| next if !m.physicalMove?(m.type) hasPhysicalAttack = true break end score += 20 if hasPhysicalAttack end end #--------------------------------------------------------------------------- when "04C" if move.statusMove? if !target.pbCanLowerStatStage?(:DEFENSE,user) score -= 90 else score += 40 if user.turnCount==0 score += target.stages[:DEFENSE]*20 end else score += 10 if user.turnCount==0 score += 20 if target.stages[:DEFENSE]>0 end #--------------------------------------------------------------------------- when "04D" if move.statusMove? if !target.pbCanLowerStatStage?(:SPEED,user) score -= 90 else score += 20 if user.turnCount==0 score += target.stages[:SPEED]*20 if skill>=PBTrainerAI.highSkill aspeed = pbRoughStat(user,:SPEED,skill) ospeed = pbRoughStat(target,:SPEED,skill) score += 30 if aspeed
ospeed end end else score += 10 if user.turnCount==0 score += 30 if target.stages[:SPEED]>0 end #--------------------------------------------------------------------------- when "04E" if user.gender==2 || target.gender==2 || user.gender==target.gender || target.hasActiveAbility?(:OBLIVIOUS) score -= 90 elsif move.statusMove? if !target.pbCanLowerStatStage?(:SPECIAL_ATTACK,user) score -= 90 else score += 40 if user.turnCount==0 score += target.stages[:SPECIAL_ATTACK]*20 if skill>=PBTrainerAI.mediumSkill hasSpecicalAttack = false target.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 end else score += 10 if user.turnCount==0 score += 20 if target.stages[:SPECIAL_ATTACK]>0 if skill>=PBTrainerAI.mediumSkill hasSpecicalAttack = false target.eachMove do |m| next if !m.specialMove?(m.type) hasSpecicalAttack = true break end score += 30 if hasSpecicalAttack end end #--------------------------------------------------------------------------- when "04F" if move.statusMove? if !target.pbCanLowerStatStage?(:SPECIAL_DEFENSE,user) score -= 90 else score += 40 if user.turnCount==0 score += target.stages[:SPECIAL_DEFENSE]*20 end else score += 10 if user.turnCount==0 score += 20 if target.stages[:SPECIAL_DEFENSE]>0 end #--------------------------------------------------------------------------- when "050" if target.effects[PBEffects::Substitute]>0 score -= 90 else avg = 0; anyChange = false GameData::Stat.each_battle do |s| next if target.stages[s.id]==0 avg += target.stages[s.id] anyChange = true end if anyChange score += avg*10 else score -= 90 end end #--------------------------------------------------------------------------- when "051" if skill>=PBTrainerAI.mediumSkill stages = 0 @battle.eachBattler do |b| totalStages = 0 GameData::Stat.each_battle { |s| totalStages += b.stages[s.id] } if b.opposes?(user) stages += totalStages else stages -= totalStages end end score += stages*10 end #--------------------------------------------------------------------------- when "052" if skill>=PBTrainerAI.mediumSkill aatk = user.stages[:ATTACK] aspa = user.stages[:SPECIAL_ATTACK] oatk = target.stages[:ATTACK] ospa = target.stages[:SPECIAL_ATTACK] if aatk>=oatk && aspa>=ospa score -= 80 else score += (oatk-aatk)*10 score += (ospa-aspa)*10 end else score -= 50 end #--------------------------------------------------------------------------- when "053" if skill>=PBTrainerAI.mediumSkill adef = user.stages[:DEFENSE] aspd = user.stages[:SPECIAL_DEFENSE] odef = target.stages[:DEFENSE] ospd = target.stages[:SPECIAL_DEFENSE] if adef>=odef && aspd>=ospd score -= 80 else score += (odef-adef)*10 score += (ospd-aspd)*10 end else score -= 50 end #--------------------------------------------------------------------------- when "054" if skill>=PBTrainerAI.mediumSkill userStages = 0; targetStages = 0 GameData::Stat.each_battle do |s| userStages += user.stages[s.id] targetStages += target.stages[s.id] end score += (targetStages-userStages)*10 else score -= 50 end #--------------------------------------------------------------------------- when "055" if skill>=PBTrainerAI.mediumSkill equal = true GameData::Stat.each_battle do |s| stagediff = target.stages[s.id] - user.stages[s.id] score += stagediff*10 equal = false if stagediff!=0 end score -= 80 if equal else score -= 50 end #--------------------------------------------------------------------------- when "056" score -= 80 if user.pbOwnSide.effects[PBEffects::Mist]>0 #--------------------------------------------------------------------------- when "057" if skill>=PBTrainerAI.mediumSkill aatk = pbRoughStat(user,:ATTACK,skill) adef = pbRoughStat(user,:DEFENSE,skill) if aatk==adef || user.effects[PBEffects::PowerTrick] # No flip-flopping score -= 90 elsif adef>aatk # Prefer a higher Attack score += 30 else score -= 30 end else score -= 30 end #--------------------------------------------------------------------------- when "058" if skill>=PBTrainerAI.mediumSkill aatk = pbRoughStat(user,:ATTACK,skill) aspatk = pbRoughStat(user,:SPECIAL_ATTACK,skill) oatk = pbRoughStat(target,:ATTACK,skill) ospatk = pbRoughStat(target,:SPECIAL_ATTACK,skill) if aatk
=PBTrainerAI.mediumSkill adef = pbRoughStat(user,:DEFENSE,skill) aspdef = pbRoughStat(user,:SPECIAL_DEFENSE,skill) odef = pbRoughStat(target,:DEFENSE,skill) ospdef = pbRoughStat(target,:SPECIAL_DEFENSE,skill) if adef
0 score -= 90 elsif user.hp>=(user.hp+target.hp)/2 score -= 90 else score += 40 end #--------------------------------------------------------------------------- when "05B" score -= 90 if user.pbOwnSide.effects[PBEffects::Tailwind]>0 #--------------------------------------------------------------------------- when "05C" moveBlacklist = [ "002", # Struggle "014", # Chatter "05C", # Mimic "05D", # Sketch "0B6" # Metronome ] if user.effects[PBEffects::Transform] || !target.lastRegularMoveUsed score -= 90 else lastMoveData = GameData::Move.get(target.lastRegularMoveUsed) if moveBlacklist.include?(lastMoveData.function_code) || lastMoveData.type == :SHADOW score -= 90 end user.eachMove do |m| next if m != target.lastRegularMoveUsed score -= 90 break end end #--------------------------------------------------------------------------- when "05D" moveBlacklist = [ "002", # Struggle "014", # Chatter "05D" # Sketch ] if user.effects[PBEffects::Transform] || !target.lastRegularMoveUsed score -= 90 else lastMoveData = GameData::Move.get(target.lastRegularMoveUsed) if moveBlacklist.include?(lastMoveData.function_code) || lastMoveData.type == :SHADOW score -= 90 end user.eachMove do |m| next if m != target.lastRegularMoveUsed score -= 90 # User already knows the move that will be Sketched break end end #--------------------------------------------------------------------------- when "05E" if !user.canChangeType? score -= 90 else has_possible_type = false user.eachMoveWithIndex do |m,i| break if Settings::MECHANICS_GENERATION >= 6 && i>0 next if GameData::Type.get(m.type).pseudo_type next if user.pbHasType?(m.type) has_possible_type = true break end score -= 90 if !has_possible_type end #--------------------------------------------------------------------------- when "05F" if !user.canChangeType? score -= 90 elsif !target.lastMoveUsed || !target.lastMoveUsedType || GameData::Type.get(target.lastMoveUsedType).pseudo_type score -= 90 else aType = nil target.eachMove do |m| next if m.id!=target.lastMoveUsed aType = m.pbCalcType(user) break end if !aType score -= 90 else has_possible_type = false GameData::Type.each do |t| next if t.pseudo_type || user.pbHasType?(t.id) || !Effectiveness.resistant_type?(target.lastMoveUsedType, t.id) has_possible_type = true break end score -= 90 if !has_possible_type end end #--------------------------------------------------------------------------- when "060" if !user.canChangeType? score -= 90 elsif skill>=PBTrainerAI.mediumSkill new_type = nil case @battle.field.terrain when :Electric new_type = :ELECTRIC if GameData::Type.exists?(:ELECTRIC) when :Grassy new_type = :GRASS if GameData::Type.exists?(:GRASS) when :Misty new_type = :FAIRY if GameData::Type.exists?(:FAIRY) when :Psychic new_type = :PSYCHIC if GameData::Type.exists?(:PSYCHIC) end if !new_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 #--------------------------------------------------------------------------- when "061" if target.effects[PBEffects::Substitute]>0 || !target.canChangeType? score -= 90 elsif !target.pbHasOtherType?(:WATER) score -= 90 end #--------------------------------------------------------------------------- when "062" if !user.canChangeType? || target.pbTypes(true).length == 0 score -= 90 elsif user.pbTypes == target.pbTypes && user.effects[PBEffects::Type3] == target.effects[PBEffects::Type3] score -= 90 end #--------------------------------------------------------------------------- when "063" if target.effects[PBEffects::Substitute]>0 score -= 90 elsif skill>=PBTrainerAI.mediumSkill if target.unstoppableAbility? || [:TRUANT, :SIMPLE].include?(target.ability) score -= 90 end end #--------------------------------------------------------------------------- when "064" if target.effects[PBEffects::Substitute]>0 score -= 90 elsif skill>=PBTrainerAI.mediumSkill if target.unstoppableAbility? || [:TRUANT, :INSOMNIA].include?(target.ability_id) score -= 90 end end #--------------------------------------------------------------------------- when "065" score -= 40 # don't prefer this move if skill>=PBTrainerAI.mediumSkill if !target.ability || user.ability==target.ability || [:MULTITYPE, :RKSSYSTEM].include?(user.ability_id) || [:FLOWERGIFT, :FORECAST, :ILLUSION, :IMPOSTER, :MULTITYPE, :RKSSYSTEM, :TRACE, :WONDERGUARD, :ZENMODE, :GULPMISSILE, :ICEFACE, :NEUTRALIZINGGAS].include?(target.ability_id) score -= 90 end end if skill>=PBTrainerAI.highSkill if target.ability == :TRUANT && user.opposes?(target) score -= 90 elsif target.ability == :SLOWSTART && user.opposes?(target) score -= 90 end end #--------------------------------------------------------------------------- when "066" score -= 40 # don't prefer this move if target.effects[PBEffects::Substitute]>0 score -= 90 elsif skill>=PBTrainerAI.mediumSkill if !user.ability || user.ability==target.ability || [:MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability_id) || [:FLOWERGIFT, :FORECAST, :ILLUSION, :IMPOSTER, :MULTITYPE, :RKSSYSTEM, :TRACE, :ZENMODE, :ICEFACE, :GULPMISSILE, :NEUTRALIZINGGAS].include?(user.ability_id) score -= 90 end if skill>=PBTrainerAI.highSkill if user.ability == :TRUANT && user.opposes?(target) score += 90 elsif user.ability == :SLOWSTART && user.opposes?(target) score += 90 end end end #--------------------------------------------------------------------------- when "067" score -= 40 # don't prefer this move if skill>=PBTrainerAI.mediumSkill if (!user.ability && !target.ability) || user.ability==target.ability || [:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD, :ICEFACE, :GULPMISSILE, :NEUTRALIZINGGAS].include?(user.ability_id) || [:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD, :ICEFACE, :GULPMISSILE, :NEUTRALIZINGGAS].include?(target.ability_id) score -= 90 end end if skill>=PBTrainerAI.highSkill if target.ability == :TRUANT && user.opposes?(target) score -= 90 elsif target.ability == :SLOWSTART && user.opposes?(target) score -= 90 end end #--------------------------------------------------------------------------- when "068" if target.effects[PBEffects::Substitute]>0 || target.effects[PBEffects::GastroAcid] score -= 90 elsif skill>=PBTrainerAI.highSkill score -= 90 if [:MULTITYPE, :RKSSYSTEM, :SLOWSTART, :TRUANT].include?(target.ability_id) end #--------------------------------------------------------------------------- when "069" score -= 70 #--------------------------------------------------------------------------- when "06A" if target.hp<=20 score += 80 elsif target.level>=25 score -= 60 # Not useful against high-level Pokemon end #--------------------------------------------------------------------------- when "06B" score += 80 if target.hp<=40 #--------------------------------------------------------------------------- when "06C" score -= 50 score += target.hp*100/target.totalhp #--------------------------------------------------------------------------- when "06D" score += 80 if target.hp<=user.level #--------------------------------------------------------------------------- when "06E" if user.hp>=target.hp score -= 90 elsif user.hp
user.level #--------------------------------------------------------------------------- when "071" if target.effects[PBEffects::HyperBeam]>0 score -= 90 else attack = pbRoughStat(user,:ATTACK,skill) spatk = pbRoughStat(user,:SPECIAL_ATTACK,skill) if attack*1.5
=PBTrainerAI.mediumSkill && target.lastMoveUsed moveData = GameData::Move.get(target.lastMoveUsed) score += 60 if moveData.physical? end end #--------------------------------------------------------------------------- when "072" if target.effects[PBEffects::HyperBeam]>0 score -= 90 else attack = pbRoughStat(user,:ATTACK,skill) spatk = pbRoughStat(user,:SPECIAL_ATTACK,skill) if attack>spatk*1.5 score -= 60 elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed moveData = GameData::Move.get(target.lastMoveUsed) score += 60 if moveData.special? end end #--------------------------------------------------------------------------- when "073" score -= 90 if target.effects[PBEffects::HyperBeam]>0 #--------------------------------------------------------------------------- when "074" target.eachAlly do |b| next if !b.near?(target) score += 10 end #--------------------------------------------------------------------------- when "075" #--------------------------------------------------------------------------- when "076" #--------------------------------------------------------------------------- when "077" #--------------------------------------------------------------------------- when "078" if skill>=PBTrainerAI.highSkill score += 30 if !target.hasActiveAbility?(:INNERFOCUS) && target.effects[PBEffects::Substitute]==0 end #--------------------------------------------------------------------------- when "079" #--------------------------------------------------------------------------- when "07A" #--------------------------------------------------------------------------- when "07B" #--------------------------------------------------------------------------- when "07C" score -= 20 if target.status == :PARALYSIS # Will cure status #--------------------------------------------------------------------------- when "07D" #score -= 20 if target.status == :SLEEP && # Will cure status # target.statusCount > 1 score -= 20 if target.status == :SLEEP || target.status == :DROWSY && # Will cure status target.statusCount > 1 #--------------------------------------------------------------------------- when "07E" #--------------------------------------------------------------------------- when "07F" #--------------------------------------------------------------------------- when "080" #--------------------------------------------------------------------------- when "081" attspeed = pbRoughStat(user,:SPEED,skill) oppspeed = pbRoughStat(target,:SPEED,skill) score += 30 if oppspeed>attspeed #--------------------------------------------------------------------------- when "082" score += 20 if @battle.pbOpposingBattlerCount(user)>1 #--------------------------------------------------------------------------- when "083" if skill>=PBTrainerAI.mediumSkill user.eachAlly do |b| next if !b.pbHasMove?(move.id) score += 20 end end #--------------------------------------------------------------------------- when "084" attspeed = pbRoughStat(user,:SPEED,skill) oppspeed = pbRoughStat(target,:SPEED,skill) score += 30 if oppspeed>attspeed #--------------------------------------------------------------------------- when "085" #--------------------------------------------------------------------------- when "086" #--------------------------------------------------------------------------- when "087" #--------------------------------------------------------------------------- when "088" #--------------------------------------------------------------------------- when "089" #--------------------------------------------------------------------------- when "08A" #--------------------------------------------------------------------------- when "08B" #--------------------------------------------------------------------------- when "08C" #--------------------------------------------------------------------------- when "08D" #--------------------------------------------------------------------------- when "08E" #--------------------------------------------------------------------------- when "08F" #--------------------------------------------------------------------------- when "090" #--------------------------------------------------------------------------- when "091" #--------------------------------------------------------------------------- when "092" #--------------------------------------------------------------------------- when "093" score += 25 if user.effects[PBEffects::Rage] #--------------------------------------------------------------------------- when "094" #--------------------------------------------------------------------------- when "095" #--------------------------------------------------------------------------- when "096" score -= 90 if !user.item || !user.item.is_berry? || !user.itemActive? #--------------------------------------------------------------------------- when "097" #--------------------------------------------------------------------------- when "098" #--------------------------------------------------------------------------- when "099" #--------------------------------------------------------------------------- when "09A" #--------------------------------------------------------------------------- when "09B" #--------------------------------------------------------------------------- when "09C" hasAlly = false user.eachAlly do |b| hasAlly = true score += 30 break end score -= 90 if !hasAlly #--------------------------------------------------------------------------- when "09D" score -= 90 if user.effects[PBEffects::MudSport] #--------------------------------------------------------------------------- when "09E" score -= 90 if user.effects[PBEffects::WaterSport] #--------------------------------------------------------------------------- when "09F" #--------------------------------------------------------------------------- when "0A0" #--------------------------------------------------------------------------- when "0A1" score -= 90 if user.pbOwnSide.effects[PBEffects::LuckyChant]>0 #--------------------------------------------------------------------------- when "0A2" score -= 90 if user.pbOwnSide.effects[PBEffects::Reflect]>0 #--------------------------------------------------------------------------- when "0A3" score -= 90 if user.pbOwnSide.effects[PBEffects::LightScreen]>0 #--------------------------------------------------------------------------- when "0A4" #--------------------------------------------------------------------------- when "0A5" #--------------------------------------------------------------------------- when "0A6" score -= 90 if target.effects[PBEffects::Substitute]>0 score -= 90 if user.effects[PBEffects::LockOn]>0 #--------------------------------------------------------------------------- when "0A7" if target.effects[PBEffects::Foresight] score -= 90 elsif target.pbHasType?(:GHOST) score += 70 elsif target.stages[:EVASION]<=0 score -= 60 end #--------------------------------------------------------------------------- when "0A8" if target.effects[PBEffects::MiracleEye] score -= 90 elsif target.pbHasType?(:DARK) score += 70 elsif target.stages[:EVASION]<=0 score -= 60 end #--------------------------------------------------------------------------- when "0A9" #--------------------------------------------------------------------------- when "0AA" if user.effects[PBEffects::ProtectRate]>1 || target.effects[PBEffects::HyperBeam]>0 score -= 90 else if skill>=PBTrainerAI.mediumSkill score -= user.effects[PBEffects::ProtectRate]*40 end score += 50 if user.turnCount==0 score += 30 if target.effects[PBEffects::TwoTurnAttack] end #--------------------------------------------------------------------------- when "0AB" #--------------------------------------------------------------------------- when "0AC" #--------------------------------------------------------------------------- when "0AD" #--------------------------------------------------------------------------- when "0AE" score -= 40 if skill>=PBTrainerAI.highSkill score -= 100 if !target.lastRegularMoveUsed || !GameData::Move.get(target.lastRegularMoveUsed).flags[/e/] # Not copyable by Mirror Move end #--------------------------------------------------------------------------- when "0AF" #--------------------------------------------------------------------------- when "0B0" #--------------------------------------------------------------------------- when "0B1" #--------------------------------------------------------------------------- when "0B2" #--------------------------------------------------------------------------- when "0B3" #--------------------------------------------------------------------------- when "0B4" if user.asleep? score += 100 # Because it can only be used while asleep else score -= 90 end #--------------------------------------------------------------------------- when "0B5" #--------------------------------------------------------------------------- when "0B6" #--------------------------------------------------------------------------- when "0B7" score -= 90 if target.effects[PBEffects::Torment] #--------------------------------------------------------------------------- when "0B8" score -= 90 if user.effects[PBEffects::Imprison] #--------------------------------------------------------------------------- when "0B9" score -= 90 if target.effects[PBEffects::Disable]>0 #--------------------------------------------------------------------------- when "0BA" score -= 90 if target.effects[PBEffects::Taunt]>0 #--------------------------------------------------------------------------- when "0BB" score -= 90 if target.effects[PBEffects::HealBlock]>0 #--------------------------------------------------------------------------- when "0BC" aspeed = pbRoughStat(user,:SPEED,skil
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)