mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 13:53:52 +01:00
Add Copycat
This commit is contained in:
parent
fafcedc722
commit
19e1606595
@ -1496,6 +1496,11 @@
|
|||||||
.4byte \ptr
|
.4byte \ptr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro trycopycat ptr
|
||||||
|
various BS_ATTACKER, VARIOUS_TRY_COPYCAT
|
||||||
|
.4byte \ptr
|
||||||
|
.endm
|
||||||
|
|
||||||
@ helpful macros
|
@ helpful macros
|
||||||
.macro setstatchanger stat, stages, down
|
.macro setstatchanger stat, stages, down
|
||||||
setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7
|
setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7
|
||||||
|
@ -316,6 +316,19 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
|
|||||||
.4byte BattleScript_EffectTechnoBlast
|
.4byte BattleScript_EffectTechnoBlast
|
||||||
.4byte BattleScript_EffectJudgment
|
.4byte BattleScript_EffectJudgment
|
||||||
.4byte BattleScript_EffectAutonomize
|
.4byte BattleScript_EffectAutonomize
|
||||||
|
.4byte BattleScript_EffectCopycat
|
||||||
|
|
||||||
|
BattleScript_EffectCopycat:
|
||||||
|
attackcanceler
|
||||||
|
attackstring
|
||||||
|
pause 0x5
|
||||||
|
trycopycat BattleScript_CopycatFail
|
||||||
|
attackanimation
|
||||||
|
waitanimation
|
||||||
|
jumptorandomattack TRUE
|
||||||
|
BattleScript_CopycatFail:
|
||||||
|
ppreduce
|
||||||
|
goto BattleScript_ButItFailed
|
||||||
|
|
||||||
BattleScript_EffectAutonomize:
|
BattleScript_EffectAutonomize:
|
||||||
setstatchanger STAT_SPEED, 2, FALSE
|
setstatchanger STAT_SPEED, 2, FALSE
|
||||||
|
@ -827,6 +827,7 @@ extern u16 gLastLandedMoves[MAX_BATTLERS_COUNT];
|
|||||||
extern u16 gLastHitByType[MAX_BATTLERS_COUNT];
|
extern u16 gLastHitByType[MAX_BATTLERS_COUNT];
|
||||||
extern u16 gLastResultingMoves[MAX_BATTLERS_COUNT];
|
extern u16 gLastResultingMoves[MAX_BATTLERS_COUNT];
|
||||||
extern u16 gLockedMoves[MAX_BATTLERS_COUNT];
|
extern u16 gLockedMoves[MAX_BATTLERS_COUNT];
|
||||||
|
extern u16 gLastUsedMove;
|
||||||
extern u8 gLastHitBy[MAX_BATTLERS_COUNT];
|
extern u8 gLastHitBy[MAX_BATTLERS_COUNT];
|
||||||
extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT];
|
extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT];
|
||||||
extern u16 gMoveResultFlags;
|
extern u16 gMoveResultFlags;
|
||||||
|
@ -305,5 +305,6 @@
|
|||||||
#define EFFECT_TECHNO_BLAST 299
|
#define EFFECT_TECHNO_BLAST 299
|
||||||
#define EFFECT_JUDGMENT 300
|
#define EFFECT_JUDGMENT 300
|
||||||
#define EFFECT_AUTONOMIZE 301
|
#define EFFECT_AUTONOMIZE 301
|
||||||
|
#define EFFECT_COPYCAT 302
|
||||||
|
|
||||||
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
|
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
|
||||||
|
@ -105,6 +105,7 @@
|
|||||||
#define VARIOUS_ARGUMENT_STATUS_EFFECT 53
|
#define VARIOUS_ARGUMENT_STATUS_EFFECT 53
|
||||||
#define VARIOUS_TRY_HIT_SWITCH_TARGET 54
|
#define VARIOUS_TRY_HIT_SWITCH_TARGET 54
|
||||||
#define VARIOUS_TRY_AUTONOMIZE 55
|
#define VARIOUS_TRY_AUTONOMIZE 55
|
||||||
|
#define VARIOUS_TRY_COPYCAT 56
|
||||||
|
|
||||||
// atk80, dmg manipulation
|
// atk80, dmg manipulation
|
||||||
#define ATK80_DMG_CHANGE_SIGN 0
|
#define ATK80_DMG_CHANGE_SIGN 0
|
||||||
|
@ -246,6 +246,7 @@ EWRAM_DATA u16 gLastLandedMoves[MAX_BATTLERS_COUNT] = {0};
|
|||||||
EWRAM_DATA u16 gLastHitByType[MAX_BATTLERS_COUNT] = {0};
|
EWRAM_DATA u16 gLastHitByType[MAX_BATTLERS_COUNT] = {0};
|
||||||
EWRAM_DATA u16 gLastResultingMoves[MAX_BATTLERS_COUNT] = {0};
|
EWRAM_DATA u16 gLastResultingMoves[MAX_BATTLERS_COUNT] = {0};
|
||||||
EWRAM_DATA u16 gLockedMoves[MAX_BATTLERS_COUNT] = {0};
|
EWRAM_DATA u16 gLockedMoves[MAX_BATTLERS_COUNT] = {0};
|
||||||
|
EWRAM_DATA u16 gLastUsedMove = 0;
|
||||||
EWRAM_DATA u8 gLastHitBy[MAX_BATTLERS_COUNT] = {0};
|
EWRAM_DATA u8 gLastHitBy[MAX_BATTLERS_COUNT] = {0};
|
||||||
EWRAM_DATA u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT] = {0};
|
EWRAM_DATA u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT] = {0};
|
||||||
EWRAM_DATA u16 gMoveResultFlags = 0;
|
EWRAM_DATA u16 gMoveResultFlags = 0;
|
||||||
@ -3009,6 +3010,7 @@ static void BattleStartClearSetData(void)
|
|||||||
gPalaceSelectionBattleScripts[i] = 0;
|
gPalaceSelectionBattleScripts[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gLastUsedMove = 0;
|
||||||
gFieldStatuses = 0;
|
gFieldStatuses = 0;
|
||||||
memset(&gFieldTimers, 0, sizeof(gFieldTimers));
|
memset(&gFieldTimers, 0, sizeof(gFieldTimers));
|
||||||
|
|
||||||
|
@ -785,9 +785,11 @@ static const u16 sProtectSuccessRates[] = {USHRT_MAX, USHRT_MAX / 2, USHRT_MAX /
|
|||||||
#define MIMIC_FORBIDDEN_END 0xFFFE
|
#define MIMIC_FORBIDDEN_END 0xFFFE
|
||||||
#define METRONOME_FORBIDDEN_END 0xFFFF
|
#define METRONOME_FORBIDDEN_END 0xFFFF
|
||||||
#define ASSIST_FORBIDDEN_END 0xFFFF
|
#define ASSIST_FORBIDDEN_END 0xFFFF
|
||||||
|
#define COPYCAT_FORBIDDEN_END 0xFFFF
|
||||||
|
|
||||||
static const u16 sMovesForbiddenToCopy[] =
|
static const u16 sMovesForbiddenToCopy[] =
|
||||||
{
|
{
|
||||||
|
MOVE_TRANSFORM,
|
||||||
MOVE_METRONOME,
|
MOVE_METRONOME,
|
||||||
MOVE_STRUGGLE,
|
MOVE_STRUGGLE,
|
||||||
MOVE_SKETCH,
|
MOVE_SKETCH,
|
||||||
@ -807,6 +809,15 @@ static const u16 sMovesForbiddenToCopy[] =
|
|||||||
MOVE_COVET,
|
MOVE_COVET,
|
||||||
MOVE_TRICK,
|
MOVE_TRICK,
|
||||||
MOVE_FOCUS_PUNCH,
|
MOVE_FOCUS_PUNCH,
|
||||||
|
MOVE_CIRCLE_THROW,
|
||||||
|
MOVE_DRAGON_TAIL,
|
||||||
|
MOVE_RAGE_POWDER,
|
||||||
|
MOVE_MAT_BLOCK,
|
||||||
|
MOVE_SPIKY_SHIELD,
|
||||||
|
MOVE_SHELL_TRAP,
|
||||||
|
MOVE_SPOTLIGHT,
|
||||||
|
MOVE_FEINT,
|
||||||
|
MOVE_KING_S_SHIELD,
|
||||||
METRONOME_FORBIDDEN_END
|
METRONOME_FORBIDDEN_END
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4241,6 +4252,7 @@ static void atk49_moveend(void)
|
|||||||
if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED)
|
if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED)
|
||||||
{
|
{
|
||||||
gLastPrintedMoves[gBattlerAttacker] = gChosenMove;
|
gLastPrintedMoves[gBattlerAttacker] = gChosenMove;
|
||||||
|
gLastUsedMove = gCurrentMove;
|
||||||
}
|
}
|
||||||
if (!(gAbsentBattlerFlags & gBitTable[gBattlerAttacker])
|
if (!(gAbsentBattlerFlags & gBitTable[gBattlerAttacker])
|
||||||
&& !(gBattleStruct->field_91 & gBitTable[gBattlerAttacker])
|
&& !(gBattleStruct->field_91 & gBitTable[gBattlerAttacker])
|
||||||
@ -6746,6 +6758,24 @@ static void atk76_various(void)
|
|||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
case VARIOUS_TRY_COPYCAT:
|
||||||
|
for (i = 0; sMovesForbiddenToCopy[i] != COPYCAT_FORBIDDEN_END; i++)
|
||||||
|
{
|
||||||
|
if (sMovesForbiddenToCopy[i] == gLastUsedMove)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (gLastUsedMove == 0 || gLastUsedMove == 0xFFFF || sMovesForbiddenToCopy[i] != COPYCAT_FORBIDDEN_END)
|
||||||
|
{
|
||||||
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gRandomMove = gLastUsedMove;
|
||||||
|
gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED);
|
||||||
|
gBattlerTarget = GetMoveTarget(gRandomMove, 0);
|
||||||
|
gBattlescriptCurrInstr += 7;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBattlescriptCurrInstr += 3;
|
gBattlescriptCurrInstr += 3;
|
||||||
|
@ -4601,7 +4601,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
|
|||||||
.split = SPLIT_STATUS,
|
.split = SPLIT_STATUS,
|
||||||
},
|
},
|
||||||
{ // MOVE_COPYCAT
|
{ // MOVE_COPYCAT
|
||||||
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
|
.effect = EFFECT_COPYCAT,
|
||||||
.power = 0,
|
.power = 0,
|
||||||
.type = TYPE_NORMAL,
|
.type = TYPE_NORMAL,
|
||||||
.accuracy = 0,
|
.accuracy = 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user