AI assumes Magnitude / Present damage (#7334)

This commit is contained in:
Pawkkie 2025-07-13 16:31:19 -04:00 committed by GitHub
parent 688ec0023e
commit 5c2980b906
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -783,6 +783,10 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u
SetDynamicMoveCategory(battlerAtk, battlerDef, move);
SetTypeBeforeUsingMove(move, battlerAtk);
// We can set those globals because they are going to get rerolled on attack execution
gBattleStruct->magnitudeBasePower = 70;
gBattleStruct->presentBasePower = 80;
struct DamageContext ctx;
ctx.battlerAtk = battlerAtk;
ctx.battlerDef = battlerDef;

View File

@ -897,3 +897,18 @@ AI_SINGLE_BATTLE_TEST("Move scoring comparison properly awards bonus point to be
TURN { EXPECT_MOVE(opponent, MOVE_WATER_SPOUT); }
}
}
AI_SINGLE_BATTLE_TEST("AI will see Magnitude damage")
{
PASSES_RANDOMLY(SHOULD_SWITCH_HASBADODDS_PERCENTAGE, 100, RNG_AI_SWITCH_HASBADODDS);
GIVEN {
ASSUME(GetMoveEffect(MOVE_MAGNITUDE) == EFFECT_MAGNITUDE);
ASSUME(GetMoveType(MOVE_MAGNITUDE) == TYPE_GROUND);
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY | AI_FLAG_SMART_SWITCHING | AI_FLAG_SMART_MON_CHOICES | AI_FLAG_OMNISCIENT);
PLAYER(SPECIES_GEODUDE) { Level(15); Moves(MOVE_DEFENSE_CURL, MOVE_MAGNITUDE); }
OPPONENT(SPECIES_TYRUNT) { Level(13); Moves(MOVE_BITE, MOVE_THUNDER_FANG, MOVE_ROCK_TOMB); }
OPPONENT(SPECIES_ZUBAT) { Level(14); Moves(MOVE_TACKLE); }
} WHEN {
TURN { MOVE(player, MOVE_MAGNITUDE); EXPECT_SWITCH(opponent, 1); }
}
}