fix sucker punch, surging strikes, obstruct, and snipe shot

This commit is contained in:
ghoulslash 2021-07-25 09:38:54 -06:00
parent a37d4c3da9
commit c914ed8572
9 changed files with 80 additions and 28 deletions

View File

@ -1787,6 +1787,11 @@
.macro removeterrain .macro removeterrain
various BS_ATTACKER, VARIOUS_REMOVE_TERRAIN various BS_ATTACKER, VARIOUS_REMOVE_TERRAIN
.endm .endm
.macro jumpifobstruct ptr:req
various BS_ATTACKER, VARIOUS_JUMP_IF_OBSTRUCT
.4byte \ptr
.endm
@ helpful macros @ helpful macros
.macro setstatchanger stat:req, stages:req, down:req .macro setstatchanger stat:req, stages:req, down:req

View File

@ -374,8 +374,10 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectLashOut .4byte BattleScript_EffectLashOut
.4byte BattleScript_EffectGrassyGlide .4byte BattleScript_EffectGrassyGlide
.4byte BattleScript_EffectRemoveTerrain .4byte BattleScript_EffectRemoveTerrain
.4byte BattleScript_EffectBehemoth .4byte BattleScript_EffectDynamaxDoubleDmg
.4byte BattleScript_EffectDecorate .4byte BattleScript_EffectDecorate
.4byte BattleScript_EffectSnipeShot
.4byte BattleScript_EffectTripleHit
BattleScript_EffectDecorate: BattleScript_EffectDecorate:
attackcanceler attackcanceler
@ -470,22 +472,22 @@ BattleScript_EffectJungleHealing:
setbyte gBattleCommunication, 0 setbyte gBattleCommunication, 0
JungleHealing_RestoreTargetHealth: JungleHealing_RestoreTargetHealth:
copybyte gBattlerAttacker, gBattlerTarget copybyte gBattlerAttacker, gBattlerTarget
tryhealquarterhealth BS_TARGET, JungleHealing_TryCureStatus tryhealquarterhealth BS_TARGET, BattleScript_JungleHealing_TryCureStatus
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_TARGET healthbarupdate BS_TARGET
datahpupdate BS_TARGET datahpupdate BS_TARGET
printstring STRINGID_PKMNREGAINEDHEALTH printstring STRINGID_PKMNREGAINEDHEALTH
waitmessage 0x40 waitmessage 0x40
JungleHealing_TryCureStatus: BattleScript_JungleHealing_TryCureStatus:
jumpifmove MOVE_LIFE_DEW, JungleHealingTryRestoreAlly @ life dew only heals jumpifmove MOVE_LIFE_DEW, BattleScript_JungleHealingTryRestoreAlly @ life dew only heals
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_JungleHealingCureStatus jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_JungleHealingCureStatus
goto JungleHealingTryRestoreAlly goto BattleScript_JungleHealingTryRestoreAlly
BattleScript_JungleHealingCureStatus: BattleScript_JungleHealingCureStatus:
curestatus BS_TARGET curestatus BS_TARGET
updatestatusicon BS_TARGET updatestatusicon BS_TARGET
printstring STRINGID_PKMNSTATUSNORMAL printstring STRINGID_PKMNSTATUSNORMAL
waitmessage 0x40 waitmessage 0x40
JungleHealingTryRestoreAlly: BattleScript_JungleHealingTryRestoreAlly:
jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_MoveEnd jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_MoveEnd
addbyte gBattleCommunication, 1 addbyte gBattleCommunication, 1
jumpifnoally BS_TARGET, BattleScript_MoveEnd jumpifnoally BS_TARGET, BattleScript_MoveEnd
@ -2183,7 +2185,8 @@ BattleScript_EffectBelch:
BattleScript_EffectBodyPress: BattleScript_EffectBodyPress:
BattleScript_EffectLashOut: BattleScript_EffectLashOut:
BattleScript_EffectGrassyGlide: BattleScript_EffectGrassyGlide:
BattleScript_EffectBehemoth: BattleScript_EffectDynamaxDoubleDmg:
BattleScript_EffectSnipeShot:
BattleScript_HitFromAtkCanceler:: BattleScript_HitFromAtkCanceler::
attackcanceler attackcanceler
@ -2255,6 +2258,17 @@ BattleScript_MoveMissed::
effectivenesssound effectivenesssound
resultmessage resultmessage
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
jumpifobstruct BattleScript_ObstructActivates
goto BattleScript_MoveEnd
BattleScript_ObstructActivates:
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, MIN_STAT_STAGE, BattleScript_ObstructActivationEnd
setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_ObstructActivationEnd
printfromtable gStatDownStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_ObstructActivationEnd:
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_EffectSleep:: BattleScript_EffectSleep::
@ -2932,6 +2946,16 @@ BattleScript_EffectTrap::
setmoveeffect MOVE_EFFECT_WRAP setmoveeffect MOVE_EFFECT_WRAP
goto BattleScript_EffectHit goto BattleScript_EffectHit
BattleScript_EffectTripleHit::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
setmultihitcounter 3
initmultihitstring
sethword sMULTIHIT_EFFECT, 0
goto BattleScript_MultiHitLoop
BattleScript_EffectDoubleHit:: BattleScript_EffectDoubleHit::
attackcanceler attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
@ -8130,3 +8154,4 @@ BattleScript_JabocaRowapBerryActivate_Dmg:
call BattleScript_HurtAttacker call BattleScript_HurtAttacker
removeitem BS_TARGET removeitem BS_TARGET
return return

View File

@ -119,7 +119,7 @@ struct ProtectStruct
u32 spikyShielded:1; u32 spikyShielded:1;
u32 kingsShielded:1; u32 kingsShielded:1;
u32 banefulBunkered:1; u32 banefulBunkered:1;
u32 obstruct:1; u32 obstructed:1;
u32 endured:1; u32 endured:1;
u32 noValidMoves:1; u32 noValidMoves:1;
u32 helpingHand:1; u32 helpingHand:1;

View File

@ -358,10 +358,11 @@
#define EFFECT_LASH_OUT 352 #define EFFECT_LASH_OUT 352
#define EFFECT_GRASSY_GLIDE 353 #define EFFECT_GRASSY_GLIDE 353
#define EFFECT_REMOVE_TERRAIN 354 #define EFFECT_REMOVE_TERRAIN 354
#define EFFECT_BEHEMOTH 355 #define EFFECT_DYNAMAX_DOUBLE_DMG 355
#define EFFECT_DECORATE 356 #define EFFECT_DECORATE 356
#define EFFECT_SNIPE_SHOT 357 #define EFFECT_SNIPE_SHOT 357
#define EFFECT_TRIPLE_HIT 358
#define NUM_BATTLE_MOVE_EFFECTS 358 #define NUM_BATTLE_MOVE_EFFECTS 359
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -177,6 +177,7 @@
#define VARIOUS_JUMP_IF_TEAM_HEALTHY 106 #define VARIOUS_JUMP_IF_TEAM_HEALTHY 106
#define VARIOUS_TRY_HEAL_QUARTER_HP 107 #define VARIOUS_TRY_HEAL_QUARTER_HP 107
#define VARIOUS_REMOVE_TERRAIN 108 #define VARIOUS_REMOVE_TERRAIN 108
#define VARIOUS_JUMP_IF_OBSTRUCT 109
// Cmd_manipulatedamage // Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0 #define DMG_CHANGE_SIGN 0

View File

@ -3064,7 +3064,7 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].spikyShielded = 0; gProtectStructs[gActiveBattler].spikyShielded = 0;
gProtectStructs[gActiveBattler].kingsShielded = 0; gProtectStructs[gActiveBattler].kingsShielded = 0;
gProtectStructs[gActiveBattler].banefulBunkered = 0; gProtectStructs[gActiveBattler].banefulBunkered = 0;
gProtectStructs[gActiveBattler].obstruct = 0; gProtectStructs[gActiveBattler].obstructed = 0;
gProtectStructs[gActiveBattler].endured = 0; gProtectStructs[gActiveBattler].endured = 0;
gProtectStructs[gActiveBattler].noValidMoves = 0; gProtectStructs[gActiveBattler].noValidMoves = 0;
gProtectStructs[gActiveBattler].helpingHand = 0; gProtectStructs[gActiveBattler].helpingHand = 0;

View File

@ -1241,14 +1241,18 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
return FALSE; return FALSE;
else if (gBattleMoves[move].effect == MOVE_EFFECT_FEINT) else if (gBattleMoves[move].effect == MOVE_EFFECT_FEINT)
return FALSE; return FALSE;
else if (gProtectStructs[battlerId].protected && move != MOVE_DECORATE) else if (gProtectStructs[battlerId].protected)
{
if (move == MOVE_DECORATE && !(gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD))
return FALSE; // decorate bypasses protect and detect, but not crafty shield
return TRUE; return TRUE;
}
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_WIDE_GUARD else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_WIDE_GUARD
&& gBattleMoves[move].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)) && gBattleMoves[move].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
return TRUE; return TRUE;
else if (gProtectStructs[battlerId].banefulBunkered) else if (gProtectStructs[battlerId].banefulBunkered)
return TRUE; return TRUE;
else if (gProtectStructs[battlerId].obstruct && !IS_MOVE_STATUS(move)) else if (gProtectStructs[battlerId].obstructed && !IS_MOVE_STATUS(move))
return TRUE; return TRUE;
else if (gProtectStructs[battlerId].spikyShielded) else if (gProtectStructs[battlerId].spikyShielded)
return TRUE; return TRUE;
@ -1258,10 +1262,10 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
&& GetChosenMovePriority(gBattlerAttacker) > 0) && GetChosenMovePriority(gBattlerAttacker) > 0)
return TRUE; return TRUE;
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD
&& gBattleMoves[move].power == 0) && IS_MOVE_STATUS(move))
return TRUE; return TRUE;
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_MAT_BLOCK else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_MAT_BLOCK
&& gBattleMoves[move].power != 0) && !IS_MOVE_STATUS(move))
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
@ -1324,7 +1328,7 @@ static bool32 TryAegiFormChange(void)
static void Cmd_attackcanceler(void) static void Cmd_attackcanceler(void)
{ {
s32 i, moveType; s32 i, moveType;
if (gBattleOutcome != 0) if (gBattleOutcome != 0)
{ {
gCurrentActionFuncId = B_ACTION_FINISHED; gCurrentActionFuncId = B_ACTION_FINISHED;
@ -3203,7 +3207,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
|| gProtectStructs[gBattlerTarget].spikyShielded || gProtectStructs[gBattlerTarget].spikyShielded
|| gProtectStructs[gBattlerTarget].kingsShielded || gProtectStructs[gBattlerTarget].kingsShielded
|| gProtectStructs[gBattlerTarget].banefulBunkered || gProtectStructs[gBattlerTarget].banefulBunkered
|| gProtectStructs[gBattlerTarget].obstruct) || gProtectStructs[gBattlerTarget].obstructed)
{ {
gProtectStructs[gBattlerTarget].protected = 0; gProtectStructs[gBattlerTarget].protected = 0;
gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_WIDE_GUARD); gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_WIDE_GUARD);
@ -3213,7 +3217,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
gProtectStructs[gBattlerTarget].spikyShielded = 0; gProtectStructs[gBattlerTarget].spikyShielded = 0;
gProtectStructs[gBattlerTarget].kingsShielded = 0; gProtectStructs[gBattlerTarget].kingsShielded = 0;
gProtectStructs[gBattlerTarget].banefulBunkered = 0; gProtectStructs[gBattlerTarget].banefulBunkered = 0;
gProtectStructs[gBattlerTarget].obstruct = 0; gProtectStructs[gBattlerTarget].obstructed = 0;
if (gCurrentMove == MOVE_FEINT) if (gCurrentMove == MOVE_FEINT)
{ {
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -4814,7 +4818,7 @@ static void Cmd_moveend(void)
gBattlescriptCurrInstr = BattleScript_BanefulBunkerEffect; gBattlescriptCurrInstr = BattleScript_BanefulBunkerEffect;
effect = 1; effect = 1;
} }
else if (gProtectStructs[gBattlerTarget].obstruct && gCurrentMove != MOVE_SUCKER_PUNCH) else if (gProtectStructs[gBattlerTarget].obstructed && gCurrentMove != MOVE_SUCKER_PUNCH)
{ {
i = gBattlerAttacker; i = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget; gBattlerAttacker = gBattlerTarget;
@ -7766,7 +7770,9 @@ static void Cmd_various(void)
} }
return; return;
case VARIOUS_SUCKER_PUNCH_CHECK: case VARIOUS_SUCKER_PUNCH_CHECK:
if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) if (gProtectStructs[gBattlerTarget].obstructed)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else if (gBattleMoves[gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]].power == 0) else if (gBattleMoves[gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]].power == 0)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
@ -8538,6 +8544,20 @@ static void Cmd_various(void)
} }
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain
break; break;
case VARIOUS_JUMP_IF_OBSTRUCT:
// if obstruct blocked a contact move, sharply lower defense
if (IsMoveMakingContact(gCurrentMove, gBattlerAttacker) && gProtectStructs[gBattlerTarget].obstructed && !IS_MOVE_STATUS(gCurrentMove))
{
SET_STATCHANGER(STAT_DEF, 2, TRUE);
gBattleScripting.battler = gBattlerAttacker;
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
}
else
{
gBattlescriptCurrInstr += 7;
}
return;
} }
gBattlescriptCurrInstr += 3; gBattlescriptCurrInstr += 3;
@ -8585,7 +8605,7 @@ static void Cmd_setprotectlike(void)
} }
else if (gCurrentMove == MOVE_OBSTRUCT) else if (gCurrentMove == MOVE_OBSTRUCT)
{ {
gProtectStructs[gBattlerAttacker].obstruct = 1; gProtectStructs[gBattlerAttacker].obstructed = 1;
gBattleCommunication[MULTISTRING_CHOOSER] = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 0;
} }

View File

@ -7199,11 +7199,11 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
break; break;
case EFFECT_EXPLOSION: case EFFECT_EXPLOSION:
if (move == MOVE_MISTY_EXPLOSION && gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && IsBattlerGrounded(battlerAtk)) if (move == MOVE_MISTY_EXPLOSION && gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && IsBattlerGrounded(battlerAtk))
basePower = 150; MulModifier(&basePower, UQ_4_12(1.5));
break; break;
case EFFECT_BEHEMOTH: case EFFECT_DYNAMAX_DOUBLE_DMG:
#ifdef B_DYNAMAX #ifdef B_DYNAMAX
if (IsDynamaxed(battlerDef))/ if (IsDynamaxed(battlerDef))
basePower *= 2; basePower *= 2;
#endif #endif
break; break;

View File

@ -10996,7 +10996,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_BEHEMOTH_BLADE] = [MOVE_BEHEMOTH_BLADE] =
{ {
.effect = EFFECT_BEHEMOTH, .effect = EFFECT_DYNAMAX_DOUBLE_DMG,
.power = 100, .power = 100,
.type = TYPE_STEEL, .type = TYPE_STEEL,
.accuracy = 100, .accuracy = 100,
@ -11010,7 +11010,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_BEHEMOTH_BASH] = [MOVE_BEHEMOTH_BASH] =
{ {
.effect = EFFECT_BEHEMOTH, .effect = EFFECT_DYNAMAX_DOUBLE_DMG,
.power = 100, .power = 100,
.type = TYPE_STEEL, .type = TYPE_STEEL,
.accuracy = 100, .accuracy = 100,
@ -11158,7 +11158,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.secondaryEffectChance = 0, .secondaryEffectChance = 0,
.target = MOVE_TARGET_USER, .target = MOVE_TARGET_USER,
.priority = 4, .priority = 4,
.flags = 0, .flags = FLAG_PROTECTION_MOVE,
.split = SPLIT_STATUS, .split = SPLIT_STATUS,
}, },
@ -11513,7 +11513,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_SURGING_STRIKES] = [MOVE_SURGING_STRIKES] =
{ {
.effect = EFFECT_TRIPLE_KICK, .effect = EFFECT_TRIPLE_HIT,
.power = 25, .power = 25,
.type = TYPE_WATER, .type = TYPE_WATER,
.accuracy = 100, .accuracy = 100,