Skip to content

Commit

Permalink
add specific move checks for telekinesis/worry seed
Browse files Browse the repository at this point in the history
  • Loading branch information
BluRosie committed Jan 14, 2025
1 parent a092917 commit 2612e65
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/individual/BattleController_BeforeMove.c
Original file line number Diff line number Diff line change
Expand Up @@ -2165,8 +2165,8 @@ BOOL BattleController_CheckPsychicTerrain(struct BattleSystem *bsys UNUSED, stru
// Handle Psychic Terrain
// Block any natural priority move or a move made priority by an ability, if the terrain is Psychic Terrain
// Courtesy of Dray (https://github.com/Drayano60)
if (ctx->terrainOverlay.type == PSYCHIC_TERRAIN && ctx->terrainOverlay.numberOfTurnsLeft > 0 && MoldBreakerIsClientGrounded(ctx, ctx->attack_client, defender)) {
if (ctx->clientPriority[ctx->attack_client] && CurrentMoveShouldNotBeExemptedFromPriorityBlocking(ctx, ctx->attack_client, defender) && ((ctx->attack_client & 1) != (defender & 1))) {
if (ctx->terrainOverlay.type == PSYCHIC_TERRAIN && ctx->terrainOverlay.numberOfTurnsLeft > 0 && MoldBreakerIsClientGrounded(ctx, ctx->attack_client, defender)
&& ctx->clientPriority[ctx->attack_client] && CurrentMoveShouldNotBeExemptedFromPriorityBlocking(ctx, ctx->attack_client, defender) && ((ctx->attack_client & 1) != (defender & 1))) {
ctx->oneTurnFlag[ctx->attack_client].parental_bond_flag = 0;
ctx->oneTurnFlag[ctx->attack_client].parental_bond_is_active = FALSE;
ctx->battlerIdTemp = defender;
Expand All @@ -2175,18 +2175,19 @@ BOOL BattleController_CheckPsychicTerrain(struct BattleSystem *bsys UNUSED, stru
ctx->next_server_seq_no = ctx->server_seq_no;
ctx->server_seq_no = CONTROLLER_COMMAND_RUN_SCRIPT;
return TRUE;
}
}
return FALSE;
}

// TODO: Handle Smack Down, Ingrain
BOOL BattleController_CheckTelekinesis(struct BattleSystem *bsys UNUSED, struct BattleStruct *ctx, int defender) {
// TODO: this to my knowledge handle base species, and does not consider transformed species, which is correct. Requires verifying
// TODO: actually implement telekinesis as well
int defenderSpecies = ctx->battlemon[defender].species;
int defenderForm = ctx->battlemon[defender].form_no;
if (((defenderSpecies == SPECIES_GENGAR && defenderForm == 1) || defenderSpecies == SPECIES_DIGLETT || defenderSpecies == SPECIES_DUGTRIO || defenderSpecies == SPECIES_SANDYGAST || defenderSpecies == SPECIES_PALOSSAND)
|| ctx->battlemon[defender].effect_of_moves & MOVE_EFFECT_FLAG_INGRAIN) {
if (ctx->current_move_index == MOVE_TELEKINESIS
&& (((defenderSpecies == SPECIES_GENGAR && defenderForm == 1) || defenderSpecies == SPECIES_DIGLETT || defenderSpecies == SPECIES_DUGTRIO || defenderSpecies == SPECIES_SANDYGAST || defenderSpecies == SPECIES_PALOSSAND)
|| ctx->battlemon[defender].effect_of_moves & MOVE_EFFECT_FLAG_INGRAIN)) {
ctx->oneTurnFlag[ctx->attack_client].parental_bond_flag = 0;
ctx->oneTurnFlag[ctx->attack_client].parental_bond_is_active = FALSE;
ctx->moveStatusFlagForSpreadMoves[defender] = MOVE_STATUS_FLAG_FAILED;
Expand Down Expand Up @@ -3628,7 +3629,7 @@ BOOL BattleController_CheckMoveFailures3(struct BattleSystem *bsys UNUSED, struc
// Yawn into target with status condition / already has Yawn
|| (moveEffect == MOVE_EFFECT_STATUS_SLEEP_NEXT_TURN && (ctx->battlemon[defender].effect_of_moves & MOVE_EFFECT_YAWN_COUNTER || ctx->battlemon[defender].condition))
// Worry Seed when target has Insomnia / Truant
|| (GetBattlerAbility(ctx, ctx->defence_client) == ABILITY_INSOMNIA || GetBattlerAbility(ctx, ctx->defence_client) == ABILITY_TRUANT)
|| (moveEffect == MOVE_EFFECT_SET_ABILITY_TO_INSOMNIA && (GetBattlerAbility(ctx, ctx->defence_client) == ABILITY_INSOMNIA || GetBattlerAbility(ctx, ctx->defence_client) == ABILITY_TRUANT))
// TODO: Coaching in singles or when there is no ally target available in doubles
) {
ctx->oneTurnFlag[ctx->attack_client].parental_bond_flag = 0;
Expand Down

0 comments on commit 2612e65

Please sign in to comment.