Partially implement Shell Trap

Doesn't play the animation when the trap triggers, but kinda works? May also be incredibly buggy, but I'm not interested in working on this move any further.
This commit is contained in:
BuffelSaft 2021-11-22 14:14:41 +13:00
parent abb67e96e8
commit 70f0018c08
5 changed files with 46 additions and 14 deletions

View File

@ -1946,9 +1946,10 @@
various \battler, VARIOUS_CLEAR_SHELL_TRAP
.endm
.macro checkshelltrap battler:req, ptr:req
.macro checkshelltrap battler:req, ptr1:req, ptr2:req
various \battler, VARIOUS_CHECK_SHELL_TRAP
.4byte \ptr
.4byte \ptr1
.4byte \ptr2
.endm
@ helpful macros

View File

@ -413,7 +413,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP
BattleScript_EffectShellTrap::
checkshelltrap BS_ATTACKER, BattleScript_MoveEnd
checkshelltrap BS_ATTACKER, BattleScript_ShellTrapExplode, BattleScript_MoveEnd
clearshelltrap BS_ATTACKER
attackcanceler
attackstring

View File

@ -153,12 +153,13 @@ struct ProtectStruct
u32 usedCustapBerry:1; // also quick claw
u32 touchedProtectLike:1;
// End of 32-bit bitfield
u8 disableEjectPack:1;
u8 statFell:1;
u8 pranksterElevated:1;
u8 quickDraw:1;
u8 beakBlastCharge:1;
u8 shellTrap:1;
u16 disableEjectPack:1;
u16 statFell:1;
u16 pranksterElevated:1;
u16 quickDraw:1;
u16 beakBlastCharge:1;
u16 shellTrapSet:1;
u16 shellTrapTriggered:1;
u32 physicalDmg;
u32 specialDmg;
u8 physicalBattlerId;

View File

@ -1543,7 +1543,8 @@ static void Cmd_attackcanceler(void)
gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED;
gBattlescriptCurrInstr++;
}
else if (gProtectStructs[gBattlerTarget].beakBlastCharge && IsMoveMakingContact(gCurrentMove, gBattlerAttacker))
else if ((gProtectStructs[gBattlerTarget].beakBlastCharge || gProtectStructs[gBattlerTarget].shellTrapSet)
&& IsMoveMakingContact(gCurrentMove, gBattlerAttacker))
{
gProtectStructs[gBattlerAttacker].touchedProtectLike = TRUE;
gBattlescriptCurrInstr++;
@ -4983,7 +4984,7 @@ static void Cmd_moveend(void)
effect = 1;
}
// Not strictly a protect effect, but works the same way
else if (gProtectStructs[gBattlerTarget].beakBlastCharge
else if (gProtectStructs[gBattlerTarget].beakBlastCharge
&& CanBeBurned(gBattlerAttacker)
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
{
@ -4993,6 +4994,21 @@ static void Cmd_moveend(void)
gBattlescriptCurrInstr = BattleScript_BeakBlastBurn;
effect = 1;
}
else if (gProtectStructs[gBattlerTarget].shellTrapSet
&& !TestSheerForceFlag(gBattlerAttacker, gCurrentMove)
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
{
u32 temp;
gProtectStructs[gBattlerTarget].shellTrapTriggered = TRUE;
gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE;
// Swap battlers so target attacks attacker with Shell Trap
SWAP(gBattlerAttacker, gBattlerTarget, temp);
// Set current move to Shell Trap
gCurrentMove = MOVE_SHELL_TRAP;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_EffectShellTrap;
effect = TRUE;
}
}
gBattleScripting.moveendState++;
break;
@ -9387,10 +9403,24 @@ static void Cmd_various(void)
}
}
case VARIOUS_SET_BEAK_BLAST:
gProtectStructs[gBattlerAttacker].beakBlastCharge = 1;
gProtectStructs[gBattlerAttacker].beakBlastCharge = TRUE;
break;
case VARIOUS_SET_SHELL_TRAP:
gProtectStructs[gBattlerAttacker].shellTrap = 1;
gProtectStructs[gBattlerAttacker].shellTrapSet = TRUE;
break;
case VARIOUS_CLEAR_SHELL_TRAP:
gProtectStructs[gBattlerAttacker].shellTrapSet = FALSE;
break;
case VARIOUS_CHECK_SHELL_TRAP:
// Attack with Shell Trap
if (gProtectStructs[gBattlerAttacker].shellTrapSet == TRUE && gProtectStructs[gBattlerAttacker].shellTrapTriggered == TRUE)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
// Attacked with Shell Trap, go to move end
else if (gProtectStructs[gBattlerAttacker].shellTrapSet == FALSE && gProtectStructs[gBattlerAttacker].shellTrapTriggered == TRUE)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 7);
// Shell Trap failed
else
gBattlescriptCurrInstr += 11;
break;
case VARIOUS_SWAP_SIDE_STATUSES:
{

View File

@ -10218,7 +10218,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.accuracy = 100,
.pp = 5,
.secondaryEffectChance = 0,
.target = MOVE_TARGET_OPPONENTS_FIELD,
.target = MOVE_TARGET_BOTH,
.priority = -3,
.flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,
.split = SPLIT_SPECIAL,