mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
AI changes, fixed input detection Conditional Branch, Fishious Rend is now a biting move
This commit is contained in:
@@ -429,7 +429,21 @@ class Interpreter
|
|||||||
result = (@parameters[2] == 0) ? (gold >= @parameters[1]) : (gold <= @parameters[1])
|
result = (@parameters[2] == 0) ? (gold >= @parameters[1]) : (gold <= @parameters[1])
|
||||||
# when 8, 9, 10 # item, weapon, armor
|
# when 8, 9, 10 # item, weapon, armor
|
||||||
when 11 # button
|
when 11 # button
|
||||||
result = Input.press?(@parameters[1])
|
button = {
|
||||||
|
2 => Input::DOWN,
|
||||||
|
4 => Input::LEFT,
|
||||||
|
6 => Input::RIGHT,
|
||||||
|
8 => Input::UP,
|
||||||
|
11 => Input::ACTION,
|
||||||
|
12 => Input::BACK,
|
||||||
|
13 => Input::USE,
|
||||||
|
14 => Input::JUMPUP,
|
||||||
|
15 => Input::JUMPDOWN,
|
||||||
|
16 => Input::SPECIAL,
|
||||||
|
17 => Input::AUX1,
|
||||||
|
18 => Input::AUX2
|
||||||
|
}[@parameters[1]]
|
||||||
|
result = button && Input.press?(button)
|
||||||
when 12 # script
|
when 12 # script
|
||||||
result = execute_script(@parameters[1])
|
result = execute_script(@parameters[1])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ class Battle
|
|||||||
next if !@battlers[idxBattler] || pbOwnedByPlayer?(idxBattler) != isPlayer
|
next if !@battlers[idxBattler] || pbOwnedByPlayer?(idxBattler) != isPlayer
|
||||||
if @choices[idxBattler][0] != :None || !pbCanShowCommands?(idxBattler)
|
if @choices[idxBattler][0] != :None || !pbCanShowCommands?(idxBattler)
|
||||||
# Action is forced, can't choose one
|
# Action is forced, can't choose one
|
||||||
PBDebug.log_ai("#{@battlers[idxBattler].pbThis} (#{idxBattler}) is forced to use a multi-turn move")
|
PBDebug.log("[Command phase] #{@battlers[idxBattler].pbThis} (#{idxBattler}) is forced to use a multi-turn move")
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
# AI controls this battler
|
# AI controls this battler
|
||||||
|
|||||||
@@ -192,13 +192,14 @@ Battle::AI::Handlers::ShouldSwitch.add(:perish_song,
|
|||||||
Battle::AI::Handlers::ShouldSwitch.add(:significant_eor_damage,
|
Battle::AI::Handlers::ShouldSwitch.add(:significant_eor_damage,
|
||||||
proc { |battler, reserves, ai, battle|
|
proc { |battler, reserves, ai, battle|
|
||||||
eor_damage = battler.rough_end_of_round_damage
|
eor_damage = battler.rough_end_of_round_damage
|
||||||
|
next false if eor_damage <= 0
|
||||||
# Switch if battler will take significant EOR damage
|
# Switch if battler will take significant EOR damage
|
||||||
if eor_damage >= battler.hp / 2 || eor_damage >= battler.totalhp / 4
|
if eor_damage >= battler.hp / 2 || eor_damage >= battler.totalhp / 4
|
||||||
PBDebug.log_ai("#{battler.name} wants to switch because it will take a lot of EOR damage")
|
PBDebug.log_ai("#{battler.name} wants to switch because it will take a lot of EOR damage")
|
||||||
next true
|
next true
|
||||||
end
|
end
|
||||||
# Switch to remove certain effects that cause the battler EOR damage
|
# Switch to remove certain effects that cause the battler EOR damage
|
||||||
if ai.trainer.high_skill? && eor_damage > 0
|
if ai.trainer.high_skill?
|
||||||
if battler.effects[PBEffects::LeechSeed] >= 0 && ai.pbAIRandom(100) < 50
|
if battler.effects[PBEffects::LeechSeed] >= 0 && ai.pbAIRandom(100) < 50
|
||||||
PBDebug.log_ai("#{battler.name} wants to switch to get rid of its Leech Seed")
|
PBDebug.log_ai("#{battler.name} wants to switch to get rid of its Leech Seed")
|
||||||
next true
|
next true
|
||||||
|
|||||||
@@ -69,12 +69,19 @@ class Battle::AI
|
|||||||
end
|
end
|
||||||
# Discard move if it can't raise any stats
|
# Discard move if it can't raise any stats
|
||||||
if real_stat_changes.length == 0
|
if real_stat_changes.length == 0
|
||||||
|
PBDebug.log(" ignore stat raising (it can't be changed)")
|
||||||
return (whole_effect) ? MOVE_USELESS_SCORE : score
|
return (whole_effect) ? MOVE_USELESS_SCORE : score
|
||||||
end
|
end
|
||||||
# Make score change based on the additional effect chance
|
# Make score change based on the additional effect chance
|
||||||
score += add_effect
|
if add_effect != 0
|
||||||
|
old_score = score
|
||||||
|
score += add_effect
|
||||||
|
PBDebug.log_score_change(score - old_score, "stat raising is an additional effect")
|
||||||
|
end
|
||||||
# Make score changes based on the general concept of raising stats at all
|
# Make score changes based on the general concept of raising stats at all
|
||||||
|
old_score = score
|
||||||
score = get_target_stat_raise_score_generic(score, target, real_stat_changes, desire_mult)
|
score = get_target_stat_raise_score_generic(score, target, real_stat_changes, desire_mult)
|
||||||
|
PBDebug.log_score_change(score - old_score, "generic calculations for raising any stat")
|
||||||
# Make score changes based on the specific changes to each stat that will be
|
# Make score changes based on the specific changes to each stat that will be
|
||||||
# raised
|
# raised
|
||||||
real_stat_changes.each do |change|
|
real_stat_changes.each do |change|
|
||||||
@@ -159,15 +166,15 @@ class Battle::AI
|
|||||||
total_increment = stat_changes.sum { |change| change[1] }
|
total_increment = stat_changes.sum { |change| change[1] }
|
||||||
# Prefer if move is a status move and it's the user's first/second turn
|
# Prefer if move is a status move and it's the user's first/second turn
|
||||||
if @user.turnCount < 2 && @move.statusMove?
|
if @user.turnCount < 2 && @move.statusMove?
|
||||||
score += total_increment * desire_mult * 5
|
score += total_increment * desire_mult * 4
|
||||||
end
|
end
|
||||||
if @trainer.has_skill_flag?("HPAware")
|
if @trainer.has_skill_flag?("HPAware")
|
||||||
# Prefer if user is at high HP, don't prefer if user is at low HP
|
# Prefer if user is at high HP, don't prefer if user is at low HP
|
||||||
if target.index != @user.index
|
if target.index != @user.index
|
||||||
score += total_increment * desire_mult * ((100 * @user.hp / @user.totalhp) - 50) / 8 # +6 to -6 per stage
|
score += total_increment * desire_mult * ((100 * @user.hp / @user.totalhp) - 50) / 12 # +4 to -4 per stage
|
||||||
end
|
end
|
||||||
# Prefer if target is at high HP, don't prefer if target is at low HP
|
# Prefer if target is at high HP, don't prefer if target is at low HP
|
||||||
score += total_increment * desire_mult * ((100 * target.hp / target.totalhp) - 50) / 8 # +6 to -6 per stage
|
score += total_increment * desire_mult * ((100 * target.hp / target.totalhp) - 50) / 12 # +4 to -4 per stage
|
||||||
end
|
end
|
||||||
# NOTE: There are no abilities that trigger upon stat raise, but this is
|
# NOTE: There are no abilities that trigger upon stat raise, but this is
|
||||||
# where they would be accounted for if they existed.
|
# where they would be accounted for if they existed.
|
||||||
@@ -366,12 +373,19 @@ class Battle::AI
|
|||||||
end
|
end
|
||||||
# Discard move if it can't lower any stats
|
# Discard move if it can't lower any stats
|
||||||
if real_stat_changes.length == 0
|
if real_stat_changes.length == 0
|
||||||
|
PBDebug.log(" ignore stat lowering (it can't be changed)")
|
||||||
return (whole_effect) ? MOVE_USELESS_SCORE : score
|
return (whole_effect) ? MOVE_USELESS_SCORE : score
|
||||||
end
|
end
|
||||||
# Make score change based on the additional effect chance
|
# Make score change based on the additional effect chance
|
||||||
score += add_effect
|
if add_effect != 0
|
||||||
|
old_score = score
|
||||||
|
score += add_effect
|
||||||
|
PBDebug.log_score_change(score - old_score, "stat lowering is an additional effect")
|
||||||
|
end
|
||||||
# Make score changes based on the general concept of lowering stats at all
|
# Make score changes based on the general concept of lowering stats at all
|
||||||
|
old_score = score
|
||||||
score = get_target_stat_drop_score_generic(score, target, real_stat_changes, desire_mult)
|
score = get_target_stat_drop_score_generic(score, target, real_stat_changes, desire_mult)
|
||||||
|
PBDebug.log_score_change(score - old_score, "generic calculations for lowering any stat")
|
||||||
# Make score changes based on the specific changes to each stat that will be
|
# Make score changes based on the specific changes to each stat that will be
|
||||||
# lowered
|
# lowered
|
||||||
real_stat_changes.each do |change|
|
real_stat_changes.each do |change|
|
||||||
@@ -447,15 +461,15 @@ class Battle::AI
|
|||||||
total_decrement = stat_changes.sum { |change| change[1] }
|
total_decrement = stat_changes.sum { |change| change[1] }
|
||||||
# Prefer if move is a status move and it's the user's first/second turn
|
# Prefer if move is a status move and it's the user's first/second turn
|
||||||
if @user.turnCount < 2 && @move.statusMove?
|
if @user.turnCount < 2 && @move.statusMove?
|
||||||
score += total_decrement * desire_mult * 5
|
score += total_decrement * desire_mult * 4
|
||||||
end
|
end
|
||||||
if @trainer.has_skill_flag?("HPAware")
|
if @trainer.has_skill_flag?("HPAware")
|
||||||
# Prefer if user is at high HP, don't prefer if user is at low HP
|
# Prefer if user is at high HP, don't prefer if user is at low HP
|
||||||
if target.index != @user.index
|
if target.index != @user.index
|
||||||
score += total_decrement * desire_mult * ((100 * @user.hp / @user.totalhp) - 50) / 8 # +6 to -6 per stage
|
score += total_decrement * desire_mult * ((100 * @user.hp / @user.totalhp) - 50) / 12 # +4 to -4 per stage
|
||||||
end
|
end
|
||||||
# Prefer if target is at high HP, don't prefer if target is at low HP
|
# Prefer if target is at high HP, don't prefer if target is at low HP
|
||||||
score += total_decrement * desire_mult * ((100 * target.hp / target.totalhp) - 50) / 8 # +6 to -6 per stage
|
score += total_decrement * desire_mult * ((100 * target.hp / target.totalhp) - 50) / 12 # +4 to -4 per stage
|
||||||
end
|
end
|
||||||
# Don't prefer if target has an ability that triggers upon stat loss
|
# Don't prefer if target has an ability that triggers upon stat loss
|
||||||
# (Competitive, Defiant)
|
# (Competitive, Defiant)
|
||||||
|
|||||||
@@ -241,6 +241,9 @@ Battle::AI::Handlers::GeneralMoveAgainstTargetScore.add(:target_can_make_moves_E
|
|||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Don't prefer attacking the target if they'd be semi-invulnerable.
|
# Don't prefer attacking the target if they'd be semi-invulnerable.
|
||||||
|
# TODO: Don't treat the move as useless? If the user's moves are all useless
|
||||||
|
# because of this, it will want to switch instead, which may not be
|
||||||
|
# desirable.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
Battle::AI::Handlers::GeneralMoveAgainstTargetScore.add(:target_semi_invulnerable,
|
Battle::AI::Handlers::GeneralMoveAgainstTargetScore.add(:target_semi_invulnerable,
|
||||||
proc { |score, move, user, target, ai, battle|
|
proc { |score, move, user, target, ai, battle|
|
||||||
@@ -308,7 +311,7 @@ Battle::AI::Handlers::GeneralMoveAgainstTargetScore.add(:predicted_damage,
|
|||||||
PBDebug.log_score_change(score - old_score, "damaging move (predicted damage #{dmg} = #{100 * dmg / target.hp}% of target's HP)")
|
PBDebug.log_score_change(score - old_score, "damaging move (predicted damage #{dmg} = #{100 * dmg / target.hp}% of target's HP)")
|
||||||
if ai.trainer.has_skill_flag?("HPAware") && dmg > target.hp * 1.1 # Predicted to KO the target
|
if ai.trainer.has_skill_flag?("HPAware") && dmg > target.hp * 1.1 # Predicted to KO the target
|
||||||
old_score = score
|
old_score = score
|
||||||
score += 10
|
score += 20
|
||||||
PBDebug.log_score_change(score - old_score, "predicted to KO the target")
|
PBDebug.log_score_change(score - old_score, "predicted to KO the target")
|
||||||
if move.move.multiHitMove? && target.hp == target.totalhp &&
|
if move.move.multiHitMove? && target.hp == target.totalhp &&
|
||||||
(target.has_active_ability?(:STURDY) || target.has_active_item?(:FOCUSSASH))
|
(target.has_active_ability?(:STURDY) || target.has_active_item?(:FOCUSSASH))
|
||||||
@@ -365,7 +368,7 @@ Battle::AI::Handlers::GeneralMoveAgainstTargetScore.add(:thawing_move_against_fr
|
|||||||
# Don't prefer a damaging move if it will trigger the target's ability or held
|
# Don't prefer a damaging move if it will trigger the target's ability or held
|
||||||
# item when used, e.g. Effect Spore/Rough Skin, Pickpocket, Rocky Helmet, Red
|
# item when used, e.g. Effect Spore/Rough Skin, Pickpocket, Rocky Helmet, Red
|
||||||
# Card.
|
# Card.
|
||||||
# NOTE: These abilities/items may not be triggerable after all (e.g. they
|
# TODO: These abilities/items may not be triggerable after all (e.g. they
|
||||||
# require the move to make contact but it doesn't), or may have a negative
|
# require the move to make contact but it doesn't), or may have a negative
|
||||||
# effect for the target (e.g. Air Balloon popping), but it's too much
|
# effect for the target (e.g. Air Balloon popping), but it's too much
|
||||||
# effort to go into detail deciding all this.
|
# effort to go into detail deciding all this.
|
||||||
@@ -378,14 +381,14 @@ Battle::AI::Handlers::GeneralMoveAgainstTargetScore.add(:trigger_target_ability_
|
|||||||
(Battle::AbilityEffects::AfterMoveUseFromTarget[target.ability] &&
|
(Battle::AbilityEffects::AfterMoveUseFromTarget[target.ability] &&
|
||||||
(!user.has_active_ability?(:SHEERFORCE) || move.move.addlEffect == 0))
|
(!user.has_active_ability?(:SHEERFORCE) || move.move.addlEffect == 0))
|
||||||
old_score = score
|
old_score = score
|
||||||
score += 8
|
score -= 8
|
||||||
PBDebug.log_score_change(score - old_score, "can trigger the target's ability")
|
PBDebug.log_score_change(score - old_score, "can trigger the target's ability")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if target.battler.isSpecies?(:CRAMORANT) && target.ability == :GULPMISSILE &&
|
if target.battler.isSpecies?(:CRAMORANT) && target.ability == :GULPMISSILE &&
|
||||||
target.battler.form > 0 && !target.effects[PBEffects::Transform]
|
target.battler.form > 0 && !target.effects[PBEffects::Transform]
|
||||||
old_score = score
|
old_score = score
|
||||||
score += 8
|
score -= 8
|
||||||
PBDebug.log_score_change(score - old_score, "can trigger the target's ability")
|
PBDebug.log_score_change(score - old_score, "can trigger the target's ability")
|
||||||
end
|
end
|
||||||
if target.item_active?
|
if target.item_active?
|
||||||
@@ -393,7 +396,7 @@ Battle::AI::Handlers::GeneralMoveAgainstTargetScore.add(:trigger_target_ability_
|
|||||||
(Battle::ItemEffects::AfterMoveUseFromTarget[target.item] &&
|
(Battle::ItemEffects::AfterMoveUseFromTarget[target.item] &&
|
||||||
(!user.has_active_ability?(:SHEERFORCE) || move.move.addlEffect == 0))
|
(!user.has_active_ability?(:SHEERFORCE) || move.move.addlEffect == 0))
|
||||||
old_score = score
|
old_score = score
|
||||||
score += 8
|
score -= 8
|
||||||
PBDebug.log_score_change(score - old_score, "can trigger the target's item")
|
PBDebug.log_score_change(score - old_score, "can trigger the target's item")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -543,21 +543,34 @@ class Battle::AI::AIMove
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
# Return values:
|
# Return values:
|
||||||
# 0: Regular additional effect chance or isn't an additional effect
|
# 0: Isn't an additional effect or always triggers
|
||||||
# -999: Additional effect will be negated
|
# -999: Additional effect will be negated
|
||||||
# Other: Amount to add to a move's score
|
# Other: Amount to add to a move's score
|
||||||
|
# TODO: This value just gets added to the score, but it should only modify the
|
||||||
|
# score for the additional effect and shouldn't reduce that to less than
|
||||||
|
# 0.
|
||||||
def get_score_change_for_additional_effect(user, target = nil)
|
def get_score_change_for_additional_effect(user, target = nil)
|
||||||
|
chance = @move.addlEffect
|
||||||
# Doesn't have an additional effect
|
# Doesn't have an additional effect
|
||||||
return 0 if @move.addlEffect == 0
|
return 0 if chance == 0
|
||||||
# Additional effect will be negated
|
# Additional effect will be negated
|
||||||
return -999 if user.has_active_ability?(:SHEERFORCE)
|
return -999 if user.has_active_ability?(:SHEERFORCE)
|
||||||
return -999 if target && user.index != target.index &&
|
return -999 if target && user.index != target.index &&
|
||||||
target.has_active_ability?(:SHIELDDUST) && !@ai.battle.moldBreaker
|
target.has_active_ability?(:SHIELDDUST) && !@ai.battle.moldBreaker
|
||||||
# Prefer if the additional effect will have an increased chance of working
|
# Additional effect will always trigger
|
||||||
return 5 if @move.addlEffect < 100 &&
|
return 0 if chance > 100
|
||||||
(Settings::MECHANICS_GENERATION >= 6 || function_code != "EffectDependsOnEnvironment") &&
|
# Calculate the chance
|
||||||
(user.has_active_ability?(:SERENEGRACE) || user.pbOwnSide.effects[PBEffects::Rainbow] > 0)
|
chance *= 2 if (Settings::MECHANICS_GENERATION >= 6 || function_code != "EffectDependsOnEnvironment") &&
|
||||||
# No change to score
|
(user.has_active_ability?(:SERENEGRACE) || user.pbOwnSide.effects[PBEffects::Rainbow] > 0)
|
||||||
return 0
|
# Don't prefer if the additional effect has a low chance of happening
|
||||||
|
ret = 0
|
||||||
|
if chance <= 10
|
||||||
|
ret -= 10
|
||||||
|
elsif chance <= 50
|
||||||
|
ret -= 5
|
||||||
|
elsif chance >= 80
|
||||||
|
ret += 5
|
||||||
|
end
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,32 +20,32 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("SleepTarget",
|
|||||||
next useless_score if add_effect == -999 # Additional effect will be negated
|
next useless_score if add_effect == -999 # Additional effect will be negated
|
||||||
score += add_effect
|
score += add_effect
|
||||||
# Inherent preference
|
# Inherent preference
|
||||||
score += 15
|
score += 8
|
||||||
# Prefer if the user or an ally has a move/ability that is better if the target is asleep
|
# Prefer if the user or an ally has a move/ability that is better if the target is asleep
|
||||||
ai.each_same_side_battler(user.side) do |b, i|
|
ai.each_same_side_battler(user.side) do |b, i|
|
||||||
score += 5 if b.has_move_with_function?("DoublePowerIfTargetAsleepCureTarget",
|
score += 4 if b.has_move_with_function?("DoublePowerIfTargetAsleepCureTarget",
|
||||||
"DoublePowerIfTargetStatusProblem",
|
"DoublePowerIfTargetStatusProblem",
|
||||||
"HealUserByHalfOfDamageDoneIfTargetAsleep",
|
"HealUserByHalfOfDamageDoneIfTargetAsleep",
|
||||||
"StartDamageTargetEachTurnIfTargetAsleep")
|
"StartDamageTargetEachTurnIfTargetAsleep")
|
||||||
score += 10 if b.has_active_ability?(:BADDREAMS)
|
score += 8 if b.has_active_ability?(:BADDREAMS)
|
||||||
end
|
end
|
||||||
# Don't prefer if target benefits from having the sleep status problem
|
# Don't prefer if target benefits from having the sleep status problem
|
||||||
# NOTE: The target's Guts/Quick Feet will benefit from the target being
|
# NOTE: The target's Guts/Quick Feet will benefit from the target being
|
||||||
# asleep, but the target won't (usually) be able to make use of
|
# asleep, but the target won't (usually) be able to make use of
|
||||||
# them, so they're not worth considering.
|
# them, so they're not worth considering.
|
||||||
score -= 10 if target.has_active_ability?(:EARLYBIRD)
|
score -= 5 if target.has_active_ability?(:EARLYBIRD)
|
||||||
score -= 8 if target.has_active_ability?(:MARVELSCALE)
|
score -= 4 if target.has_active_ability?(:MARVELSCALE)
|
||||||
# Don't prefer if target has a move it can use while asleep
|
# Don't prefer if target has a move it can use while asleep
|
||||||
score -= 8 if target.check_for_move { |m| m.usableWhenAsleep? }
|
score -= 4 if target.check_for_move { |m| m.usableWhenAsleep? }
|
||||||
# Don't prefer if the target can heal itself (or be healed by an ally)
|
# Don't prefer if the target can heal itself (or be healed by an ally)
|
||||||
if target.has_active_ability?(:SHEDSKIN)
|
if target.has_active_ability?(:SHEDSKIN)
|
||||||
score -= 8
|
score -= 5
|
||||||
elsif target.has_active_ability?(:HYDRATION) &&
|
elsif target.has_active_ability?(:HYDRATION) &&
|
||||||
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
||||||
score -= 15
|
score -= 8
|
||||||
end
|
end
|
||||||
ai.each_same_side_battler(target.side) do |b, i|
|
ai.each_same_side_battler(target.side) do |b, i|
|
||||||
score -= 8 if i != target.index && b.has_active_ability?(:HEALER)
|
score -= 5 if i != target.index && b.has_active_ability?(:HEALER)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next score
|
next score
|
||||||
@@ -109,38 +109,38 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("PoisonTarget",
|
|||||||
next useless_score if add_effect == -999 # Additional effect will be negated
|
next useless_score if add_effect == -999 # Additional effect will be negated
|
||||||
score += add_effect
|
score += add_effect
|
||||||
# Inherent preference
|
# Inherent preference
|
||||||
score += 15
|
|
||||||
# Prefer if the target is at high HP
|
|
||||||
if ai.trainer.has_skill_flag?("HPAware")
|
if ai.trainer.has_skill_flag?("HPAware")
|
||||||
score += 15 * target.hp / target.totalhp
|
score += 8 * target.hp / target.totalhp
|
||||||
|
else
|
||||||
|
score += 8
|
||||||
end
|
end
|
||||||
# Prefer if the user or an ally has a move/ability that is better if the target is poisoned
|
# Prefer if the user or an ally has a move/ability that is better if the target is poisoned
|
||||||
ai.each_same_side_battler(user.side) do |b, i|
|
ai.each_same_side_battler(user.side) do |b, i|
|
||||||
score += 5 if b.has_move_with_function?("DoublePowerIfTargetPoisoned",
|
score += 4 if b.has_move_with_function?("DoublePowerIfTargetPoisoned",
|
||||||
"DoublePowerIfTargetStatusProblem")
|
"DoublePowerIfTargetStatusProblem")
|
||||||
score += 10 if b.has_active_ability?(:MERCILESS)
|
score += 5 if b.has_active_ability?(:MERCILESS)
|
||||||
end
|
end
|
||||||
# Don't prefer if target benefits from having the poison status problem
|
# Don't prefer if target benefits from having the poison status problem
|
||||||
score -= 8 if target.has_active_ability?([:GUTS, :MARVELSCALE, :QUICKFEET, :TOXICBOOST])
|
score -= 5 if target.has_active_ability?([:GUTS, :MARVELSCALE, :QUICKFEET, :TOXICBOOST])
|
||||||
score -= 25 if target.has_active_ability?(:POISONHEAL)
|
score -= 15 if target.has_active_ability?(:POISONHEAL)
|
||||||
score -= 20 if target.has_active_ability?(:SYNCHRONIZE) &&
|
score -= 15 if target.has_active_ability?(:SYNCHRONIZE) &&
|
||||||
user.battler.pbCanPoisonSynchronize?(target.battler)
|
user.battler.pbCanPoisonSynchronize?(target.battler)
|
||||||
score -= 5 if target.has_move_with_function?("DoublePowerIfUserPoisonedBurnedParalyzed",
|
score -= 4 if target.has_move_with_function?("DoublePowerIfUserPoisonedBurnedParalyzed",
|
||||||
"CureUserBurnPoisonParalysis")
|
"CureUserBurnPoisonParalysis")
|
||||||
score -= 15 if target.check_for_move { |m|
|
score -= 8 if target.check_for_move { |m|
|
||||||
m.function_code == "GiveUserStatusToTarget" && user.battler.pbCanPoison?(target.battler, false, m)
|
m.function_code == "GiveUserStatusToTarget" && user.battler.pbCanPoison?(target.battler, false, m)
|
||||||
}
|
}
|
||||||
# Don't prefer if the target won't take damage from the poison
|
# Don't prefer if the target won't take damage from the poison
|
||||||
score -= 20 if !target.battler.takesIndirectDamage?
|
score -= 10 if !target.battler.takesIndirectDamage?
|
||||||
# Don't prefer if the target can heal itself (or be healed by an ally)
|
# Don't prefer if the target can heal itself (or be healed by an ally)
|
||||||
if target.has_active_ability?(:SHEDSKIN)
|
if target.has_active_ability?(:SHEDSKIN)
|
||||||
score -= 8
|
score -= 5
|
||||||
elsif target.has_active_ability?(:HYDRATION) &&
|
elsif target.has_active_ability?(:HYDRATION) &&
|
||||||
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
||||||
score -= 15
|
score -= 8
|
||||||
end
|
end
|
||||||
ai.each_same_side_battler(target.side) do |b, i|
|
ai.each_same_side_battler(target.side) do |b, i|
|
||||||
score -= 8 if i != target.index && b.has_active_ability?(:HEALER)
|
score -= 5 if i != target.index && b.has_active_ability?(:HEALER)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next score
|
next score
|
||||||
@@ -195,40 +195,40 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("ParalyzeTarget",
|
|||||||
next useless_score if add_effect == -999 # Additional effect will be negated
|
next useless_score if add_effect == -999 # Additional effect will be negated
|
||||||
score += add_effect
|
score += add_effect
|
||||||
# Inherent preference (because of the chance of full paralysis)
|
# Inherent preference (because of the chance of full paralysis)
|
||||||
score += 10
|
score += 8
|
||||||
# Prefer if the target is faster than the user but will become slower if
|
# Prefer if the target is faster than the user but will become slower if
|
||||||
# paralysed
|
# paralysed
|
||||||
if target.faster_than?(user)
|
if target.faster_than?(user)
|
||||||
user_speed = user.rough_stat(:SPEED)
|
user_speed = user.rough_stat(:SPEED)
|
||||||
target_speed = target.rough_stat(:SPEED)
|
target_speed = target.rough_stat(:SPEED)
|
||||||
score += 15 if target_speed < user_speed * ((Settings::MECHANICS_GENERATION >= 7) ? 2 : 4)
|
score += 8 if target_speed < user_speed * ((Settings::MECHANICS_GENERATION >= 7) ? 2 : 4)
|
||||||
end
|
end
|
||||||
# Prefer if the target is confused or infatuated, to compound the turn skipping
|
# Prefer if the target is confused or infatuated, to compound the turn skipping
|
||||||
score += 7 if target.effects[PBEffects::Confusion] > 1
|
score += 4 if target.effects[PBEffects::Confusion] > 1
|
||||||
score += 7 if target.effects[PBEffects::Attract] >= 0
|
score += 4 if target.effects[PBEffects::Attract] >= 0
|
||||||
# Prefer if the user or an ally has a move/ability that is better if the target is paralysed
|
# Prefer if the user or an ally has a move/ability that is better if the target is paralysed
|
||||||
ai.each_same_side_battler(user.side) do |b, i|
|
ai.each_same_side_battler(user.side) do |b, i|
|
||||||
score += 5 if b.has_move_with_function?("DoublePowerIfTargetParalyzedCureTarget",
|
score += 4 if b.has_move_with_function?("DoublePowerIfTargetParalyzedCureTarget",
|
||||||
"DoublePowerIfTargetStatusProblem")
|
"DoublePowerIfTargetStatusProblem")
|
||||||
end
|
end
|
||||||
# Don't prefer if target benefits from having the paralysis status problem
|
# Don't prefer if target benefits from having the paralysis status problem
|
||||||
score -= 8 if target.has_active_ability?([:GUTS, :MARVELSCALE, :QUICKFEET])
|
score -= 5 if target.has_active_ability?([:GUTS, :MARVELSCALE, :QUICKFEET])
|
||||||
score -= 20 if target.has_active_ability?(:SYNCHRONIZE) &&
|
score -= 15 if target.has_active_ability?(:SYNCHRONIZE) &&
|
||||||
user.battler.pbCanParalyzeSynchronize?(target.battler)
|
user.battler.pbCanParalyzeSynchronize?(target.battler)
|
||||||
score -= 5 if target.has_move_with_function?("DoublePowerIfUserPoisonedBurnedParalyzed",
|
score -= 4 if target.has_move_with_function?("DoublePowerIfUserPoisonedBurnedParalyzed",
|
||||||
"CureUserBurnPoisonParalysis")
|
"CureUserBurnPoisonParalysis")
|
||||||
score -= 15 if target.check_for_move { |m|
|
score -= 8 if target.check_for_move { |m|
|
||||||
m.function_code == "GiveUserStatusToTarget" && user.battler.pbCanParalyze?(target.battler, false, m)
|
m.function_code == "GiveUserStatusToTarget" && user.battler.pbCanParalyze?(target.battler, false, m)
|
||||||
}
|
}
|
||||||
# Don't prefer if the target can heal itself (or be healed by an ally)
|
# Don't prefer if the target can heal itself (or be healed by an ally)
|
||||||
if target.has_active_ability?(:SHEDSKIN)
|
if target.has_active_ability?(:SHEDSKIN)
|
||||||
score -= 8
|
score -= 5
|
||||||
elsif target.has_active_ability?(:HYDRATION) &&
|
elsif target.has_active_ability?(:HYDRATION) &&
|
||||||
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
||||||
score -= 15
|
score -= 8
|
||||||
end
|
end
|
||||||
ai.each_same_side_battler(target.side) do |b, i|
|
ai.each_same_side_battler(target.side) do |b, i|
|
||||||
score -= 8 if i != target.index && b.has_active_ability?(:HEALER)
|
score -= 5 if i != target.index && b.has_active_ability?(:HEALER)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next score
|
next score
|
||||||
@@ -295,37 +295,37 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("BurnTarget",
|
|||||||
next useless_score if add_effect == -999 # Additional effect will be negated
|
next useless_score if add_effect == -999 # Additional effect will be negated
|
||||||
score += add_effect
|
score += add_effect
|
||||||
# Inherent preference
|
# Inherent preference
|
||||||
score += 15
|
score += 8
|
||||||
# Prefer if the target knows any physical moves that will be weaked by a burn
|
# Prefer if the target knows any physical moves that will be weaked by a burn
|
||||||
if !target.has_active_ability?(:GUTS) && target.check_for_move { |m| m.physicalMove? }
|
if !target.has_active_ability?(:GUTS) && target.check_for_move { |m| m.physicalMove? }
|
||||||
score += 8
|
score += 4
|
||||||
score += 8 if !target.check_for_move { |m| m.specialMove? }
|
score += 4 if !target.check_for_move { |m| m.specialMove? }
|
||||||
end
|
end
|
||||||
# Prefer if the user or an ally has a move/ability that is better if the target is burned
|
# Prefer if the user or an ally has a move/ability that is better if the target is burned
|
||||||
ai.each_same_side_battler(user.side) do |b, i|
|
ai.each_same_side_battler(user.side) do |b, i|
|
||||||
score += 5 if b.has_move_with_function?("DoublePowerIfTargetStatusProblem")
|
score += 4 if b.has_move_with_function?("DoublePowerIfTargetStatusProblem")
|
||||||
end
|
end
|
||||||
# Don't prefer if target benefits from having the burn status problem
|
# Don't prefer if target benefits from having the burn status problem
|
||||||
score -= 8 if target.has_active_ability?([:FLAREBOOST, :GUTS, :MARVELSCALE, :QUICKFEET])
|
score -= 4 if target.has_active_ability?([:FLAREBOOST, :GUTS, :MARVELSCALE, :QUICKFEET])
|
||||||
score -= 5 if target.has_active_ability?(:HEATPROOF)
|
score -= 4 if target.has_active_ability?(:HEATPROOF)
|
||||||
score -= 20 if target.has_active_ability?(:SYNCHRONIZE) &&
|
score -= 15 if target.has_active_ability?(:SYNCHRONIZE) &&
|
||||||
user.battler.pbCanBurnSynchronize?(target.battler)
|
user.battler.pbCanBurnSynchronize?(target.battler)
|
||||||
score -= 5 if target.has_move_with_function?("DoublePowerIfUserPoisonedBurnedParalyzed",
|
score -= 4 if target.has_move_with_function?("DoublePowerIfUserPoisonedBurnedParalyzed",
|
||||||
"CureUserBurnPoisonParalysis")
|
"CureUserBurnPoisonParalysis")
|
||||||
score -= 15 if target.check_for_move { |m|
|
score -= 8 if target.check_for_move { |m|
|
||||||
m.function_code == "GiveUserStatusToTarget" && user.battler.pbCanBurn?(target.battler, false, m)
|
m.function_code == "GiveUserStatusToTarget" && user.battler.pbCanBurn?(target.battler, false, m)
|
||||||
}
|
}
|
||||||
# Don't prefer if the target won't take damage from the burn
|
# Don't prefer if the target won't take damage from the burn
|
||||||
score -= 20 if !target.battler.takesIndirectDamage?
|
score -= 10 if !target.battler.takesIndirectDamage?
|
||||||
# Don't prefer if the target can heal itself (or be healed by an ally)
|
# Don't prefer if the target can heal itself (or be healed by an ally)
|
||||||
if target.has_active_ability?(:SHEDSKIN)
|
if target.has_active_ability?(:SHEDSKIN)
|
||||||
score -= 8
|
score -= 5
|
||||||
elsif target.has_active_ability?(:HYDRATION) &&
|
elsif target.has_active_ability?(:HYDRATION) &&
|
||||||
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
||||||
score -= 15
|
score -= 8
|
||||||
end
|
end
|
||||||
ai.each_same_side_battler(target.side) do |b, i|
|
ai.each_same_side_battler(target.side) do |b, i|
|
||||||
score -= 8 if i != target.index && b.has_active_ability?(:HEALER)
|
score -= 5 if i != target.index && b.has_active_ability?(:HEALER)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next score
|
next score
|
||||||
@@ -377,27 +377,27 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("FreezeTarget",
|
|||||||
next useless_score if add_effect == -999 # Additional effect will be negated
|
next useless_score if add_effect == -999 # Additional effect will be negated
|
||||||
score += add_effect
|
score += add_effect
|
||||||
# Inherent preference
|
# Inherent preference
|
||||||
score += 15
|
score += 8
|
||||||
# Prefer if the user or an ally has a move/ability that is better if the target is frozen
|
# Prefer if the user or an ally has a move/ability that is better if the target is frozen
|
||||||
ai.each_same_side_battler(user.side) do |b, i|
|
ai.each_same_side_battler(user.side) do |b, i|
|
||||||
score += 5 if b.has_move_with_function?("DoublePowerIfTargetStatusProblem")
|
score += 4 if b.has_move_with_function?("DoublePowerIfTargetStatusProblem")
|
||||||
end
|
end
|
||||||
# Don't prefer if target benefits from having the frozen status problem
|
# Don't prefer if target benefits from having the frozen status problem
|
||||||
# NOTE: The target's Guts/Quick Feet will benefit from the target being
|
# NOTE: The target's Guts/Quick Feet will benefit from the target being
|
||||||
# frozen, but the target won't be able to make use of them, so
|
# frozen, but the target won't be able to make use of them, so
|
||||||
# they're not worth considering.
|
# they're not worth considering.
|
||||||
score -= 8 if target.has_active_ability?(:MARVELSCALE)
|
score -= 5 if target.has_active_ability?(:MARVELSCALE)
|
||||||
# Don't prefer if the target knows a move that can thaw it
|
# Don't prefer if the target knows a move that can thaw it
|
||||||
score -= 15 if target.check_for_move { |m| m.thawsUser? }
|
score -= 8 if target.check_for_move { |m| m.thawsUser? }
|
||||||
# Don't prefer if the target can heal itself (or be healed by an ally)
|
# Don't prefer if the target can heal itself (or be healed by an ally)
|
||||||
if target.has_active_ability?(:SHEDSKIN)
|
if target.has_active_ability?(:SHEDSKIN)
|
||||||
score -= 8
|
score -= 5
|
||||||
elsif target.has_active_ability?(:HYDRATION) &&
|
elsif target.has_active_ability?(:HYDRATION) &&
|
||||||
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
[:Rain, :HeavyRain].include?(target.battler.effectiveWeather)
|
||||||
score -= 15
|
score -= 8
|
||||||
end
|
end
|
||||||
ai.each_same_side_battler(target.side) do |b, i|
|
ai.each_same_side_battler(target.side) do |b, i|
|
||||||
score -= 8 if i != target.index && b.has_active_ability?(:HEALER)
|
score -= 5 if i != target.index && b.has_active_ability?(:HEALER)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next score
|
next score
|
||||||
@@ -532,11 +532,11 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("CureTargetBurn",
|
|||||||
add_effect = move.get_score_change_for_additional_effect(user, target)
|
add_effect = move.get_score_change_for_additional_effect(user, target)
|
||||||
next score if add_effect == -999 # Additional effect will be negated
|
next score if add_effect == -999 # Additional effect will be negated
|
||||||
if target.status == :BURN
|
if target.status == :BURN
|
||||||
score -= add_effect
|
score += add_effect
|
||||||
if target.wants_status_problem?(:BURN)
|
if target.wants_status_problem?(:BURN)
|
||||||
score += 15
|
score += 10
|
||||||
else
|
else
|
||||||
score -= 10
|
score -= 8
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next score
|
next score
|
||||||
@@ -581,10 +581,10 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("FlinchTarget",
|
|||||||
next score if add_effect == -999 # Additional effect will be negated
|
next score if add_effect == -999 # Additional effect will be negated
|
||||||
score += add_effect
|
score += add_effect
|
||||||
# Inherent preference
|
# Inherent preference
|
||||||
score += 15
|
score += 8
|
||||||
# Prefer if the target is paralysed, confused or infatuated, to compound the
|
# Prefer if the target is paralysed, confused or infatuated, to compound the
|
||||||
# turn skipping
|
# turn skipping
|
||||||
score += 8 if target.status == :PARALYSIS ||
|
score += 5 if target.status == :PARALYSIS ||
|
||||||
target.effects[PBEffects::Confusion] > 1 ||
|
target.effects[PBEffects::Confusion] > 1 ||
|
||||||
target.effects[PBEffects::Attract] >= 0
|
target.effects[PBEffects::Attract] >= 0
|
||||||
next score
|
next score
|
||||||
@@ -636,15 +636,15 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("ConfuseTarget",
|
|||||||
next score if add_effect == -999 # Additional effect will be negated
|
next score if add_effect == -999 # Additional effect will be negated
|
||||||
score += add_effect
|
score += add_effect
|
||||||
# Inherent preference
|
# Inherent preference
|
||||||
score += 10
|
|
||||||
# Prefer if the target is at high HP
|
|
||||||
if ai.trainer.has_skill_flag?("HPAware")
|
if ai.trainer.has_skill_flag?("HPAware")
|
||||||
score += 20 * target.hp / target.totalhp
|
score += 8 * target.hp / target.totalhp
|
||||||
|
else
|
||||||
|
score += 8
|
||||||
end
|
end
|
||||||
# Prefer if the target is paralysed or infatuated, to compound the turn skipping
|
# Prefer if the target is paralysed or infatuated, to compound the turn skipping
|
||||||
score += 8 if target.status == :PARALYSIS || target.effects[PBEffects::Attract] >= 0
|
score += 5 if target.status == :PARALYSIS || target.effects[PBEffects::Attract] >= 0
|
||||||
# Don't prefer if target benefits from being confused
|
# Don't prefer if target benefits from being confused
|
||||||
score -= 15 if target.has_active_ability?(:TANGLEDFEET)
|
score -= 8 if target.has_active_ability?(:TANGLEDFEET)
|
||||||
end
|
end
|
||||||
next score
|
next score
|
||||||
}
|
}
|
||||||
@@ -671,14 +671,14 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("AttractTarget",
|
|||||||
next score if add_effect == -999 # Additional effect will be negated
|
next score if add_effect == -999 # Additional effect will be negated
|
||||||
score += add_effect
|
score += add_effect
|
||||||
# Inherent preference
|
# Inherent preference
|
||||||
score += 15
|
score += 8
|
||||||
# Prefer if the target is paralysed or confused, to compound the turn skipping
|
# Prefer if the target is paralysed or confused, to compound the turn skipping
|
||||||
score += 8 if target.status == :PARALYSIS || target.effects[PBEffects::Confusion] > 1
|
score += 5 if target.status == :PARALYSIS || target.effects[PBEffects::Confusion] > 1
|
||||||
# Don't prefer if the target can infatuate the user because of this move
|
# Don't prefer if the target can infatuate the user because of this move
|
||||||
score -= 15 if target.has_active_item?(:DESTINYKNOT) &&
|
score -= 10 if target.has_active_item?(:DESTINYKNOT) &&
|
||||||
user.battler.pbCanAttract?(target.battler, false)
|
user.battler.pbCanAttract?(target.battler, false)
|
||||||
# Don't prefer if the user has another way to infatuate the target
|
# Don't prefer if the user has another way to infatuate the target
|
||||||
score -= 15 if move.statusMove? && user.has_active_ability?(:CUTECHARM)
|
score -= 8 if move.statusMove? && user.has_active_ability?(:CUTECHARM)
|
||||||
end
|
end
|
||||||
next score
|
next score
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -647,6 +647,8 @@ Battle::AI::Handlers::MoveEffectScore.add("StartWeakenPhysicalDamageAgainstUserS
|
|||||||
proc { |score, move, user, ai, battle|
|
proc { |score, move, user, ai, battle|
|
||||||
# Doesn't stack with Aurora Veil
|
# Doesn't stack with Aurora Veil
|
||||||
next Battle::AI::MOVE_USELESS_SCORE if user.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
|
next Battle::AI::MOVE_USELESS_SCORE if user.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
|
||||||
|
# Prefer if the user is newly in battle
|
||||||
|
score += 15 if user.turnCount < 2
|
||||||
# Don't prefer the lower the user's HP is
|
# Don't prefer the lower the user's HP is
|
||||||
if ai.trainer.has_skill_flag?("HPAware") && battle.pbAbleNonActiveCount(user.idxOwnSide) == 0
|
if ai.trainer.has_skill_flag?("HPAware") && battle.pbAbleNonActiveCount(user.idxOwnSide) == 0
|
||||||
if user.hp <= user.totalhp / 2
|
if user.hp <= user.totalhp / 2
|
||||||
@@ -677,6 +679,8 @@ Battle::AI::Handlers::MoveEffectScore.add("StartWeakenSpecialDamageAgainstUserSi
|
|||||||
proc { |score, move, user, ai, battle|
|
proc { |score, move, user, ai, battle|
|
||||||
# Doesn't stack with Aurora Veil
|
# Doesn't stack with Aurora Veil
|
||||||
next Battle::AI::MOVE_USELESS_SCORE if user.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
|
next Battle::AI::MOVE_USELESS_SCORE if user.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
|
||||||
|
# Prefer if the user is newly in battle
|
||||||
|
score += 15 if user.turnCount < 2
|
||||||
# Don't prefer the lower the user's HP is
|
# Don't prefer the lower the user's HP is
|
||||||
if ai.trainer.has_skill_flag?("HPAware") && battle.pbAbleNonActiveCount(user.idxOwnSide) == 0
|
if ai.trainer.has_skill_flag?("HPAware") && battle.pbAbleNonActiveCount(user.idxOwnSide) == 0
|
||||||
if user.hp <= user.totalhp / 2
|
if user.hp <= user.totalhp / 2
|
||||||
@@ -710,6 +714,8 @@ Battle::AI::Handlers::MoveEffectScore.add("StartWeakenDamageAgainstUserSideIfHai
|
|||||||
# Doesn't stack with Reflect/Light Screen
|
# Doesn't stack with Reflect/Light Screen
|
||||||
next Battle::AI::MOVE_USELESS_SCORE if user.pbOwnSide.effects[PBEffects::Reflect] > 0 &&
|
next Battle::AI::MOVE_USELESS_SCORE if user.pbOwnSide.effects[PBEffects::Reflect] > 0 &&
|
||||||
user.pbOwnSide.effects[PBEffects::LightScreen] > 0
|
user.pbOwnSide.effects[PBEffects::LightScreen] > 0
|
||||||
|
# Prefer if the user is newly in battle
|
||||||
|
score += 15 if user.turnCount < 2
|
||||||
# Don't prefer the lower the user's HP is
|
# Don't prefer the lower the user's HP is
|
||||||
if ai.trainer.has_skill_flag?("HPAware") && battle.pbAbleNonActiveCount(user.idxOwnSide) == 0
|
if ai.trainer.has_skill_flag?("HPAware") && battle.pbAbleNonActiveCount(user.idxOwnSide) == 0
|
||||||
if user.hp <= user.totalhp / 2
|
if user.hp <= user.totalhp / 2
|
||||||
|
|||||||
@@ -148,11 +148,11 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("HealUserByTargetAttackLo
|
|||||||
heal_amt = target.rough_stat(:ATTACK)
|
heal_amt = target.rough_stat(:ATTACK)
|
||||||
heal_amt *= 1.3 if user.has_active_item?(:BIGROOT)
|
heal_amt *= 1.3 if user.has_active_item?(:BIGROOT)
|
||||||
heal_amt = [heal_amt, user.totalhp - user.hp].min
|
heal_amt = [heal_amt, user.totalhp - user.hp].min
|
||||||
if heal_amt > user.totalhp * 0.3 # Only modify the score if it'll heal a decent amount
|
if heal_amt > user.totalhp * 0.2 # Only modify the score if it'll heal a decent amount
|
||||||
if user.hp < user.totalhp * 0.5
|
if user.hp < user.totalhp * 0.5
|
||||||
score += 20 * (user.totalhp - user.hp) / user.totalhp # +10 to +20
|
score += 20 * (user.totalhp - user.hp) / user.totalhp # +10 to +20
|
||||||
end
|
end
|
||||||
score += 20 * heal_amt / user.totalhp # +6 to +20
|
score += 20 * heal_amt / user.totalhp # +4 to +20
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -175,11 +175,11 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("HealUserByHalfOfDamageDo
|
|||||||
heal_amt = rough_dmg / 2
|
heal_amt = rough_dmg / 2
|
||||||
heal_amt *= 1.3 if user.has_active_item?(:BIGROOT)
|
heal_amt *= 1.3 if user.has_active_item?(:BIGROOT)
|
||||||
heal_amt = [heal_amt, user.totalhp - user.hp].min
|
heal_amt = [heal_amt, user.totalhp - user.hp].min
|
||||||
if heal_amt > user.totalhp * 0.3 # Only modify the score if it'll heal a decent amount
|
if heal_amt > user.totalhp * 0.2 # Only modify the score if it'll heal a decent amount
|
||||||
if user.hp < user.totalhp * 0.5
|
if user.hp < user.totalhp * 0.5
|
||||||
score += 20 * (user.totalhp - user.hp) / user.totalhp # +10 to +20
|
score += 20 * (user.totalhp - user.hp) / user.totalhp # +10 to +20
|
||||||
end
|
end
|
||||||
score += 20 * heal_amt / user.totalhp # +6 to +20
|
score += 20 * heal_amt / user.totalhp # +4 to +20
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -213,11 +213,11 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("HealUserByThreeQuartersO
|
|||||||
heal_amt = rough_dmg * 0.75
|
heal_amt = rough_dmg * 0.75
|
||||||
heal_amt *= 1.3 if user.has_active_item?(:BIGROOT)
|
heal_amt *= 1.3 if user.has_active_item?(:BIGROOT)
|
||||||
heal_amt = [heal_amt, user.totalhp - user.hp].min
|
heal_amt = [heal_amt, user.totalhp - user.hp].min
|
||||||
if heal_amt > user.totalhp * 0.3 # Only modify the score if it'll heal a decent amount
|
if heal_amt > user.totalhp * 0.2 # Only modify the score if it'll heal a decent amount
|
||||||
if user.hp < user.totalhp * 0.5
|
if user.hp < user.totalhp * 0.5
|
||||||
score += 20 * (user.totalhp - user.hp) / user.totalhp # +10 to +20
|
score += 20 * (user.totalhp - user.hp) / user.totalhp # +10 to +20
|
||||||
end
|
end
|
||||||
score += 20 * heal_amt / user.totalhp # +6 to +20
|
score += 20 * heal_amt / user.totalhp # +4 to +20
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -241,30 +241,30 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("BindTarget",
|
|||||||
next score if target.effects[PBEffects::Substitute] > 0
|
next score if target.effects[PBEffects::Substitute] > 0
|
||||||
# Prefer if the user has a Binding Band or Grip Claw (because why have it if
|
# Prefer if the user has a Binding Band or Grip Claw (because why have it if
|
||||||
# you don't want to use it?)
|
# you don't want to use it?)
|
||||||
score += 5 if user.has_active_item?([:BINDINGBAND, :GRIPCLAW])
|
score += 4 if user.has_active_item?([:BINDINGBAND, :GRIPCLAW])
|
||||||
# Target will take damage at the end of each round from the binding
|
# Target will take damage at the end of each round from the binding
|
||||||
score += 10 if target.battler.takesIndirectDamage?
|
score += 8 if target.battler.takesIndirectDamage?
|
||||||
# Check whether the target will be trapped in battle by the binding
|
# Check whether the target will be trapped in battle by the binding
|
||||||
if target.can_become_trapped?
|
if target.can_become_trapped?
|
||||||
score += 8 # Prefer if the target will become trapped by this move
|
score += 4 # Prefer if the target will become trapped by this move
|
||||||
eor_damage = target.rough_end_of_round_damage
|
eor_damage = target.rough_end_of_round_damage
|
||||||
if eor_damage > 0
|
if eor_damage > 0
|
||||||
# Prefer if the target will take damage at the end of each round on top
|
# Prefer if the target will take damage at the end of each round on top
|
||||||
# of binding damage
|
# of binding damage
|
||||||
score += 10
|
score += 5
|
||||||
elsif eor_damage < 0
|
elsif eor_damage < 0
|
||||||
# Don't prefer if the target will heal itself at the end of each round
|
# Don't prefer if the target will heal itself at the end of each round
|
||||||
score -= 10
|
score -= 5
|
||||||
end
|
end
|
||||||
# Prefer if the target has been Perish Songed
|
# Prefer if the target has been Perish Songed
|
||||||
score += 15 if target.effects[PBEffects::PerishSong] > 0
|
score += 10 if target.effects[PBEffects::PerishSong] > 0
|
||||||
end
|
end
|
||||||
# Don't prefer if the target can remove the binding (and the binding has an
|
# Don't prefer if the target can remove the binding (and the binding has an
|
||||||
# effect)
|
# effect)
|
||||||
if target.can_become_trapped? || target.battler.takesIndirectDamage?
|
if target.can_become_trapped? || target.battler.takesIndirectDamage?
|
||||||
if ai.trainer.medium_skill? &&
|
if ai.trainer.medium_skill? &&
|
||||||
target.has_move_with_function?("RemoveUserBindingAndEntryHazards")
|
target.has_move_with_function?("RemoveUserBindingAndEntryHazards")
|
||||||
score -= 10
|
score -= 8
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
next score
|
next score
|
||||||
|
|||||||
@@ -8408,7 +8408,7 @@ Accuracy = 100
|
|||||||
TotalPP = 10
|
TotalPP = 10
|
||||||
Target = NearOther
|
Target = NearOther
|
||||||
FunctionCode = DoublePowerIfTargetNotActed
|
FunctionCode = DoublePowerIfTargetNotActed
|
||||||
Flags = Contact,CanProtect,CanMirrorMove
|
Flags = Contact,CanProtect,CanMirrorMove,Biting
|
||||||
Description = The user rends the target with its hard gills. Power doubles if the user moves first.
|
Description = The user rends the target with its hard gills. Power doubles if the user moves first.
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
[LIQUIDATION]
|
[LIQUIDATION]
|
||||||
|
|||||||
@@ -8408,7 +8408,7 @@ Accuracy = 100
|
|||||||
TotalPP = 10
|
TotalPP = 10
|
||||||
Target = NearOther
|
Target = NearOther
|
||||||
FunctionCode = DoublePowerIfTargetNotActed
|
FunctionCode = DoublePowerIfTargetNotActed
|
||||||
Flags = Contact,CanProtect,CanMirrorMove
|
Flags = Contact,CanProtect,CanMirrorMove,Biting
|
||||||
Description = The user rends the target with its hard gills. Power doubles if the user moves first.
|
Description = The user rends the target with its hard gills. Power doubles if the user moves first.
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
[LIQUIDATION]
|
[LIQUIDATION]
|
||||||
|
|||||||
Reference in New Issue
Block a user