diff --git a/src/individual/BattleController_BeforeMove.c b/src/individual/BattleController_BeforeMove.c index 9840ec11d..36d47476c 100644 --- a/src/individual/BattleController_BeforeMove.c +++ b/src/individual/BattleController_BeforeMove.c @@ -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; @@ -2175,7 +2175,6 @@ 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; } @@ -2183,10 +2182,12 @@ BOOL BattleController_CheckPsychicTerrain(struct BattleSystem *bsys UNUSED, stru // 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; @@ -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;