fix lash out, obstruct, and decorate

This commit is contained in:
ghoulslash 2021-09-22 09:43:40 -04:00
parent 0ea6c65b83
commit 13062b5a8f
7 changed files with 26 additions and 50 deletions

View File

@ -1816,11 +1816,6 @@
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
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

@ -382,6 +382,7 @@ gBattleScriptsForMoveEffects::
BattleScript_EffectDecorate:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_ATK, 12, BattleScript_DecorateBoost
@ -396,13 +397,13 @@ BattleScript_DecorateBoost:
statbuffchange STAT_BUFF_ALLOW_PTR | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_DecorateBoostSpAtk
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DecorateBoostSpAtk
printfromtable gStatUpStringIds
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
BattleScript_DecorateBoostSpAtk:
setstatchanger STAT_SPATK, 2, FALSE
statbuffchange STAT_BUFF_ALLOW_PTR | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_MoveEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_MoveEnd
printfromtable gStatUpStringIds
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectRemoveTerrain:
@ -421,13 +422,13 @@ BattleScript_EffectRemoveTerrain:
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
removeterrain
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 4, BattleScript_MoveEnd
printfromtable gTerrainEndingStringIds
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG, NULL
tryfaintmon BS_TARGET, FALSE, NULL
goto BattleScript_MoveEnd
@ -441,8 +442,8 @@ BattleScript_EffectCoaching:
setallytonexttarget EffectCoaching_CheckAllyStats
goto BattleScript_ButItFailed
EffectCoaching_CheckAllyStats:
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_ATK, 12, BattleScript_CoachingWorks
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_DEF, 12, BattleScript_CoachingWorks
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_ATK, MAX_STAT_STAGE, BattleScript_CoachingWorks
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_DEF, MAX_STAT_STAGE, BattleScript_CoachingWorks
goto BattleScript_ButItFailed @ ally at max atk, def
BattleScript_CoachingWorks:
attackanimation
@ -453,13 +454,13 @@ BattleScript_CoachingWorks:
statbuffchange STAT_BUFF_ALLOW_PTR | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_CoachingBoostDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CoachingBoostDef
printfromtable gStatUpStringIds
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
BattleScript_CoachingBoostDef:
setstatchanger STAT_DEF, 1, FALSE
statbuffchange STAT_BUFF_ALLOW_PTR | STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_MoveEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_MoveEnd
printfromtable gStatUpStringIds
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectJungleHealing:
@ -478,7 +479,7 @@ JungleHealing_RestoreTargetHealth:
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
printstring STRINGID_PKMNREGAINEDHEALTH
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
BattleScript_JungleHealing_TryCureStatus:
jumpifmove MOVE_LIFE_DEW, BattleScript_JungleHealingTryRestoreAlly @ life dew only heals
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_JungleHealingCureStatus
@ -487,7 +488,7 @@ BattleScript_JungleHealingCureStatus:
curestatus BS_TARGET
updatestatusicon BS_TARGET
printstring STRINGID_PKMNSTATUSNORMAL
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
BattleScript_JungleHealingTryRestoreAlly:
jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x0, BattleScript_MoveEnd
addbyte gBattleCommunication, 1
@ -2233,17 +2234,6 @@ 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::
@ -3624,12 +3614,13 @@ BattleScript_EffectEerieSpell::
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage 0x40
waitmessage B_WAIT_TIME_LONG
tryfaintmon BS_TARGET, FALSE, NULL
eeriespellppreduce BattleScript_MoveEnd
printstring STRINGID_PKMNREDUCEDPP
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectSpite::

View File

@ -143,7 +143,6 @@ struct ProtectStruct
u32 usedGravityPreventedMove:1;
u32 powderSelfDmg:1;
u32 usedThroatChopPreventedMove:1;
u32 statFell:1;
u32 statRaised:1;
u32 micle:1;
u32 custap:1; // also quick claw

View File

@ -183,7 +183,6 @@
#define VARIOUS_JUMP_IF_TEAM_HEALTHY 111
#define VARIOUS_TRY_HEAL_QUARTER_HP 112
#define VARIOUS_REMOVE_TERRAIN 113
#define VARIOUS_JUMP_IF_OBSTRUCT 114
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -3093,7 +3093,6 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].usesBouncedMove = 0;
gProtectStructs[gActiveBattler].usedGravityPreventedMove = 0;
gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0;
gProtectStructs[gActiveBattler].statFell = 0;
gProtectStructs[gActiveBattler].statRaised = 0;
gDisableStructs[gActiveBattler].isFirstTurn = 2;

View File

@ -1237,16 +1237,21 @@ static const u8 sBattlePalaceNatureToFlavorTextId[NUM_NATURES] =
bool32 IsBattlerProtected(u8 battlerId, u16 move)
{
// Decorate bypasses protect and detect, but not crafty shield
if (move == MOVE_DECORATE)
{
if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD)
return TRUE;
else if (gProtectStructs[battlerId].protected)
return FALSE;
}
if (!(gBattleMoves[move].flags & FLAG_PROTECT_AFFECTED))
return FALSE;
else if (gBattleMoves[move].effect == MOVE_EFFECT_FEINT)
return FALSE;
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;
@ -4778,6 +4783,7 @@ static void Cmd_moveend(void)
}
else if (gProtectStructs[gBattlerTarget].obstructed && gCurrentMove != MOVE_SUCKER_PUNCH)
{
gProtectStructs[gBattlerAttacker].touchedProtectLike = 0;
i = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget;
gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable
@ -8697,19 +8703,6 @@ 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;

View File

@ -7468,7 +7468,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
basePower *= 2;
break;
case EFFECT_LASH_OUT:
if (gProtectStructs[battlerAtk].statFell == 1)
if (gSpecialStatuses[battlerAtk].statFell == 1)
basePower *= 2;
break;
case EFFECT_EXPLOSION: