Me First.

This commit is contained in:
DizzyEggg 2018-08-05 16:43:07 +02:00
parent de85f88bbb
commit d230d986fa
6 changed files with 51 additions and 1 deletions

View File

@ -1449,6 +1449,11 @@
.4byte \ptr
.endm
.macro trymefirst ptr
various BS_ATTACKER, VARIOUS_TRY_ME_FIRST
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat, stages, down
setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7

View File

@ -290,6 +290,17 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectAttackSpAttackUp
.4byte BattleScript_EffectHurricane
.4byte BattleScript_EffectTwoTypedMove
.4byte BattleScript_EffectMeFirst
BattleScript_EffectMeFirst:
attackcanceler
attackstring
trymefirst BattleScript_ButItFailedPpReduce
attackanimation
waitanimation
setbyte sB_ANIM_TURN, 0x0
setbyte sB_ANIM_TARGETS_HIT, 0x0
jumptorandomattack TRUE
BattleScript_EffectAttackSpAttackUp:
attackcanceler

View File

@ -279,5 +279,6 @@
#define EFFECT_ATTACK_SPATK_UP 273
#define EFFECT_HURRICANE 274
#define EFFECT_TWO_TYPED_MOVE 275
#define EFFECT_ME_FIRST 276
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -92,6 +92,7 @@
#define VARIOUS_TRY_QUASH 43
#define VARIOUS_INVERT_STAT_STAGES 44
#define VARIOUS_SET_TERRAIN 45
#define VARIOUS_TRY_ME_FIRST 46
// atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0

View File

@ -4588,7 +4588,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
.split = SPLIT_STATUS,
},
{ // MOVE_ME_FIRST
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_ME_FIRST,
.power = 0,
.type = TYPE_NORMAL,
.accuracy = 0,

View File

@ -4265,6 +4265,7 @@ static void atk49_moveend(void)
case 17: // Clear bits active just while using a move.
gProtectStructs[gBattlerAttacker].usesBouncedMove = 0;
gBattleStruct->ateBoost[gBattlerAttacker] = 0;
gStatuses3[gBattlerAttacker] &= ~(STATUS3_ME_FIRST);
gBattleScripting.atk49_state++;
break;
case ATK49_LAST_CASE:
@ -6480,6 +6481,37 @@ static void atk76_various(void)
case VARIOUS_SET_TERRAIN:
HandleTerrainMove(gBattleMoves[gCurrentMove].effect);
return;
case VARIOUS_TRY_ME_FIRST:
if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else if (gBattleMoves[gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]]].power == 0)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else
{
u16 move = gBattleMons[gBattlerTarget].moves[gBattleStruct->chosenMovePositions[gBattlerTarget]];
switch (move)
{
case MOVE_STRUGGLE:
case MOVE_CHATTER:
case MOVE_FOCUS_PUNCH:
case MOVE_THIEF:
case MOVE_COVET:
case MOVE_COUNTER:
case MOVE_MIRROR_COAT:
case MOVE_METAL_BURST:
case MOVE_ME_FIRST:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
break;
default:
gRandomMove = move;
gHitMarker &= ~(HITMARKER_ATTACKSTRING_PRINTED);
gBattlerTarget = GetMoveTarget(gRandomMove, 0);
gStatuses3[gBattlerAttacker] |= STATUS3_ME_FIRST;
gBattlescriptCurrInstr += 7;
break;
}
}
return;
}
gBattlescriptCurrInstr += 3;