From e637714e1b51e359399eb6de260e28cd67fb5ab8 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 10 Nov 2021 21:11:15 +1300 Subject: [PATCH] Requested changes Various bug fixes, syntax corrections etc. --- data/battle_scripts_1.s | 6 +++--- src/battle_script_commands.c | 21 ++++++++++----------- src/battle_util.c | 4 ++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 14d875543..4925b0c99 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -445,7 +445,7 @@ BattleScript_EffectClangorousSoul: attackstring ppreduce cutonethirdhpraisestats BattleScript_ButItFailed - orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_SKIP_DMG_TRACK | HITMARKER_PASSIVE_DAMAGE | HITMARKER_IGNORE_DISGUISE attackanimation waitanimation healthbarupdate BS_ATTACKER @@ -471,8 +471,8 @@ BattleScript_OctolockEndTurn:: jumpifstat BS_TARGET, CMP_GREATER_THAN, STAT_SPDEF, MIN_STAT_STAGE, BattleScript_OctolockTryLowerSpDef goto BattleScript_OctolockEnd2 BattleScript_OctolockLowerDef: - playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, STAT_CHANGE_NEGATIVE jumpifability BS_TARGET, ABILITY_BIG_PECKS, BattleScript_OctolockTryLowerSpDef + playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, STAT_CHANGE_NEGATIVE | MOVE_EFFECT_AFFECTS_USER setstatchanger STAT_DEF, 1, TRUE statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_OctolockTryLowerSpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_OctolockTryLowerSpDef @@ -480,7 +480,7 @@ BattleScript_OctolockLowerDef: waitmessage B_WAIT_TIME_LONG BattleScript_OctolockTryLowerSpDef: jumpifstat BS_TARGET, CMP_GREATER_THAN, STAT_DEF, MIN_STAT_STAGE, BattleScript_OctolockSkipSpDefAnim - playstatchangeanimation BS_ATTACKER, BIT_SPDEF, STAT_CHANGE_NEGATIVE + playstatchangeanimation BS_ATTACKER, BIT_SPDEF, STAT_CHANGE_NEGATIVE | MOVE_EFFECT_AFFECTS_USER BattleScript_OctolockSkipSpDefAnim: setstatchanger STAT_SPDEF, 1, TRUE statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_OctolockEnd2 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6cd44e10a..835f04a29 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9201,13 +9201,11 @@ static void Cmd_various(void) case VARIOUS_CUT_1_3_HP_RAISE_STATS: { bool8 atLeastOneStatBoosted = FALSE; - bool8 hasContrary = (GetBattlerAbility(gBattlerAttacker) == ABILITY_CONTRARY); u16 hpFraction = max(1, gBattleMons[gBattlerAttacker].maxHP / 3); for (i = 1; i < NUM_STATS; i++) { - if (!(gBattleMons[gBattlerAttacker].statStages[i] == MAX_STAT_STAGE - || (hasContrary && gBattleMons[gBattlerAttacker].statStages[i] == MIN_STAT_STAGE))) + if (CompareStat(gBattlerAttacker, i, MAX_STAT_STAGE, CMP_LESS_THAN)) { atLeastOneStatBoosted = TRUE; break; @@ -9231,7 +9229,7 @@ static void Cmd_various(void) } else { - gDisableStructs[gActiveBattler].octolock = 1; + gDisableStructs[gActiveBattler].octolock = TRUE; gBattleMons[gActiveBattler].status2 |= STATUS2_ESCAPE_PREVENTION; gDisableStructs[gActiveBattler].battlerPreventingEscape = gBattlerAttacker; gBattlescriptCurrInstr += 7; @@ -9252,11 +9250,13 @@ static void Cmd_various(void) return; case VARIOUS_TRY_NO_RETREAT: if (gDisableStructs[gActiveBattler].noRetreat) + { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); + } else { if (!(gBattleMons[gActiveBattler].status2 & STATUS2_ESCAPE_PREVENTION)) - gDisableStructs[gActiveBattler].noRetreat = 1; + gDisableStructs[gActiveBattler].noRetreat = TRUE; gBattlescriptCurrInstr += 7; } return; @@ -9267,18 +9267,17 @@ static void Cmd_various(void) } else { - gDisableStructs[gActiveBattler].tarShot = 1; + gDisableStructs[gActiveBattler].tarShot = TRUE; gBattlescriptCurrInstr += 7; } return; case VARIOUS_CAN_TAR_SHOT_WORK: // Tar Shot will fail if it's already been used on the target and its speed can't be lowered further - if (gDisableStructs[gActiveBattler].tarShot - && (gBattleMons[gActiveBattler].statStages[STAT_SPEED] == MIN_STAT_STAGE - || (gBattleMons[gActiveBattler].statStages[STAT_SPEED] == MAX_STAT_STAGE && GetBattlerAbility(gActiveBattler) == ABILITY_CONTRARY))) - gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); - else + if (!gDisableStructs[gActiveBattler].tarShot + && CompareStat(gActiveBattler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN)) gBattlescriptCurrInstr += 7; + else + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); return; case VARIOUS_TRY_TO_APPLY_MIMICRY: { diff --git a/src/battle_util.c b/src/battle_util.c index 8f376a050..e5851f7b8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8774,6 +8774,8 @@ static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 batt mod = UQ_4_12(2.0); if (moveType == TYPE_GROUND && defType == TYPE_FLYING && IsBattlerGrounded(battlerDef) && mod == UQ_4_12(0.0)) mod = UQ_4_12(1.0); + if (moveType == TYPE_FIRE && gDisableStructs[battlerDef].tarShot) + mod = UQ_4_12(2.0); if (gProtectStructs[battlerDef].kingsShielded && gBattleMoves[move].effect != EFFECT_FEINT) mod = UQ_4_12(1.0); @@ -8867,8 +8869,6 @@ u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 bat modifier = CalcTypeEffectivenessMultiplierInternal(move, moveType, battlerAtk, battlerDef, recordAbilities, modifier); if (gBattleMoves[move].effect == EFFECT_TWO_TYPED_MOVE) modifier = CalcTypeEffectivenessMultiplierInternal(move, gBattleMoves[move].argument, battlerAtk, battlerDef, recordAbilities, modifier); - else if (moveType == TYPE_FIRE && gDisableStructs[battlerDef].tarShot) - modifier = CalcTypeEffectivenessMultiplierInternal(move, moveType, battlerAtk, battlerDef, recordAbilities, UQ_4_12(2.0)); } if (recordAbilities)