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
various BS_ATTACKER, VARIOUS_REMOVE_TERRAIN
.endm
.macro jumpifobstruct ptr:req
various BS_ATTACKER, VARIOUS_JUMP_IF_OBSTRUCT
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req

View File

@ -374,8 +374,10 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectLashOut
.4byte BattleScript_EffectGrassyGlide
.4byte BattleScript_EffectRemoveTerrain
.4byte BattleScript_EffectBehemoth
.4byte BattleScript_EffectDynamaxDoubleDmg
.4byte BattleScript_EffectDecorate
.4byte BattleScript_EffectSnipeShot
.4byte BattleScript_EffectTripleHit
BattleScript_EffectDecorate:
attackcanceler
@ -470,22 +472,22 @@ BattleScript_EffectJungleHealing:
setbyte gBattleCommunication, 0
JungleHealing_RestoreTargetHealth:
copybyte gBattlerAttacker, gBattlerTarget
tryhealquarterhealth BS_TARGET, JungleHealing_TryCureStatus
tryhealquarterhealth BS_TARGET, BattleScript_JungleHealing_TryCureStatus
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
printstring STRINGID_PKMNREGAINEDHEALTH
waitmessage 0x40
JungleHealing_TryCureStatus:
jumpifmove MOVE_LIFE_DEW, JungleHealingTryRestoreAlly @ life dew only heals
BattleScript_JungleHealing_TryCureStatus:
jumpifmove MOVE_LIFE_DEW, BattleScript_JungleHealingTryRestoreAlly @ life dew only heals
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_JungleHealingCureStatus
goto JungleHealingTryRestoreAlly
goto BattleScript_JungleHealingTryRestoreAlly
BattleScript_JungleHealingCureStatus:
curestatus BS_TARGET
updatestatusicon BS_TARGET
printstring STRINGID_PKMNSTATUSNORMAL
waitmessage 0x40
JungleHealingTryRestoreAlly:
BattleScript_JungleHealingTryRestoreAlly:
jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_MoveEnd
addbyte gBattleCommunication, 1
jumpifnoally BS_TARGET, BattleScript_MoveEnd
@ -2183,7 +2185,8 @@ BattleScript_EffectBelch:
BattleScript_EffectBodyPress:
BattleScript_EffectLashOut:
BattleScript_EffectGrassyGlide:
BattleScript_EffectBehemoth:
BattleScript_EffectDynamaxDoubleDmg:
BattleScript_EffectSnipeShot:
BattleScript_HitFromAtkCanceler::
attackcanceler
@ -2255,6 +2258,17 @@ BattleScript_MoveMissed::
effectivenesssound
resultmessage
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
BattleScript_EffectSleep::
@ -2932,6 +2946,16 @@ BattleScript_EffectTrap::
setmoveeffect MOVE_EFFECT_WRAP
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::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
@ -8130,3 +8154,4 @@ BattleScript_JabocaRowapBerryActivate_Dmg:
call BattleScript_HurtAttacker
removeitem BS_TARGET
return

View File

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

View File

@ -358,10 +358,11 @@
#define EFFECT_LASH_OUT 352
#define EFFECT_GRASSY_GLIDE 353
#define EFFECT_REMOVE_TERRAIN 354
#define EFFECT_BEHEMOTH 355
#define EFFECT_DYNAMAX_DOUBLE_DMG 355
#define EFFECT_DECORATE 356
#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

View File

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

View File

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

View File

@ -1241,14 +1241,18 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
return FALSE;
else if (gBattleMoves[move].effect == MOVE_EFFECT_FEINT)
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;
}
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_WIDE_GUARD
&& gBattleMoves[move].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
return TRUE;
else if (gProtectStructs[battlerId].banefulBunkered)
return TRUE;
else if (gProtectStructs[battlerId].obstruct && !IS_MOVE_STATUS(move))
else if (gProtectStructs[battlerId].obstructed && !IS_MOVE_STATUS(move))
return TRUE;
else if (gProtectStructs[battlerId].spikyShielded)
return TRUE;
@ -1258,10 +1262,10 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
&& GetChosenMovePriority(gBattlerAttacker) > 0)
return TRUE;
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD
&& gBattleMoves[move].power == 0)
&& IS_MOVE_STATUS(move))
return TRUE;
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_MAT_BLOCK
&& gBattleMoves[move].power != 0)
&& !IS_MOVE_STATUS(move))
return TRUE;
else
return FALSE;
@ -1324,7 +1328,7 @@ static bool32 TryAegiFormChange(void)
static void Cmd_attackcanceler(void)
{
s32 i, moveType;
if (gBattleOutcome != 0)
{
gCurrentActionFuncId = B_ACTION_FINISHED;
@ -3203,7 +3207,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
|| gProtectStructs[gBattlerTarget].spikyShielded
|| gProtectStructs[gBattlerTarget].kingsShielded
|| gProtectStructs[gBattlerTarget].banefulBunkered
|| gProtectStructs[gBattlerTarget].obstruct)
|| gProtectStructs[gBattlerTarget].obstructed)
{
gProtectStructs[gBattlerTarget].protected = 0;
gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_WIDE_GUARD);
@ -3213,7 +3217,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
gProtectStructs[gBattlerTarget].spikyShielded = 0;
gProtectStructs[gBattlerTarget].kingsShielded = 0;
gProtectStructs[gBattlerTarget].banefulBunkered = 0;
gProtectStructs[gBattlerTarget].obstruct = 0;
gProtectStructs[gBattlerTarget].obstructed = 0;
if (gCurrentMove == MOVE_FEINT)
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -4814,7 +4818,7 @@ static void Cmd_moveend(void)
gBattlescriptCurrInstr = BattleScript_BanefulBunkerEffect;
effect = 1;
}
else if (gProtectStructs[gBattlerTarget].obstruct && gCurrentMove != MOVE_SUCKER_PUNCH)
else if (gProtectStructs[gBattlerTarget].obstructed && gCurrentMove != MOVE_SUCKER_PUNCH)
{
i = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget;
@ -7766,7 +7770,9 @@ static void Cmd_various(void)
}
return;
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);
else if (gBattleMoves[gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]].power == 0)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
@ -8538,6 +8544,20 @@ static void Cmd_various(void)
}
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain
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;
@ -8585,7 +8605,7 @@ static void Cmd_setprotectlike(void)
}
else if (gCurrentMove == MOVE_OBSTRUCT)
{
gProtectStructs[gBattlerAttacker].obstruct = 1;
gProtectStructs[gBattlerAttacker].obstructed = 1;
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
}

View File

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

View File

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