mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 14:44:58 +00:00
Coded some Gen 9 ability/item/move effects
This commit is contained in:
@@ -341,17 +341,23 @@ Battle::AI::Handlers::MoveEffectScore.add("StartPsychicTerrain",
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
Battle::AI::Handlers::MoveFailureCheck.add("RemoveTerrain",
|
||||
proc { |move, user, ai, battle|
|
||||
next battle.field.terrain == :None
|
||||
}
|
||||
)
|
||||
Battle::AI::Handlers::MoveEffectScore.add("RemoveTerrain",
|
||||
proc { |score, move, user, ai, battle|
|
||||
next score - ai.get_score_for_terrain(battle.field.terrain, user)
|
||||
}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
Battle::AI::Handlers::MoveFailureCheck.add("RemoveTerrainFailsIfNoTerrain",
|
||||
proc { |move, user, ai, battle|
|
||||
next battle.field.terrain == :None
|
||||
}
|
||||
)
|
||||
Battle::AI::Handlers::MoveEffectScore.copy("RemoveTerrain",
|
||||
"RemoveTerrainFailsIfNoTerrain")
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
@@ -628,7 +628,7 @@ Battle::AI::Handlers::MoveFailureAgainstTargetCheck.add("RaiseTargetAttack2Confu
|
||||
)
|
||||
Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("RaiseTargetAttack2ConfuseTarget",
|
||||
proc { |score, move, user, target, ai, battle|
|
||||
if !target.has_active_ability?(:CONTRARY) || battle.moldBreaker
|
||||
if !target.has_active_ability?(:CONTRARY) || target.being_mold_broken?
|
||||
next Battle::AI::MOVE_USELESS_SCORE if !target.battler.pbCanConfuse?(user.battler, false, move.move)
|
||||
end
|
||||
# Score for stat raise
|
||||
@@ -650,7 +650,7 @@ Battle::AI::Handlers::MoveFailureAgainstTargetCheck.add("RaiseTargetSpAtk1Confus
|
||||
)
|
||||
Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("RaiseTargetSpAtk1ConfuseTarget",
|
||||
proc { |score, move, user, target, ai, battle|
|
||||
if !target.has_active_ability?(:CONTRARY) || battle.moldBreaker
|
||||
if !target.has_active_ability?(:CONTRARY) || target.being_mold_broken?
|
||||
next Battle::AI::MOVE_USELESS_SCORE if !target.battler.pbCanConfuse?(user.battler, false, move.move)
|
||||
end
|
||||
# Score for stat raise
|
||||
@@ -690,7 +690,7 @@ Battle::AI::Handlers::MoveFailureAgainstTargetCheck.add("RaiseTargetRandomStat2"
|
||||
)
|
||||
Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("RaiseTargetRandomStat2",
|
||||
proc { |score, move, user, target, ai, battle|
|
||||
next Battle::AI::MOVE_USELESS_SCORE if !battle.moldBreaker && target.has_active_ability?(:CONTRARY)
|
||||
next Battle::AI::MOVE_USELESS_SCORE if target.has_active_ability?(:CONTRARY) && !target.being_mold_broken?
|
||||
next Battle::AI::MOVE_USELESS_SCORE if target.rough_end_of_round_damage >= target.hp
|
||||
score -= 7 if target.index != user.index # Less likely to use on ally
|
||||
score += 10 if target.has_active_ability?(:SIMPLE)
|
||||
@@ -831,7 +831,7 @@ Battle::AI::Handlers::MoveFailureAgainstTargetCheck.add("LowerTargetSpAtk2IfCanA
|
||||
next true if move.statusMove? &&
|
||||
!target.battler.pbCanLowerStatStage?(move.move.statDown[0], user.battler, move.move)
|
||||
next true if user.gender == 2 || target.gender == 2 || user.gender == target.gender
|
||||
next true if !battle.moldBreaker && target.has_active_ability?(:OBLIVIOUS)
|
||||
next true if target.has_active_ability?(:OBLIVIOUS) && !target.being_mold_broken?
|
||||
next false
|
||||
}
|
||||
)
|
||||
|
||||
@@ -576,7 +576,7 @@ Battle::AI::Handlers::MoveEffectScore.add("StartUserSideImmunityToInflictedStatu
|
||||
Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("FlinchTarget",
|
||||
proc { |score, move, user, target, ai, battle|
|
||||
next score if target.faster_than?(user) || target.effects[PBEffects::Substitute] > 0
|
||||
next score if target.has_active_ability?(:INNERFOCUS) && !battle.moldBreaker
|
||||
next score if target.has_active_ability?(:INNERFOCUS) && !target.being_mold_broken?
|
||||
add_effect = move.get_score_change_for_additional_effect(user, target)
|
||||
next score if add_effect == -999 # Additional effect will be negated
|
||||
score += add_effect
|
||||
|
||||
@@ -63,7 +63,7 @@ Battle::AI::Handlers::MoveBasePower.add("LowerTargetHPToUserHP",
|
||||
Battle::AI::Handlers::MoveFailureAgainstTargetCheck.add("OHKO",
|
||||
proc { |move, user, target, ai, battle|
|
||||
next true if target.level > user.level
|
||||
next true if !battle.moldBreaker && target.has_active_ability?(:STURDY)
|
||||
next true if target.has_active_ability?(:STURDY) && !target.being_mold_broken?
|
||||
next false
|
||||
}
|
||||
)
|
||||
@@ -144,7 +144,8 @@ Battle::AI::Handlers::MoveBasePower.copy("PowerHigherWithUserHP",
|
||||
#
|
||||
#===============================================================================
|
||||
Battle::AI::Handlers::MoveBasePower.copy("PowerHigherWithUserHP",
|
||||
"PowerHigherWithTargetHP")
|
||||
"PowerHigherWithTargetHP100",
|
||||
"PowerHigherWithTargetHP120")
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
|
||||
@@ -126,7 +126,7 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("CureTargetStatusHealUser
|
||||
#===============================================================================
|
||||
Battle::AI::Handlers::MoveFailureAgainstTargetCheck.add("HealUserByTargetAttackLowerTargetAttack1",
|
||||
proc { |move, user, target, ai, battle|
|
||||
if !battle.moldBreaker && target.has_active_ability?(:CONTRARY)
|
||||
if target.has_active_ability?(:CONTRARY) && !target.being_mold_broken?
|
||||
next target.statStageAtMax?(:ATTACK)
|
||||
end
|
||||
next target.statStageAtMin?(:ATTACK)
|
||||
@@ -456,7 +456,7 @@ Battle::AI::Handlers::MoveEffectScore.add("UserLosesHalfOfTotalHP",
|
||||
#===============================================================================
|
||||
Battle::AI::Handlers::MoveFailureCheck.add("UserLosesHalfOfTotalHPExplosive",
|
||||
proc { |move, user, ai, battle|
|
||||
next !battle.moldBreaker && battle.pbCheckGlobalAbility(:DAMP)
|
||||
next !battle.pbCheckGlobalAbility(:DAMP, true).nil?
|
||||
}
|
||||
)
|
||||
Battle::AI::Handlers::MoveEffectScore.copy("UserLosesHalfOfTotalHP",
|
||||
|
||||
@@ -7,7 +7,7 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("UserTakesTargetItem",
|
||||
next score if !target.item || target.battler.unlosableItem?(target.item)
|
||||
next score if user.battler.unlosableItem?(target.item)
|
||||
next score if target.effects[PBEffects::Substitute] > 0
|
||||
next score if target.has_active_ability?(:STICKYHOLD) && !battle.moldBreaker
|
||||
next score if target.has_active_ability?(:STICKYHOLD) && !target.being_mold_broken?
|
||||
# User can steal the target's item; score it
|
||||
user_item_preference = user.wants_item?(target.item_id)
|
||||
user_no_item_preference = user.wants_item?(:NONE)
|
||||
@@ -58,7 +58,7 @@ Battle::AI::Handlers::MoveFailureAgainstTargetCheck.add("UserTargetSwapItems",
|
||||
next true if !user.item && !target.item
|
||||
next true if user.battler.unlosableItem?(user.item) || user.battler.unlosableItem?(target.item)
|
||||
next true if target.battler.unlosableItem?(target.item) || target.battler.unlosableItem?(user.item)
|
||||
next true if target.has_active_ability?(:STICKYHOLD) && !battle.moldBreaker
|
||||
next true if target.has_active_ability?(:STICKYHOLD) && !target.being_mold_broken?
|
||||
next false
|
||||
}
|
||||
)
|
||||
@@ -113,7 +113,7 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("RemoveTargetItem",
|
||||
next score if user.wild?
|
||||
next score if !target.item || target.battler.unlosableItem?(target.item)
|
||||
next score if target.effects[PBEffects::Substitute] > 0
|
||||
next score if target.has_active_ability?(:STICKYHOLD) && !battle.moldBreaker
|
||||
next score if target.has_active_ability?(:STICKYHOLD) && !target.being_mold_broken?
|
||||
next score if !target.item_active?
|
||||
# User can knock off the target's item; score it
|
||||
item_preference = target.wants_item?(target.item_id)
|
||||
@@ -132,7 +132,7 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("DestroyTargetBerryOrGem"
|
||||
!(Settings::MECHANICS_GENERATION >= 6 && target.item.is_gem?))
|
||||
next score if user.battler.unlosableItem?(target.item)
|
||||
next score if target.effects[PBEffects::Substitute] > 0
|
||||
next score if target.has_active_ability?(:STICKYHOLD) && !battle.moldBreaker
|
||||
next score if target.has_active_ability?(:STICKYHOLD) && !target.being_mold_broken?
|
||||
next score if !target.item_active?
|
||||
# User can incinerate the target's item; score it
|
||||
item_preference = target.wants_item?(target.item_id)
|
||||
@@ -302,7 +302,7 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("UserConsumeTargetBerry",
|
||||
next score if !target.item || !target.item.is_berry?
|
||||
next score if user.battler.unlosableItem?(target.item)
|
||||
next score if target.effects[PBEffects::Substitute] > 0
|
||||
next score if target.has_active_ability?(:STICKYHOLD) && !battle.moldBreaker
|
||||
next score if target.has_active_ability?(:STICKYHOLD) && !target.being_mold_broken?
|
||||
# Score the user gaining the item's effect
|
||||
score += user.get_score_change_for_consuming_item(target.item_id)
|
||||
# Score for other results of consuming the berry
|
||||
|
||||
@@ -201,7 +201,7 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("SwitchOutTargetDamagingM
|
||||
proc { |score, move, user, target, ai, battle|
|
||||
next score if target.wild?
|
||||
# No score modification if the target can't be made to switch out
|
||||
next score if !battle.moldBreaker && target.has_active_ability?(:SUCTIONCUPS)
|
||||
next score if target.has_active_ability?(:SUCTIONCUPS) && !target.being_mold_broken?
|
||||
next score if target.effects[PBEffects::Ingrain]
|
||||
# No score modification if the target can't be replaced
|
||||
can_switch = false
|
||||
@@ -764,7 +764,7 @@ Battle::AI::Handlers::MoveFailureAgainstTargetCheck.add("DisableTargetStatusMove
|
||||
next true if target.effects[PBEffects::Taunt] > 0
|
||||
next true if move.move.pbMoveFailedAromaVeil?(user.battler, target.battler, false)
|
||||
next true if Settings::MECHANICS_GENERATION >= 6 &&
|
||||
!battle.moldBreaker && target.has_active_ability?(:OBLIVIOUS)
|
||||
target.has_active_ability?(:OBLIVIOUS) && !target.being_mold_broken?
|
||||
next false
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user