Merge branch 'dev' into ui-redesign

This commit is contained in:
Maruno17
2024-09-20 21:30:46 +01:00
15 changed files with 168 additions and 39 deletions

View File

@@ -897,16 +897,12 @@ class Battle::Move::DisableTargetHealingMoves < Battle::Move
end
#===============================================================================
# Target cannot use sound-based moves for 2 more rounds. (Throat Chop)
# Target cannot use sound-based moves for 2 rounds. (Throat Chop)
#===============================================================================
class Battle::Move::DisableTargetSoundMoves < Battle::Move
def pbAdditionalEffect(user, target)
return if target.fainted? || target.damageState.substitute
if target.effects[PBEffects::ThroatChop] == 0
@battle.pbDisplay(_INTL("The effects of {1} prevent {2} from using certain moves!",
@name, target.pbThis(true)))
end
target.effects[PBEffects::ThroatChop] = 3
target.effects[PBEffects::ThroatChop] = 2 if target.effects[PBEffects::ThroatChop] == 0
end
end

View File

@@ -194,13 +194,23 @@ class Battle::AI
# Returns whether the move will definitely fail against the target (assuming
# no battle conditions change between now and using the move).
def pbPredictMoveFailureAgainstTarget
calc_type = @move.rough_type
typeMod = @move.move.pbCalcTypeMod(calc_type, @user.battler, @target.battler)
# Move effect-specific checks
return true if Battle::AI::Handlers.move_will_fail_against_target?(@move.function_code, @move, @user, @target, self, @battle)
# Immunity to priority moves because of Psychic Terrain
return true if @battle.field.terrain == :Psychic && @target.battler.affectedByTerrain? &&
@target.opposes?(@user) && @move.rough_priority(@user) > 0
# Immunity because of ability
return true if @move.move.pbImmunityByAbility(@user.battler, @target.battler, false)
if @target.has_active_ability?(:WONDERGUARD) && !@target.being_mold_broken?
# NOTE: The Battle::AbilityEffects::MoveImmunity for Wonder Guard makes
# use of target.damageState.typeMod, which isn't set by the AI, so
# its triggering needs to be checked here instead of via
# pbImmunityByAbility.
return true if move.damagingMove? && calc_type && !Effectiveness.super_effective?(typeMod)
else
return true if @move.move.pbImmunityByAbility(@user.battler, @target.battler, false)
end
# Immunity because of Dazzling/Queenly Majesty
if @move.rough_priority(@user) > 0 && @target.opposes?(@user)
each_same_side_battler(@target.side) do |b, i|
@@ -208,8 +218,6 @@ class Battle::AI
end
end
# Type immunity
calc_type = @move.rough_type
typeMod = @move.move.pbCalcTypeMod(calc_type, @user.battler, @target.battler)
return true if @move.move.pbDamagingMove? && Effectiveness.ineffective?(typeMod)
# Dark-type immunity to moves made faster by Prankster
return true if Settings::MECHANICS_GENERATION >= 7 && @move.statusMove? &&

View File

@@ -842,7 +842,8 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("DisableTargetHealingMove
#===============================================================================
Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("DisableTargetSoundMoves",
proc { |score, move, user, target, ai, battle|
next score if target.effects[PBEffects::ThroatChop] > 1
next score if target.effects[PBEffects::ThroatChop] >= 1
next score if target.effects[PBEffects::Substitute] > 0
next score if !target.check_for_move { |m| m.soundMove? }
# Check additional effect chance
add_effect = move.get_score_change_for_additional_effect(user, target)