Spectral Thief effect

This commit is contained in:
DizzyEggg 2019-02-14 12:15:53 +01:00
parent 4c535a1b03
commit dc39f76a95
12 changed files with 115 additions and 31 deletions

View File

@ -1585,6 +1585,10 @@
various \battler, VARIOUS_SET_POWDER various \battler, VARIOUS_SET_POWDER
.endm .endm
.macro spectralthiefprintstats
various BS_ATTACKER, VARIOUS_SPECTRAL_THIEF
.endm
@ helpful macros @ helpful macros
.macro setstatchanger stat:req, stages:req, down:req .macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7 setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7

View File

@ -343,6 +343,19 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectSpAtkUpHit .4byte BattleScript_EffectSpAtkUpHit
.4byte BattleScript_EffectBelch .4byte BattleScript_EffectBelch
.4byte BattleScript_EffectPartingShot .4byte BattleScript_EffectPartingShot
.4byte BattleScript_EffectSpectralThief
BattleScript_SpectralThiefSteal::
printstring STRINGID_SPECTRALTHIEFSTEAL
waitmessage 0x40
setbyte sB_ANIM_ARG2, 0
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
spectralthiefprintstats
return
BattleScript_EffectSpectralThief:
setmoveeffect MOVE_EFFECT_SPECTRAL_THIEF
goto BattleScript_EffectHit
BattleScript_EffectPartingShot:: BattleScript_EffectPartingShot::
attackcanceler attackcanceler
@ -2002,6 +2015,7 @@ BattleScript_StatUpEnd::
BattleScript_StatUp:: BattleScript_StatUp::
playanimation BS_EFFECT_BATTLER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 playanimation BS_EFFECT_BATTLER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
BattleScript_StatUpMsg::
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage 0x40 waitmessage 0x40
return return

View File

@ -573,6 +573,7 @@ struct BattleStruct
bool8 trainerSlideLowHpMsgDone; bool8 trainerSlideLowHpMsgDone;
u8 introState; u8 introState;
u8 ateBerry[2]; // array id determined by side, each party pokemon as bit u8 ateBerry[2]; // array id determined by side, each party pokemon as bit
u8 stolenStats[NUM_BATTLE_STATS]; // hp byte is used for which stats to raise, other inform about by how many stages
}; };
#define GET_MOVE_TYPE(move, typeArg) \ #define GET_MOVE_TYPE(move, typeArg) \

View File

@ -308,6 +308,7 @@ extern const u8 gText_BattleRecordedOnPass[];
extern const u8 gText_BattleTourney[]; extern const u8 gText_BattleTourney[];
extern const u16 gMissStringIds[]; extern const u16 gMissStringIds[];
extern const u16 gStatUpStringIds[];
extern const u16 gTrappingMoves[]; extern const u16 gTrappingMoves[];
#endif // GUARD_BATTLE_MESSAGE_H #endif // GUARD_BATTLE_MESSAGE_H

View File

@ -293,5 +293,7 @@ extern const u8 BattleScript_PsychicSurgeActivates[];
extern const u8 BattleScript_GrassySurgeActivates[]; extern const u8 BattleScript_GrassySurgeActivates[];
extern const u8 BattleScript_MistySurgeActivates[]; extern const u8 BattleScript_MistySurgeActivates[];
extern const u8 BattleScript_ElectricSurgeActivates[]; extern const u8 BattleScript_ElectricSurgeActivates[];
extern const u8 BattleScript_SpectralThiefSteal[];
extern const u8 BattleScript_StatUpMsg[];
#endif // GUARD_BATTLE_SCRIPTS_H #endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -325,7 +325,7 @@
#define MOVE_EFFECT_SMACK_DOWN 0x3C #define MOVE_EFFECT_SMACK_DOWN 0x3C
#define MOVE_EFFECT_FLAME_BURST 0x3D #define MOVE_EFFECT_FLAME_BURST 0x3D
#define MOVE_EFFECT_FEINT 0x3E #define MOVE_EFFECT_FEINT 0x3E
#define MOVE_EFFECT_NOTHING_3F 0x3F #define MOVE_EFFECT_SPECTRAL_THIEF 0x3F
#define MOVE_EFFECT_AFFECTS_USER 0x40 #define MOVE_EFFECT_AFFECTS_USER 0x40
#define MOVE_EFFECT_CERTAIN 0x80 #define MOVE_EFFECT_CERTAIN 0x80

View File

@ -331,5 +331,6 @@
#define EFFECT_SP_ATTACK_UP_HIT 325 #define EFFECT_SP_ATTACK_UP_HIT 325
#define EFFECT_BELCH 326 #define EFFECT_BELCH 326
#define EFFECT_PARTING_SHOT 327 #define EFFECT_PARTING_SHOT 327
#define EFFECT_SPECTRAL_THIEF 328
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -134,6 +134,7 @@
#define VARIOUS_TRY_THIRD_TYPE 72 #define VARIOUS_TRY_THIRD_TYPE 72
#define VARIOUS_ACUPRESSURE 73 #define VARIOUS_ACUPRESSURE 73
#define VARIOUS_SET_POWDER 74 #define VARIOUS_SET_POWDER 74
#define VARIOUS_SPECTRAL_THIEF 75
// atk80, dmg manipulation // atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0 #define ATK80_DMG_CHANGE_SIGN 0

View File

@ -517,6 +517,7 @@
#define STRINGID_COVEREDINPOWDER 513 #define STRINGID_COVEREDINPOWDER 513
#define STRINGID_POWDEREXPLODES 514 #define STRINGID_POWDEREXPLODES 514
#define STRINGID_BELCHCANTSELECT 515 #define STRINGID_BELCHCANTSELECT 515
#define STRINGID_SPECTRALTHIEFSTEAL 516
#define BATTLESTRINGS_COUNT 528 #define BATTLESTRINGS_COUNT 528

View File

@ -642,9 +642,11 @@ static const u8 sText_PokemonCannotUseMove[] = _("{B_ATK_NAME_WITH_PREFIX} canno
static const u8 sText_CoveredInPowder[] = _("{B_DEF_NAME_WITH_PREFIX} is covered in powder!"); static const u8 sText_CoveredInPowder[] = _("{B_DEF_NAME_WITH_PREFIX} is covered in powder!");
static const u8 sText_PowderExplodes[] = _("When the flame touched the powder\non the Pokémon, it exploded!"); static const u8 sText_PowderExplodes[] = _("When the flame touched the powder\non the Pokémon, it exploded!");
static const u8 sText_BelchCantUse[] = _("Belch cannot be used!\p"); static const u8 sText_BelchCantUse[] = _("Belch cannot be used!\p");
static const u8 sText_SpectralThiefSteal[] = _("{B_ATK_NAME_WITH_PREFIX} stole the target's\nboosted stats!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{ {
[STRINGID_SPECTRALTHIEFSTEAL - 12] = sText_SpectralThiefSteal,
[STRINGID_BELCHCANTSELECT - 12] = sText_BelchCantUse, [STRINGID_BELCHCANTSELECT - 12] = sText_BelchCantUse,
[STRINGID_TRAINER1LOSETEXT - 12] = sText_Trainer1LoseText, [STRINGID_TRAINER1LOSETEXT - 12] = sText_Trainer1LoseText,
[STRINGID_PKMNGAINEDEXP - 12] = sText_PkmnGainedEXP, [STRINGID_PKMNGAINEDEXP - 12] = sText_PkmnGainedEXP,

View File

@ -1987,7 +1987,7 @@ u8 GetBattlerTurnOrderNum(u8 battlerId)
void SetMoveEffect(bool8 primary, u8 certain) void SetMoveEffect(bool8 primary, u8 certain)
{ {
s32 i; s32 i, byTwo;
bool32 statusChanged = FALSE; bool32 statusChanged = FALSE;
u8 affectsUser = 0; // 0x40 otherwise u8 affectsUser = 0; // 0x40 otherwise
bool32 noSunCanFreeze = TRUE; bool32 noSunCanFreeze = TRUE;
@ -2742,6 +2742,46 @@ void SetMoveEffect(bool8 primary, u8 certain)
} }
} }
break; break;
case MOVE_EFFECT_SPECTRAL_THIEF:
gBattleStruct->stolenStats[0] = 0; // Stats to steal.
gBattleScripting.animArg1 = 0;
for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++)
{
if (gBattleMons[gBattlerTarget].statStages[i] > 6 && gBattleMons[gBattlerAttacker].statStages[i] != 12)
{
gBattleStruct->stolenStats[0] |= gBitTable[i];
// Store by how many stages to raise the stat.
gBattleStruct->stolenStats[i] = gBattleMons[gBattlerTarget].statStages[i] - 6;
while (gBattleMons[gBattlerAttacker].statStages[i] + gBattleStruct->stolenStats[i] > 12)
gBattleStruct->stolenStats[i]--;
gBattleMons[gBattlerTarget].statStages[i] = 6;
if (gBattleStruct->stolenStats[i] >= 2)
byTwo++;
if (gBattleScripting.animArg1 == 0)
{
if (byTwo)
gBattleScripting.animArg1 = STAT_ANIM_PLUS2 - 1 + i;
else
gBattleScripting.animArg1 = STAT_ANIM_PLUS1 - 1 + i;
}
else
{
if (byTwo)
gBattleScripting.animArg1 = STAT_ANIM_MULTIPLE_PLUS2;
else
gBattleScripting.animArg1 = STAT_ANIM_MULTIPLE_PLUS1;
}
}
}
if (gBattleStruct->stolenStats[0] != 0)
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_SpectralThiefSteal;
}
break;
} }
} }
} }
@ -6332,6 +6372,23 @@ static void atk76_various(void)
switch (gBattlescriptCurrInstr[2]) switch (gBattlescriptCurrInstr[2])
{ {
case VARIOUS_SPECTRAL_THIEF:
// Raise stats
for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++)
{
if (gBattleStruct->stolenStats[0] & gBitTable[i])
{
gBattleStruct->stolenStats[0] &= ~(gBitTable[i]);
SET_STATCHANGER(i, gBattleStruct->stolenStats[i], FALSE);
if (ChangeStatBuffs(gBattleScripting.statChanger & 0xF0, i, MOVE_EFFECT_CERTAIN | MOVE_EFFECT_AFFECTS_USER, NULL) == STAT_CHANGE_WORKED)
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_StatUpMsg;
return;
}
}
}
break;
case VARIOUS_SET_POWDER: case VARIOUS_SET_POWDER:
gBattleMons[gActiveBattler].status2 |= STATUS2_POWDER; gBattleMons[gActiveBattler].status2 |= STATUS2_POWDER;
break; break;
@ -7810,7 +7867,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
gBattleTextBuff2[3] = STRINGID_STATHARSHLY >> 8; gBattleTextBuff2[3] = STRINGID_STATHARSHLY >> 8;
index = 4; index = 4;
} }
else if (statValue == -3) else if (statValue <= -3)
{ {
gBattleTextBuff2[1] = B_BUFF_STRING; gBattleTextBuff2[1] = B_BUFF_STRING;
gBattleTextBuff2[2] = STRINGID_SEVERELY & 0xFF; gBattleTextBuff2[2] = STRINGID_SEVERELY & 0xFF;
@ -7844,7 +7901,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
gBattleTextBuff2[3] = STRINGID_STATSHARPLY >> 8; gBattleTextBuff2[3] = STRINGID_STATSHARPLY >> 8;
index = 4; index = 4;
} }
else if (statValue == 3) else if (statValue >= 3)
{ {
gBattleTextBuff2[1] = B_BUFF_STRING; gBattleTextBuff2[1] = B_BUFF_STRING;
gBattleTextBuff2[2] = STRINGID_DRASTICALLY & 0xFF; gBattleTextBuff2[2] = STRINGID_DRASTICALLY & 0xFF;

View File

@ -2266,7 +2266,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.target = MOVE_TARGET_SELECTED, .target = MOVE_TARGET_SELECTED,
.priority = 0, .priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED,
.split = SPLIT_PHYSICAL, .split = SPLIT_SPECIAL,
}, },
[MOVE_SUPER_FANG] = [MOVE_SUPER_FANG] =
@ -9347,12 +9347,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_SPECTRAL_THIEF] = [MOVE_SPECTRAL_THIEF] =
{ {
.effect = EFFECT_PLACEHOLDER, .effect = EFFECT_SPECTRAL_THIEF,
.power = 90, .power = 90,
.type = TYPE_GHOST, .type = TYPE_GHOST,
.accuracy = 100, .accuracy = 100,
.pp = 10, .pp = 10,
.secondaryEffectChance = 0, .secondaryEffectChance = 100,
.target = MOVE_TARGET_SELECTED, .target = MOVE_TARGET_SELECTED,
.priority = 0, .priority = 0,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED,