Review changes

Also updated tryfaintmon call in BattleScript_FlingEnd, and updated CanFling.
This commit is contained in:
LOuroboros 2022-01-23 02:50:39 -03:00
parent a8a8c7e2fa
commit 8eaf0718ec
5 changed files with 9 additions and 30 deletions

View File

@ -1932,8 +1932,8 @@
various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK
.endm
.macro jumpifflingfails battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_FLING_FAILS
.macro jumpifcantfling battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_CANT_FLING
.4byte \ptr
.endm

View File

@ -464,12 +464,9 @@ BattleScript_SkyDropFlyingAlreadyConfused:
goto BattleScript_ThrashConfuses
BattleScript_EffectFling:
jumpifflingfails BS_ATTACKER, BattleScript_ButItFailedAtkStringPpReduce
jumpifcantfling BS_ATTACKER, BattleScript_ButItFailedAtkStringPpReduce
jumpifstatus3 BS_ATTACKER, STATUS3_EMBARGO, BattleScript_ButItFailedAtkStringPpReduce
jumpifword CMP_COMMON_BITS, gFieldStatuses, STATUS_FIELD_MAGIC_ROOM, BattleScript_ButItFailedAtkStringPpReduce
.if B_KLUTZ_FLING_INTERACTION >= GEN_5
jumpifability BS_ATTACKER, ABILITY_KLUTZ, BattleScript_ButItFailedAtkStringPpReduce
.endif
setlastuseditem BS_ATTACKER
removeitem BS_ATTACKER
attackcanceler
@ -511,7 +508,7 @@ BattleScript_EffectFlingConsumeBerry:
setbyte sBERRY_OVERRIDE, FALSE
restorebattleritem BS_TARGET
BattleScript_FlingEnd:
tryfaintmon BS_TARGET, FALSE, NULL
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd
BattleScript_FlingFlameOrb:

View File

@ -229,7 +229,7 @@
#define VARIOUS_SET_SKY_DROP 139
#define VARIOUS_CLEAR_SKY_DROP 140
#define VARIOUS_SKY_DROP_YAWN 141
#define VARIOUS_JUMP_IF_FLING_FAILS 142
#define VARIOUS_JUMP_IF_CANT_FLING 142
#define VARIOUS_JUMP_IF_HOLD_EFFECT 143
#define VARIOUS_CURE_CERTAIN_STATUSES 144
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 145

View File

@ -1356,19 +1356,6 @@ static void Cmd_attackcanceler(void)
GET_MOVE_TYPE(gCurrentMove, moveType);
// Unnerve prevents a Pokémon holding a Berry from using Fling.
if (gCurrentMove == MOVE_FLING
&& GetBattlerAbility(gBattlerAttacker) == ABILITY_UNNERVE
&& ItemId_GetPocket(gLastUsedItem) == POCKET_BERRIES)
{
// Fling removes the item just before attackcanceler kicks in.
// This is done to work around an opponent using Protect/Detect.
gBattleMons[gBattlerAttacker].item = gLastUsedItem;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ButItFailedAtkStringPpReduce;
return;
}
if (moveType == TYPE_FIRE
&& (gBattleWeather & B_WEATHER_RAIN_PRIMAL)
&& WEATHER_HAS_EFFECT
@ -9467,14 +9454,8 @@ static void Cmd_various(void)
gBattlescriptCurrInstr += 7;
return;
}
case VARIOUS_JUMP_IF_FLING_FAILS:
#ifdef ITEM_EXPANSION
if (!ItemId_GetFlingPower(gBattleMons[gActiveBattler].item))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else if (gLastUsedItem == ITEM_NONE)
#else
if (gLastUsedItem == ITEM_NONE)
#endif
case VARIOUS_JUMP_IF_CANT_FLING:
if (!CanFling(gActiveBattler))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else
gBattlescriptCurrInstr += 7;

View File

@ -9620,7 +9620,9 @@ bool32 CanFling(u8 battlerId)
u16 itemEffect = ItemId_GetHoldEffect(item);
if (item == ITEM_NONE
#if B_KLUTZ_FLING_INTERACTION >= GEN_5
|| GetBattlerAbility(battlerId) == ABILITY_KLUTZ
#endif
|| gFieldStatuses & STATUS_FIELD_MAGIC_ROOM
|| gDisableStructs[battlerId].embargoTimer != 0
|| !CanBattlerGetOrLoseItem(battlerId, item)
@ -9629,7 +9631,6 @@ bool32 CanFling(u8 battlerId)
#ifdef ITEM_ABILITY_CAPSULE
|| item == ITEM_ABILITY_CAPSULE
#endif
|| (ItemId_GetPocket(item) == POCKET_BERRIES && IsAbilityOnSide(battlerId, ABILITY_UNNERVE))
|| GetPocketByItemId(item) == POCKET_POKE_BALLS)
return FALSE;