Fixes recoil moves not triggering berries if possible (#5449)
* Fixes recoil moves not triggering berries if possible * Update battle_script_commands.h
This commit is contained in:
parent
1c022f4d34
commit
b93e58266e
3 changed files with 86 additions and 41 deletions
|
@ -273,46 +273,50 @@
|
||||||
#define PARTY_SCREEN_OPTIONAL (1 << 7) // Flag for first argument to openpartyscreen
|
#define PARTY_SCREEN_OPTIONAL (1 << 7) // Flag for first argument to openpartyscreen
|
||||||
|
|
||||||
// cases for Cmd_moveend
|
// cases for Cmd_moveend
|
||||||
#define MOVEEND_SUM_DAMAGE 0
|
enum MoveEndEffects
|
||||||
#define MOVEEND_PROTECT_LIKE_EFFECT 1
|
{
|
||||||
#define MOVEEND_RAGE 2
|
MOVEEND_SUM_DAMAGE,
|
||||||
#define MOVEEND_SYNCHRONIZE_TARGET 3
|
MOVEEND_PROTECT_LIKE_EFFECT,
|
||||||
#define MOVEEND_ABILITIES 4
|
MOVEEND_RAGE,
|
||||||
#define MOVEEND_ABILITIES_ATTACKER 5
|
MOVEEND_SYNCHRONIZE_TARGET,
|
||||||
#define MOVEEND_STATUS_IMMUNITY_ABILITIES 6
|
MOVEEND_ABILITIES,
|
||||||
#define MOVEEND_SYNCHRONIZE_ATTACKER 7
|
MOVEEND_ABILITIES_ATTACKER,
|
||||||
#define MOVEEND_CHOICE_MOVE 8
|
MOVEEND_STATUS_IMMUNITY_ABILITIES,
|
||||||
#define MOVEEND_ATTACKER_INVISIBLE 9
|
MOVEEND_SYNCHRONIZE_ATTACKER,
|
||||||
#define MOVEEND_ATTACKER_VISIBLE 10
|
MOVEEND_CHOICE_MOVE,
|
||||||
#define MOVEEND_TARGET_VISIBLE 11
|
MOVEEND_ATTACKER_INVISIBLE,
|
||||||
#define MOVEEND_ITEM_EFFECTS_TARGET 12
|
MOVEEND_ATTACKER_VISIBLE,
|
||||||
#define MOVEEND_MOVE_EFFECTS2 13
|
MOVEEND_TARGET_VISIBLE,
|
||||||
#define MOVEEND_ITEM_EFFECTS_ALL 14
|
MOVEEND_ITEM_EFFECTS_TARGET,
|
||||||
#define MOVEEND_KINGSROCK 15 // These item effects will occur each strike of a multi-hit move
|
MOVEEND_MOVE_EFFECTS2,
|
||||||
#define MOVEEND_NUM_HITS 16
|
MOVEEND_ITEM_EFFECTS_ALL,
|
||||||
#define MOVEEND_SUBSTITUTE 17
|
MOVEEND_KINGSROCK, // These item effects will occur each strike of a multi-hit move
|
||||||
#define MOVEEND_SKY_DROP_CONFUSE 18
|
MOVEEND_NUM_HITS,
|
||||||
#define MOVEEND_UPDATE_LAST_MOVES 19
|
MOVEEND_SUBSTITUTE,
|
||||||
#define MOVEEND_MIRROR_MOVE 20
|
MOVEEND_SKY_DROP_CONFUSE,
|
||||||
#define MOVEEND_NEXT_TARGET 21 // Everything up until here is handled for each strike of a multi-hit move
|
MOVEEND_UPDATE_LAST_MOVES,
|
||||||
#define MOVEEND_MULTIHIT_MOVE 22
|
MOVEEND_MIRROR_MOVE,
|
||||||
#define MOVEEND_DEFROST 23
|
MOVEEND_NEXT_TARGET, // Everything up until here is handled for each strike of a multi-hit move
|
||||||
#define MOVEEND_RECOIL 24
|
MOVEEND_MULTIHIT_MOVE,
|
||||||
#define MOVEEND_MAGICIAN 25 // Occurs after final multi-hit strike, and after other items/abilities would activate
|
MOVEEND_DEFROST,
|
||||||
#define MOVEEND_EJECT_ITEMS 26
|
MOVEEND_RECOIL,
|
||||||
#define MOVEEND_WHITE_HERB 27
|
MOVEEND_ITEM_EFFECTS_ATTACKER,
|
||||||
#define MOVEEND_RED_CARD 28
|
MOVEEND_MAGICIAN, // Occurs after final multi-hit strike, and after other items/abilities would activate
|
||||||
#define MOVEEND_LIFEORB_SHELLBELL 29 // Includes shell bell, throat spray, etc
|
MOVEEND_EJECT_ITEMS,
|
||||||
#define MOVEEND_CHANGED_ITEMS 30
|
MOVEEND_WHITE_HERB,
|
||||||
#define MOVEEND_PICKPOCKET 31
|
MOVEEND_RED_CARD,
|
||||||
#define MOVEEND_DANCER 32
|
MOVEEND_LIFEORB_SHELLBELL, // Includes shell bell, throat spray, etc
|
||||||
#define MOVEEND_EMERGENCY_EXIT 33
|
MOVEEND_CHANGED_ITEMS,
|
||||||
#define MOVEEND_SYMBIOSIS 34
|
MOVEEND_PICKPOCKET,
|
||||||
#define MOVEEND_OPPORTUNIST 35 // Occurs after other stat change items/abilities to try and copy the boosts
|
MOVEEND_DANCER,
|
||||||
#define MOVEEND_SAME_MOVE_TURNS 36
|
MOVEEND_EMERGENCY_EXIT,
|
||||||
#define MOVEEND_SET_EVOLUTION_TRACKER 37
|
MOVEEND_SYMBIOSIS,
|
||||||
#define MOVEEND_CLEAR_BITS 38
|
MOVEEND_OPPORTUNIST, // Occurs after other stat change items/abilities to try and copy the boosts
|
||||||
#define MOVEEND_COUNT 39
|
MOVEEND_SAME_MOVE_TURNS,
|
||||||
|
MOVEEND_SET_EVOLUTION_TRACKER,
|
||||||
|
MOVEEND_CLEAR_BITS,
|
||||||
|
MOVEEND_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
// switch cases
|
// switch cases
|
||||||
#define B_SWITCH_NORMAL 0
|
#define B_SWITCH_NORMAL 0
|
||||||
|
|
|
@ -5614,6 +5614,11 @@ static void Cmd_moveend(void)
|
||||||
}
|
}
|
||||||
gBattleScripting.moveendState++;
|
gBattleScripting.moveendState++;
|
||||||
break;
|
break;
|
||||||
|
case MOVEEND_ITEM_EFFECTS_ATTACKER:
|
||||||
|
if (ItemBattleEffects(ITEMEFFECT_MOVE_END, gBattlerAttacker, FALSE))
|
||||||
|
effect = TRUE;
|
||||||
|
gBattleScripting.moveendState++;
|
||||||
|
break;
|
||||||
case MOVEEND_SYNCHRONIZE_TARGET: // target synchronize
|
case MOVEEND_SYNCHRONIZE_TARGET: // target synchronize
|
||||||
if (AbilityBattleEffects(ABILITYEFFECT_SYNCHRONIZE, gBattlerTarget, 0, 0, 0))
|
if (AbilityBattleEffects(ABILITYEFFECT_SYNCHRONIZE, gBattlerTarget, 0, 0, 0))
|
||||||
effect = TRUE;
|
effect = TRUE;
|
||||||
|
@ -11570,7 +11575,7 @@ static void Cmd_stockpiletohpheal(void)
|
||||||
if (gBattleMoveDamage == 0)
|
if (gBattleMoveDamage == 0)
|
||||||
gBattleMoveDamage = 1;
|
gBattleMoveDamage = 1;
|
||||||
gBattleMoveDamage *= -1;
|
gBattleMoveDamage *= -1;
|
||||||
|
|
||||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||||
gBattlerTarget = gBattlerAttacker;
|
gBattlerTarget = gBattlerAttacker;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,3 +27,39 @@ DOUBLE_BATTLE_TEST("Restore HP Item effects do not miss timing")
|
||||||
MESSAGE("The opposing Foe Wobbuffet was hurt by the sea of fire!");
|
MESSAGE("The opposing Foe Wobbuffet was hurt by the sea of fire!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DOUBLE_BATTLE_TEST("Restore HP Item effects do not miss timing after a recoil move")
|
||||||
|
{
|
||||||
|
u16 item;
|
||||||
|
|
||||||
|
PARAMETRIZE { item = ITEM_BERRY_JUICE; }
|
||||||
|
PARAMETRIZE { item = ITEM_ORAN_BERRY; }
|
||||||
|
PARAMETRIZE { item = ITEM_SITRUS_BERRY; }
|
||||||
|
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(gMovesInfo[MOVE_TAKE_DOWN].recoil == 25);
|
||||||
|
ASSUME(gItemsInfo[ITEM_ORAN_BERRY].holdEffect == HOLD_EFFECT_RESTORE_HP);
|
||||||
|
ASSUME(gItemsInfo[ITEM_BERRY_JUICE].holdEffect == HOLD_EFFECT_RESTORE_HP);
|
||||||
|
ASSUME(gItemsInfo[ITEM_SITRUS_BERRY].holdEffect == HOLD_EFFECT_RESTORE_PCT_HP);
|
||||||
|
PLAYER(SPECIES_WOBBUFFET);
|
||||||
|
PLAYER(SPECIES_WOBBUFFET);
|
||||||
|
OPPONENT(SPECIES_WYNAUT) { MaxHP(100); HP(51); Item(item); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN {
|
||||||
|
MOVE(opponentLeft, MOVE_TAKE_DOWN, target: playerLeft);
|
||||||
|
MOVE(opponentRight, MOVE_CELEBRATE);
|
||||||
|
MOVE(playerLeft, MOVE_CELEBRATE);
|
||||||
|
MOVE(playerRight, MOVE_CELEBRATE);
|
||||||
|
}
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TAKE_DOWN, opponentLeft);
|
||||||
|
HP_BAR(playerLeft);
|
||||||
|
HP_BAR(opponentLeft);
|
||||||
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponentLeft);
|
||||||
|
HP_BAR(opponentLeft);
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponentRight);
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, playerLeft);
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, playerRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue