mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Change move effect to u16
This commit is contained in:
parent
dc39f76a95
commit
94cd547e9a
@ -708,7 +708,7 @@
|
||||
|
||||
.macro statbuffchange param0:req, param1:req
|
||||
.byte 0x89
|
||||
.byte \param0
|
||||
.2byte \param0
|
||||
.4byte \param1
|
||||
.endm
|
||||
|
||||
@ -1595,8 +1595,8 @@
|
||||
.endm
|
||||
|
||||
.macro setmoveeffect effect:req
|
||||
setbyte cEFFECT_CHOOSER \effect
|
||||
setbyte sSAVED_MOVE_EFFECT \effect
|
||||
sethword sMOVE_EFFECT \effect
|
||||
sethword sSAVED_MOVE_EFFECT \effect
|
||||
.endm
|
||||
|
||||
.macro chosenstatus1animation battler:req, status:req
|
||||
@ -1608,15 +1608,15 @@
|
||||
.endm
|
||||
|
||||
.macro sethword dst:req, value:req
|
||||
setbyte \dst, \value & 0xFF
|
||||
setbyte \dst + 1, (\value >> 8) & 0xFF
|
||||
setbyte \dst, (\value) & 0xFF
|
||||
setbyte \dst + 1, ((\value) >> 8) & 0xFF
|
||||
.endm
|
||||
|
||||
.macro setword dst:req, value:req
|
||||
setbyte \dst, \value & 0xFF
|
||||
setbyte \dst + 1, (\value >> 8) & 0xFF
|
||||
setbyte \dst + 2, (\value >> 16) & 0xFF
|
||||
setbyte \dst + 3, (\value >> 24) & 0xFF
|
||||
setbyte \dst, (\value) & 0xFF
|
||||
setbyte \dst + 1, ((\value) >> 8) & 0xFF
|
||||
setbyte \dst + 2, ((\value) >> 16) & 0xFF
|
||||
setbyte \dst + 3, ((\value) >> 24) & 0xFF
|
||||
.endm
|
||||
|
||||
.macro copybyte dst:req, src:req
|
||||
|
@ -2125,7 +2125,7 @@ BattleScript_EffectMultiHit::
|
||||
ppreduce
|
||||
setmultihitcounter 0x0
|
||||
initmultihitstring
|
||||
setbyte sMULTIHIT_EFFECT, 0x0
|
||||
sethword sMULTIHIT_EFFECT, 0x0
|
||||
BattleScript_MultiHitLoop::
|
||||
jumpifhasnohp BS_ATTACKER, BattleScript_MultiHitEnd
|
||||
jumpifhasnohp BS_TARGET, BattleScript_MultiHitPrintStrings
|
||||
@ -2133,7 +2133,7 @@ BattleScript_MultiHitLoop::
|
||||
jumpifstatus BS_ATTACKER, STATUS1_SLEEP, BattleScript_MultiHitPrintStrings
|
||||
BattleScript_DoMultiHit::
|
||||
movevaluescleanup
|
||||
copybyte cEFFECT_CHOOSER, sMULTIHIT_EFFECT
|
||||
copyhword sMOVE_EFFECT, sMULTIHIT_EFFECT
|
||||
critcalc
|
||||
damagecalc
|
||||
jumpifmovehadnoeffect BattleScript_MultiHitNoMoreHits
|
||||
@ -2386,7 +2386,7 @@ BattleScript_EffectDoubleHit::
|
||||
ppreduce
|
||||
setmultihitcounter 0x2
|
||||
initmultihitstring
|
||||
setbyte sMULTIHIT_EFFECT, 0x0
|
||||
sethword sMULTIHIT_EFFECT, 0x0
|
||||
goto BattleScript_MultiHitLoop
|
||||
|
||||
BattleScript_EffectRecoilIfMiss::
|
||||
@ -2665,7 +2665,7 @@ BattleScript_EffectConfuseHit::
|
||||
BattleScript_EffectTwineedle::
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
setbyte sMULTIHIT_EFFECT, MOVE_EFFECT_POISON
|
||||
sethword sMULTIHIT_EFFECT, MOVE_EFFECT_POISON
|
||||
attackstring
|
||||
ppreduce
|
||||
setmultihitcounter 0x2
|
||||
@ -3420,7 +3420,7 @@ BattleScript_EffectEarthquake:
|
||||
selectfirstvalidtarget
|
||||
BattleScript_HitsAllWithUndergroundBonusLoop::
|
||||
movevaluescleanup
|
||||
copybyte cEFFECT_CHOOSER, sSAVED_MOVE_EFFECT
|
||||
copyhword sMOVE_EFFECT, sSAVED_MOVE_EFFECT
|
||||
jumpifnostatus3 BS_TARGET, STATUS3_UNDERGROUND, BattleScript_HitsAllNoUndergroundBonus
|
||||
orword gHitMarker, HITMARKER_IGNORE_UNDERGROUND
|
||||
goto BattleScript_DoHitAllWithUndergroundBonus
|
||||
|
@ -47,7 +47,6 @@
|
||||
#define TASK_ID 0x1 // task Id and cursor position share the same field
|
||||
#define SPRITES_INIT_STATE1 0x1 // shares the Id as well
|
||||
#define SPRITES_INIT_STATE2 0x2
|
||||
#define MOVE_EFFECT_BYTE 0x3
|
||||
#define ACTIONS_CONFIRMED_COUNT 0x4
|
||||
#define MULTISTRING_CHOOSER 0x5
|
||||
#define MSG_DISPLAY 0x7
|
||||
@ -619,7 +618,7 @@ struct BattleScripting
|
||||
u16 tripleKickPower;
|
||||
u8 atk49_state;
|
||||
u8 battlerWithAbility;
|
||||
u8 multihitMoveEffect;
|
||||
u8 unused_16;
|
||||
u8 battler;
|
||||
u8 animTurn;
|
||||
u8 animTargetsHit;
|
||||
@ -638,7 +637,9 @@ struct BattleScripting
|
||||
u8 specialTrainerBattleType;
|
||||
bool8 monCaught;
|
||||
s32 savedDmg;
|
||||
u8 savedMoveEffect; // For moves hitting multiple targets.
|
||||
u16 savedMoveEffect; // For moves hitting multiple targets.
|
||||
u16 moveEffect;
|
||||
u16 multihitMoveEffect;
|
||||
};
|
||||
|
||||
// rom_80A5C6C
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbility);
|
||||
u8 GetBattlerTurnOrderNum(u8 battlerId);
|
||||
void SetMoveEffect(bool8 primary, u8 certain);
|
||||
void SetMoveEffect(bool32 primary, u32 certain);
|
||||
void BattleDestroyYesNoCursorAt(u8 cursorPosition);
|
||||
void BattleCreateYesNoCursorAt(u8 cursorPosition);
|
||||
void BufferMoveToLearnIntoBattleTextBuff2(void);
|
||||
|
@ -326,8 +326,8 @@
|
||||
#define MOVE_EFFECT_FLAME_BURST 0x3D
|
||||
#define MOVE_EFFECT_FEINT 0x3E
|
||||
#define MOVE_EFFECT_SPECTRAL_THIEF 0x3F
|
||||
#define MOVE_EFFECT_AFFECTS_USER 0x40
|
||||
#define MOVE_EFFECT_CERTAIN 0x80
|
||||
#define MOVE_EFFECT_AFFECTS_USER 0x4000
|
||||
#define MOVE_EFFECT_CERTAIN 0x8000
|
||||
|
||||
// Battle terrain defines for gBattleTerrain.
|
||||
#define BATTLE_TERRAIN_GRASS 0
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define sTRIPLE_KICK_POWER gBattleScripting + 0x12
|
||||
#define sMOVEEND_STATE gBattleScripting + 0x14
|
||||
#define sBATTLER_WITH_ABILITY gBattleScripting + 0x15
|
||||
#define sMULTIHIT_EFFECT gBattleScripting + 0x16
|
||||
#define sUNUSED_16 gBattleScripting + 0x16
|
||||
#define sBATTLER gBattleScripting + 0x17
|
||||
#define sB_ANIM_TURN gBattleScripting + 0x18
|
||||
#define sB_ANIM_TARGETS_HIT gBattleScripting + 0x19
|
||||
@ -32,8 +32,9 @@
|
||||
#define sMON_CAUGHT gBattleScripting + 0x27
|
||||
#define sSAVED_DMG gBattleScripting + 0x28
|
||||
#define sSAVED_MOVE_EFFECT gBattleScripting + 0x2C
|
||||
#define sMOVE_EFFECT gBattleScripting + 0x2E
|
||||
#define sMULTIHIT_EFFECT gBattleScripting + 0x30
|
||||
|
||||
#define cEFFECT_CHOOSER gBattleCommunication + 3
|
||||
#define cMULTISTRING_CHOOSER gBattleCommunication + 5
|
||||
|
||||
// Battle Script defines for getting the wanted battler
|
||||
|
@ -64,7 +64,7 @@ extern u8 sub_813B21C(void);
|
||||
static bool8 IsTwoTurnsMove(u16 move);
|
||||
static void TrySetDestinyBondToHappen(void);
|
||||
static u8 AttacksThisTurn(u8 battlerId, u16 move); // Note: returns 1 if it's a charging turn, otherwise 2.
|
||||
static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8, const u8* BS_ptr);
|
||||
static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr);
|
||||
static bool32 IsMonGettingExpSentOut(void);
|
||||
static void sub_804F17C(void);
|
||||
static bool8 sub_804F1CC(void);
|
||||
@ -1975,27 +1975,26 @@ u8 GetBattlerTurnOrderNum(u8 battlerId)
|
||||
#define INCREMENT_RESET_RETURN \
|
||||
{ \
|
||||
gBattlescriptCurrInstr++; \
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0; \
|
||||
gBattleScripting.moveEffect = 0; \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define RESET_RETURN \
|
||||
{ \
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0; \
|
||||
gBattleScripting.moveEffect = 0; \
|
||||
return; \
|
||||
}
|
||||
|
||||
void SetMoveEffect(bool8 primary, u8 certain)
|
||||
void SetMoveEffect(bool32 primary, u32 certain)
|
||||
{
|
||||
s32 i, byTwo;
|
||||
s32 i, byTwo, affectsUser = 0;
|
||||
bool32 statusChanged = FALSE;
|
||||
u8 affectsUser = 0; // 0x40 otherwise
|
||||
bool32 noSunCanFreeze = TRUE;
|
||||
|
||||
if (gBattleCommunication[MOVE_EFFECT_BYTE] & MOVE_EFFECT_AFFECTS_USER)
|
||||
if (gBattleScripting.moveEffect & MOVE_EFFECT_AFFECTS_USER)
|
||||
{
|
||||
gEffectBattler = gBattlerAttacker; // battlerId that effects get applied on
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] &= ~(MOVE_EFFECT_AFFECTS_USER);
|
||||
gBattleScripting.moveEffect &= ~(MOVE_EFFECT_AFFECTS_USER);
|
||||
affectsUser = MOVE_EFFECT_AFFECTS_USER;
|
||||
gBattleScripting.battler = gBattlerTarget; // theoretically the attacker
|
||||
}
|
||||
@ -2006,24 +2005,24 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
}
|
||||
|
||||
if (gBattleMons[gEffectBattler].ability == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||
&& !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 9)
|
||||
&& !primary && gBattleScripting.moveEffect <= 9)
|
||||
INCREMENT_RESET_RETURN
|
||||
|
||||
if (gSideStatuses[GET_BATTLER_SIDE(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD)
|
||||
&& !primary && gBattleCommunication[MOVE_EFFECT_BYTE] <= 7)
|
||||
&& !primary && gBattleScripting.moveEffect <= 7)
|
||||
INCREMENT_RESET_RETURN
|
||||
|
||||
if (gBattleMons[gEffectBattler].hp == 0
|
||||
&& gBattleCommunication[MOVE_EFFECT_BYTE] != MOVE_EFFECT_PAYDAY
|
||||
&& gBattleCommunication[MOVE_EFFECT_BYTE] != MOVE_EFFECT_STEAL_ITEM)
|
||||
&& gBattleScripting.moveEffect != MOVE_EFFECT_PAYDAY
|
||||
&& gBattleScripting.moveEffect != MOVE_EFFECT_STEAL_ITEM)
|
||||
INCREMENT_RESET_RETURN
|
||||
|
||||
if (DoesSubstituteBlockMove(gBattlerAttacker, gEffectBattler, gCurrentMove) && affectsUser != MOVE_EFFECT_AFFECTS_USER)
|
||||
INCREMENT_RESET_RETURN
|
||||
|
||||
if (gBattleCommunication[MOVE_EFFECT_BYTE] <= 6) // status change
|
||||
if (gBattleScripting.moveEffect <= 6) // status change
|
||||
{
|
||||
switch (sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]])
|
||||
switch (sStatusFlagsForMoveEffects[gBattleScripting.moveEffect])
|
||||
{
|
||||
case STATUS1_SLEEP:
|
||||
// check active uproar
|
||||
@ -2242,12 +2241,12 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
{
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
|
||||
if (sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]] == STATUS1_SLEEP)
|
||||
if (sStatusFlagsForMoveEffects[gBattleScripting.moveEffect] == STATUS1_SLEEP)
|
||||
gBattleMons[gEffectBattler].status1 |= ((Random() & 3) + 2);
|
||||
else
|
||||
gBattleMons[gEffectBattler].status1 |= sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]];
|
||||
gBattleMons[gEffectBattler].status1 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect];
|
||||
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
|
||||
|
||||
gActiveBattler = gEffectBattler;
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gEffectBattler].status1);
|
||||
@ -2265,20 +2264,20 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
|
||||
// for synchronize
|
||||
|
||||
if (gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_POISON
|
||||
|| gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_TOXIC
|
||||
|| gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_PARALYSIS
|
||||
|| gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_BURN)
|
||||
if (gBattleScripting.moveEffect == MOVE_EFFECT_POISON
|
||||
|| gBattleScripting.moveEffect == MOVE_EFFECT_TOXIC
|
||||
|| gBattleScripting.moveEffect == MOVE_EFFECT_PARALYSIS
|
||||
|| gBattleScripting.moveEffect == MOVE_EFFECT_BURN)
|
||||
{
|
||||
u8* synchronizeEffect = &gBattleStruct->synchronizeMoveEffect;
|
||||
*synchronizeEffect = gBattleCommunication[MOVE_EFFECT_BYTE];
|
||||
*synchronizeEffect = gBattleScripting.moveEffect;
|
||||
gHitMarker |= HITMARKER_SYNCHRONISE_EFFECT;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (statusChanged == FALSE)
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
|
||||
gBattleScripting.moveEffect = 0;
|
||||
gBattlescriptCurrInstr++;
|
||||
return;
|
||||
}
|
||||
@ -2286,14 +2285,14 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBattleMons[gEffectBattler].status2 & sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]])
|
||||
if (gBattleMons[gEffectBattler].status2 & sStatusFlagsForMoveEffects[gBattleScripting.moveEffect])
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 side;
|
||||
switch (gBattleCommunication[MOVE_EFFECT_BYTE])
|
||||
switch (gBattleScripting.moveEffect)
|
||||
{
|
||||
case MOVE_EFFECT_CONFUSION:
|
||||
if (gBattleMons[gEffectBattler].ability == ABILITY_OWN_TEMPO
|
||||
@ -2306,7 +2305,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
gBattleMons[gEffectBattler].status2 |= (((Random()) % 0x4)) + 2;
|
||||
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_FLINCH:
|
||||
@ -2326,7 +2325,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
else
|
||||
{
|
||||
if (GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber)
|
||||
gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]];
|
||||
gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect];
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
break;
|
||||
@ -2339,7 +2338,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
gBattleMons[gEffectBattler].status2 |= ((Random() & 3) + 2) << 4;
|
||||
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2355,7 +2354,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
gPaydayMoney = 0xFFFF;
|
||||
}
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
|
||||
break;
|
||||
case MOVE_EFFECT_TRI_ATTACK:
|
||||
if (gBattleMons[gEffectBattler].status1)
|
||||
@ -2364,7 +2363,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = Random() % 3 + 3;
|
||||
gBattleScripting.moveEffect = Random() % 3 + 3;
|
||||
SetMoveEffect(FALSE, 0);
|
||||
}
|
||||
break;
|
||||
@ -2391,7 +2390,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
gBattleStruct->wrappedBy[gEffectBattler] = gBattlerAttacker;
|
||||
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
|
||||
|
||||
for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; ; gBattleCommunication[MULTISTRING_CHOOSER]++)
|
||||
{
|
||||
@ -2408,7 +2407,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
gBattleMoveDamage = 1;
|
||||
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
|
||||
break;
|
||||
case MOVE_EFFECT_ATK_PLUS_1:
|
||||
case MOVE_EFFECT_DEF_PLUS_1:
|
||||
@ -2418,14 +2417,14 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
case MOVE_EFFECT_ACC_PLUS_1:
|
||||
case MOVE_EFFECT_EVS_PLUS_1:
|
||||
if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(1),
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] - MOVE_EFFECT_ATK_PLUS_1 + 1,
|
||||
gBattleScripting.moveEffect - MOVE_EFFECT_ATK_PLUS_1 + 1,
|
||||
affectsUser, 0))
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleScripting.animArg1 = gBattleCommunication[MOVE_EFFECT_BYTE] & ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
|
||||
gBattleScripting.animArg1 = gBattleScripting.moveEffect & ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
|
||||
gBattleScripting.animArg2 = 0;
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_StatUp;
|
||||
@ -2439,14 +2438,14 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
case MOVE_EFFECT_ACC_MINUS_1:
|
||||
case MOVE_EFFECT_EVS_MINUS_1:
|
||||
if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE,
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] - MOVE_EFFECT_ATK_MINUS_1 + 1,
|
||||
gBattleScripting.moveEffect - MOVE_EFFECT_ATK_MINUS_1 + 1,
|
||||
affectsUser, 0))
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleScripting.animArg1 = gBattleCommunication[MOVE_EFFECT_BYTE] & ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
|
||||
gBattleScripting.animArg1 = gBattleScripting.moveEffect & ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
|
||||
gBattleScripting.animArg2 = 0;
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_StatDown;
|
||||
@ -2460,14 +2459,14 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
case MOVE_EFFECT_ACC_PLUS_2:
|
||||
case MOVE_EFFECT_EVS_PLUS_2:
|
||||
if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(2),
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] - MOVE_EFFECT_ATK_PLUS_2 + 1,
|
||||
gBattleScripting.moveEffect - MOVE_EFFECT_ATK_PLUS_2 + 1,
|
||||
affectsUser, 0))
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleScripting.animArg1 = gBattleCommunication[MOVE_EFFECT_BYTE] & ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
|
||||
gBattleScripting.animArg1 = gBattleScripting.moveEffect & ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
|
||||
gBattleScripting.animArg2 = 0;
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_StatUp;
|
||||
@ -2481,14 +2480,14 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
case MOVE_EFFECT_ACC_MINUS_2:
|
||||
case MOVE_EFFECT_EVS_MINUS_2:
|
||||
if (ChangeStatBuffs(SET_STAT_BUFF_VALUE(2) | STAT_BUFF_NEGATIVE,
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] - MOVE_EFFECT_ATK_MINUS_2 + 1,
|
||||
gBattleScripting.moveEffect - MOVE_EFFECT_ATK_MINUS_2 + 1,
|
||||
affectsUser, 0))
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleScripting.animArg1 = gBattleCommunication[MOVE_EFFECT_BYTE] & ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
|
||||
gBattleScripting.animArg1 = gBattleScripting.moveEffect & ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
|
||||
gBattleScripting.animArg2 = 0;
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_StatDown;
|
||||
@ -2618,7 +2617,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
gBattleMoveDamage = 1;
|
||||
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
|
||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
|
||||
break;
|
||||
case MOVE_EFFECT_RECOIL_50: // Head Smash
|
||||
gBattleMoveDamage = gHpDealt / 2;
|
||||
@ -2786,7 +2785,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
}
|
||||
}
|
||||
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
|
||||
gBattleScripting.moveEffect = 0;
|
||||
}
|
||||
|
||||
static void atk15_seteffectwithchance(void)
|
||||
@ -2798,14 +2797,14 @@ static void atk15_seteffectwithchance(void)
|
||||
else
|
||||
percentChance = gBattleMoves[gCurrentMove].secondaryEffectChance;
|
||||
|
||||
if (gBattleCommunication[MOVE_EFFECT_BYTE] & MOVE_EFFECT_CERTAIN
|
||||
if (gBattleScripting.moveEffect & MOVE_EFFECT_CERTAIN
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] &= ~(MOVE_EFFECT_CERTAIN);
|
||||
gBattleScripting.moveEffect &= ~(MOVE_EFFECT_CERTAIN);
|
||||
SetMoveEffect(0, MOVE_EFFECT_CERTAIN);
|
||||
}
|
||||
else if (Random() % 100 < percentChance
|
||||
&& gBattleCommunication[MOVE_EFFECT_BYTE]
|
||||
&& gBattleScripting.moveEffect
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
{
|
||||
if (percentChance >= 100)
|
||||
@ -2818,7 +2817,7 @@ static void atk15_seteffectwithchance(void)
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
|
||||
gBattleScripting.moveEffect = 0;
|
||||
gBattleScripting.multihitMoveEffect = 0;
|
||||
}
|
||||
|
||||
@ -2836,12 +2835,12 @@ static void atk18_clearstatusfromeffect(void)
|
||||
{
|
||||
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||
|
||||
if (gBattleCommunication[MOVE_EFFECT_BYTE] <= MOVE_EFFECT_TOXIC)
|
||||
gBattleMons[gActiveBattler].status1 &= (~sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]]);
|
||||
if (gBattleScripting.moveEffect <= MOVE_EFFECT_TOXIC)
|
||||
gBattleMons[gActiveBattler].status1 &= (~sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]);
|
||||
else
|
||||
gBattleMons[gActiveBattler].status2 &= (~sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]]);
|
||||
gBattleMons[gActiveBattler].status2 &= (~sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]);
|
||||
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
|
||||
gBattleScripting.moveEffect = 0;
|
||||
gBattlescriptCurrInstr += 2;
|
||||
gBattleScripting.multihitMoveEffect = 0;
|
||||
}
|
||||
@ -3520,7 +3519,7 @@ static void MoveValuesCleanUp(void)
|
||||
{
|
||||
gMoveResultFlags = 0;
|
||||
gIsCriticalHit = FALSE;
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
|
||||
gBattleScripting.moveEffect = 0;
|
||||
gBattleCommunication[6] = 0;
|
||||
gHitMarker &= ~(HITMARKER_DESTINYBOND);
|
||||
gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT);
|
||||
@ -4430,7 +4429,7 @@ static void atk49_moveend(void)
|
||||
gBattlerTarget = battlerId;
|
||||
gBattleScripting.atk49_state = 0;
|
||||
MoveValuesCleanUp();
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleScripting.savedMoveEffect;
|
||||
gBattleScripting.moveEffect = gBattleScripting.savedMoveEffect;
|
||||
BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]);
|
||||
gBattlescriptCurrInstr = BattleScript_FlushMessageBox;
|
||||
return;
|
||||
@ -6935,25 +6934,25 @@ static void atk76_various(void)
|
||||
switch (gBattleMoves[gCurrentMove].argument)
|
||||
{
|
||||
case STATUS1_BURN:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_BURN;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_BURN;
|
||||
break;
|
||||
case STATUS1_FREEZE:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_FREEZE;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_FREEZE;
|
||||
break;
|
||||
case STATUS1_PARALYSIS:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_PARALYSIS;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_PARALYSIS;
|
||||
break;
|
||||
case STATUS1_POISON:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_POISON;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_POISON;
|
||||
break;
|
||||
case STATUS1_TOXIC_POISON:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_TOXIC;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_TOXIC;
|
||||
break;
|
||||
default:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
|
||||
gBattleScripting.moveEffect = 0;
|
||||
break;
|
||||
}
|
||||
if (gBattleCommunication[MOVE_EFFECT_BYTE] != 0)
|
||||
if (gBattleScripting.moveEffect != 0)
|
||||
{
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 3);
|
||||
gBattlescriptCurrInstr = BattleScript_EffectWithChance;
|
||||
@ -7187,7 +7186,7 @@ static void atk76_various(void)
|
||||
}
|
||||
return;
|
||||
case VARIOUS_ARGUMENT_TO_MOVE_EFFECT:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleMoves[gCurrentMove].argument;
|
||||
gBattleScripting.moveEffect = gBattleMoves[gCurrentMove].argument;
|
||||
break;
|
||||
case VARIOUS_JUMP_IF_NOT_GROUNDED:
|
||||
if (!IsBattlerGrounded(gActiveBattler))
|
||||
@ -7747,10 +7746,10 @@ static void atk88_setdrainedhp(void)
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr)
|
||||
{
|
||||
bool8 certain = FALSE;
|
||||
bool8 notProtectAffected = FALSE;
|
||||
bool32 certain = FALSE;
|
||||
bool32 notProtectAffected = FALSE;
|
||||
u32 index;
|
||||
|
||||
if (flags & MOVE_EFFECT_AFFECTS_USER)
|
||||
@ -7939,9 +7938,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
|
||||
|
||||
static void atk89_statbuffchange(void)
|
||||
{
|
||||
const u8* jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
||||
if (ChangeStatBuffs(gBattleScripting.statChanger & 0xF0, GET_STAT_BUFF_ID(gBattleScripting.statChanger), gBattlescriptCurrInstr[1], jumpPtr) == STAT_CHANGE_WORKED)
|
||||
gBattlescriptCurrInstr += 6;
|
||||
const u8 *jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
if (ChangeStatBuffs(gBattleScripting.statChanger & 0xF0, GET_STAT_BUFF_ID(gBattleScripting.statChanger), T1_READ_16(gBattlescriptCurrInstr + 1), jumpPtr) == STAT_CHANGE_WORKED)
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
|
||||
static void atk8A_normalisebuffs(void) // haze
|
||||
@ -7970,7 +7969,7 @@ static void atk8B_setbide(void)
|
||||
static void atk8C_confuseifrepeatingattackends(void)
|
||||
{
|
||||
if (!(gBattleMons[gBattlerAttacker].status2 & STATUS2_LOCK_CONFUSE))
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = (MOVE_EFFECT_THRASH | MOVE_EFFECT_AFFECTS_USER);
|
||||
gBattleScripting.moveEffect = (MOVE_EFFECT_THRASH | MOVE_EFFECT_AFFECTS_USER);
|
||||
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
@ -10409,31 +10408,31 @@ static void atkE4_getsecretpowereffect(void)
|
||||
switch (gBattleTerrain)
|
||||
{
|
||||
case BATTLE_TERRAIN_GRASS:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_POISON;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_POISON;
|
||||
break;
|
||||
case BATTLE_TERRAIN_LONG_GRASS:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_SLEEP;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP;
|
||||
break;
|
||||
case BATTLE_TERRAIN_SAND:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_ACC_MINUS_1;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_ACC_MINUS_1;
|
||||
break;
|
||||
case BATTLE_TERRAIN_UNDERWATER:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_DEF_MINUS_1;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_DEF_MINUS_1;
|
||||
break;
|
||||
case BATTLE_TERRAIN_WATER:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_ATK_MINUS_1;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1;
|
||||
break;
|
||||
case BATTLE_TERRAIN_POND:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_SPD_MINUS_1;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_SPD_MINUS_1;
|
||||
break;
|
||||
case BATTLE_TERRAIN_MOUNTAIN:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_CONFUSION;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_CONFUSION;
|
||||
break;
|
||||
case BATTLE_TERRAIN_CAVE:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_FLINCH;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH;
|
||||
break;
|
||||
default:
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_PARALYSIS;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_PARALYSIS;
|
||||
break;
|
||||
}
|
||||
gBattlescriptCurrInstr++;
|
||||
|
@ -1606,7 +1606,7 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
gBattleMons[gActiveBattler].status2 &= ~(STATUS2_MULTIPLETURNS);
|
||||
if (!(gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION))
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER;
|
||||
SetMoveEffect(1, 0);
|
||||
if (gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)
|
||||
BattleScriptExecute(BattleScript_ThrashConfuses);
|
||||
@ -3227,13 +3227,13 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
{
|
||||
do
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = Random() & 3;
|
||||
} while (gBattleCommunication[MOVE_EFFECT_BYTE] == 0);
|
||||
gBattleScripting.moveEffect = Random() & 3;
|
||||
} while (gBattleScripting.moveEffect == 0);
|
||||
|
||||
if (gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_BURN)
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] += 2; // 5 MOVE_EFFECT_PARALYSIS
|
||||
if (gBattleScripting.moveEffect == MOVE_EFFECT_BURN)
|
||||
gBattleScripting.moveEffect += 2; // 5 MOVE_EFFECT_PARALYSIS
|
||||
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] += MOVE_EFFECT_AFFECTS_USER;
|
||||
gBattleScripting.moveEffect += MOVE_EFFECT_AFFECTS_USER;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
|
||||
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
|
||||
@ -3248,7 +3248,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_POISON;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_POISON;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
|
||||
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
|
||||
@ -3263,7 +3263,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_PARALYSIS;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_PARALYSIS;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
|
||||
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
|
||||
@ -3278,7 +3278,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect;
|
||||
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
|
||||
@ -3413,7 +3413,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC)
|
||||
gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON;
|
||||
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect + MOVE_EFFECT_AFFECTS_USER;
|
||||
gBattleScripting.moveEffect = gBattleStruct->synchronizeMoveEffect + MOVE_EFFECT_AFFECTS_USER;
|
||||
gBattleScripting.battler = gBattlerTarget;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
|
||||
@ -3429,7 +3429,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC)
|
||||
gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON;
|
||||
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect;
|
||||
gBattleScripting.moveEffect = gBattleStruct->synchronizeMoveEffect;
|
||||
gBattleScripting.battler = gBattlerAttacker;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
|
||||
@ -4259,7 +4259,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
|
||||
&& gBattleMons[gBattlerTarget].hp)
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_FLINCH;
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH;
|
||||
BattleScriptPushCursor();
|
||||
SetMoveEffect(0, 0);
|
||||
BattleScriptPop();
|
||||
|
Loading…
Reference in New Issue
Block a user