mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 04:04:17 +01:00
Stockpile gen4 effect and fixed spit up
This commit is contained in:
parent
d3d9051c4a
commit
3e476adf4a
@ -729,8 +729,9 @@
|
|||||||
.4byte \param0
|
.4byte \param0
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro stockpile
|
.macro stockpile id:req
|
||||||
.byte 0x85
|
.byte 0x85
|
||||||
|
.byte \id
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro stockpiletobasedamage param0:req
|
.macro stockpiletobasedamage param0:req
|
||||||
|
@ -3946,11 +3946,30 @@ BattleScript_EffectStockpile::
|
|||||||
attackcanceler
|
attackcanceler
|
||||||
attackstring
|
attackstring
|
||||||
ppreduce
|
ppreduce
|
||||||
stockpile
|
stockpile 0
|
||||||
attackanimation
|
attackanimation
|
||||||
waitanimation
|
waitanimation
|
||||||
printfromtable gStockpileUsedStringIds
|
printfromtable gStockpileUsedStringIds
|
||||||
waitmessage 0x40
|
waitmessage 0x40
|
||||||
|
jumpifmovehadnoeffect BattleScript_EffectStockpileEnd
|
||||||
|
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, 0xC, BattleScript_EffectStockpileDef
|
||||||
|
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, 0xC, BattleScript_EffectStockpileEnd
|
||||||
|
BattleScript_EffectStockpileDef:
|
||||||
|
setbyte sSTAT_ANIM_PLAYED, FALSE
|
||||||
|
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, 0x0
|
||||||
|
setstatchanger STAT_DEF, 1, FALSE
|
||||||
|
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_EffectStockpileSpDef
|
||||||
|
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_EffectStockpileSpDef
|
||||||
|
printfromtable gStatUpStringIds
|
||||||
|
waitmessage 0x40
|
||||||
|
BattleScript_EffectStockpileSpDef::
|
||||||
|
setstatchanger STAT_SPDEF, 1, FALSE
|
||||||
|
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_EffectStockpileEnd
|
||||||
|
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_EffectStockpileEnd
|
||||||
|
printfromtable gStatUpStringIds
|
||||||
|
waitmessage 0x40
|
||||||
|
BattleScript_EffectStockpileEnd:
|
||||||
|
stockpile 1
|
||||||
goto BattleScript_MoveEnd
|
goto BattleScript_MoveEnd
|
||||||
|
|
||||||
BattleScript_EffectSpitUp::
|
BattleScript_EffectSpitUp::
|
||||||
@ -3959,9 +3978,10 @@ BattleScript_EffectSpitUp::
|
|||||||
attackstring
|
attackstring
|
||||||
ppreduce
|
ppreduce
|
||||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||||
stockpiletobasedamage BattleScript_SpitUpFail
|
setbyte gIsCriticalHit, FALSE
|
||||||
typecalc
|
damagecalc
|
||||||
adjustdamage
|
adjustdamage
|
||||||
|
stockpiletobasedamage BattleScript_SpitUpFail
|
||||||
goto BattleScript_HitFromAtkAnimation
|
goto BattleScript_HitFromAtkAnimation
|
||||||
BattleScript_SpitUpFail::
|
BattleScript_SpitUpFail::
|
||||||
pause 0x20
|
pause 0x20
|
||||||
|
@ -82,6 +82,10 @@ struct DisableStruct
|
|||||||
u16 encoredMove;
|
u16 encoredMove;
|
||||||
u8 protectUses;
|
u8 protectUses;
|
||||||
u8 stockpileCounter;
|
u8 stockpileCounter;
|
||||||
|
s8 stockpileDef;
|
||||||
|
s8 stockpileSpDef;
|
||||||
|
s8 stockpileBeforeDef;
|
||||||
|
s8 stockpileBeforeSpDef;
|
||||||
u8 substituteHP;
|
u8 substituteHP;
|
||||||
u8 disableTimer:4;
|
u8 disableTimer:4;
|
||||||
u8 disableTimerStartValue:4;
|
u8 disableTimerStartValue:4;
|
||||||
|
@ -7962,18 +7962,33 @@ static void atk84_jumpifcantmakeasleep(void)
|
|||||||
|
|
||||||
static void atk85_stockpile(void)
|
static void atk85_stockpile(void)
|
||||||
{
|
{
|
||||||
if (gDisableStructs[gBattlerAttacker].stockpileCounter >= 3)
|
switch (gBattlescriptCurrInstr[1])
|
||||||
{
|
{
|
||||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
case 0:
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
if (gDisableStructs[gBattlerAttacker].stockpileCounter >= 3)
|
||||||
|
{
|
||||||
|
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||||
|
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gDisableStructs[gBattlerAttacker].stockpileCounter++;
|
||||||
|
gDisableStructs[gBattlerAttacker].stockpileBeforeDef = gBattleMons[gBattlerAttacker].statStages[STAT_DEF];
|
||||||
|
gDisableStructs[gBattlerAttacker].stockpileBeforeSpDef = gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF];
|
||||||
|
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gBattlerAttacker].stockpileCounter);
|
||||||
|
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1: // Save def/sp def stats.
|
||||||
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||||
|
{
|
||||||
|
gDisableStructs[gBattlerAttacker].stockpileDef += gBattleMons[gBattlerAttacker].statStages[STAT_DEF] - gDisableStructs[gBattlerAttacker].stockpileBeforeDef;
|
||||||
|
gDisableStructs[gBattlerAttacker].stockpileSpDef += gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF] - gDisableStructs[gBattlerAttacker].stockpileBeforeSpDef;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
gBattlescriptCurrInstr += 2;
|
||||||
gDisableStructs[gBattlerAttacker].stockpileCounter++;
|
|
||||||
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gBattlerAttacker].stockpileCounter);
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
|
||||||
}
|
|
||||||
gBattlescriptCurrInstr++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void atk86_stockpiletobasedamage(void)
|
static void atk86_stockpiletobasedamage(void)
|
||||||
@ -7986,11 +8001,12 @@ static void atk86_stockpiletobasedamage(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gBattleCommunication[6] != 1)
|
if (gBattleCommunication[6] != 1)
|
||||||
{
|
|
||||||
gBattleScripting.animTurn = gDisableStructs[gBattlerAttacker].stockpileCounter;
|
gBattleScripting.animTurn = gDisableStructs[gBattlerAttacker].stockpileCounter;
|
||||||
}
|
|
||||||
|
|
||||||
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
||||||
|
// Restore stat changes from stockpile.
|
||||||
|
gBattleMons[gBattlerAttacker].statStages[STAT_DEF] -= gDisableStructs[gBattlerAttacker].stockpileDef;
|
||||||
|
gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF] -= gDisableStructs[gBattlerAttacker].stockpileSpDef;
|
||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8004,25 +8020,32 @@ static void atk87_stockpiletohpheal(void)
|
|||||||
gBattlescriptCurrInstr = jumpPtr;
|
gBattlescriptCurrInstr = jumpPtr;
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||||
}
|
}
|
||||||
else if (gBattleMons[gBattlerAttacker].maxHP == gBattleMons[gBattlerAttacker].hp)
|
|
||||||
{
|
|
||||||
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
|
||||||
gBattlescriptCurrInstr = jumpPtr;
|
|
||||||
gBattlerTarget = gBattlerAttacker;
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / (1 << (3 - gDisableStructs[gBattlerAttacker].stockpileCounter));
|
if (gBattleMons[gBattlerAttacker].maxHP == gBattleMons[gBattlerAttacker].hp)
|
||||||
|
{
|
||||||
|
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
||||||
|
gBattlescriptCurrInstr = jumpPtr;
|
||||||
|
gBattlerTarget = gBattlerAttacker;
|
||||||
|
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / (1 << (3 - gDisableStructs[gBattlerAttacker].stockpileCounter));
|
||||||
|
|
||||||
if (gBattleMoveDamage == 0)
|
if (gBattleMoveDamage == 0)
|
||||||
gBattleMoveDamage = 1;
|
gBattleMoveDamage = 1;
|
||||||
gBattleMoveDamage *= -1;
|
gBattleMoveDamage *= -1;
|
||||||
|
|
||||||
gBattleScripting.animTurn = gDisableStructs[gBattlerAttacker].stockpileCounter;
|
gBattleScripting.animTurn = gDisableStructs[gBattlerAttacker].stockpileCounter;
|
||||||
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
gBattlerTarget = gBattlerAttacker;
|
gBattlerTarget = gBattlerAttacker;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore stat changes from stockpile.
|
||||||
|
gBattleMons[gBattlerAttacker].statStages[STAT_DEF] -= gDisableStructs[gBattlerAttacker].stockpileDef;
|
||||||
|
gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF] -= gDisableStructs[gBattlerAttacker].stockpileSpDef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8276,6 +8299,8 @@ static void atk8A_normalisebuffs(void) // haze
|
|||||||
|
|
||||||
for (i = 0; i < gBattlersCount; i++)
|
for (i = 0; i < gBattlersCount; i++)
|
||||||
{
|
{
|
||||||
|
gDisableStructs[i].stockpileDef = 0;
|
||||||
|
gDisableStructs[i].stockpileSpDef = 0;
|
||||||
for (j = 0; j < NUM_BATTLE_STATS; j++)
|
for (j = 0; j < NUM_BATTLE_STATS; j++)
|
||||||
gBattleMons[i].statStages[j] = 6;
|
gBattleMons[i].statStages[j] = 6;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user