mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 04:04:17 +01:00
Add Magic Bounce
This commit is contained in:
parent
a452661cb9
commit
43fc4b6933
@ -4163,7 +4163,7 @@ BattleScript_MagicCoatBounce::
|
||||
attackstring
|
||||
ppreduce
|
||||
pause 0x20
|
||||
printstring STRINGID_PKMNMOVEBOUNCED
|
||||
printfromtable gMagicCoatBounceStringIds
|
||||
waitmessage 0x40
|
||||
orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_x800000
|
||||
setmagiccoattarget BS_ATTACKER
|
||||
|
@ -209,8 +209,7 @@ struct ProtectStruct
|
||||
u32 flag_x20:1; // 0x20
|
||||
u32 flag_x40:1; // 0x40
|
||||
u32 flag_x80:1; // 0x80
|
||||
/* field_3 */
|
||||
u32 field3:8;
|
||||
u32 usesBouncedMove:1;
|
||||
|
||||
/* field_4 */ u32 physicalDmg;
|
||||
/* field_8 */ u32 specialDmg;
|
||||
|
@ -484,6 +484,7 @@
|
||||
#define STRINGID_ATTACKERACQUIREDABILITY 481
|
||||
#define STRINGID_TARGETABILITYSTATLOWER 482
|
||||
#define STRINGID_TARGETSTATWONTGOHIGHER 483
|
||||
#define STRINGID_PKMNMOVEBOUNCEDABILITY 484
|
||||
|
||||
#define BATTLESTRINGS_COUNT 496
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "international_string_util.h"
|
||||
#include "pokeball.h"
|
||||
#include "party_menu.h"
|
||||
#include "constants\battle_config.h"
|
||||
#include "constants/battle_config.h"
|
||||
|
||||
struct UnknownPokemonStruct4
|
||||
{
|
||||
|
@ -625,6 +625,7 @@ static const u8 sText_LunarDanceCameTrue[] = _("{B_ATK_NAME_WITH_PREFIX} became
|
||||
static const u8 sText_CursedBodyDisabled[] = _("{B_ATK_NAME_WITH_PREFIX}’s {B_BUFF1} was disabled\nby {B_DEF_NAME_WITH_PREFIX}’s {B_DEF_ABILITY}!");
|
||||
static const u8 sText_AttackerAquiredAbility[] = _("{B_ATK_NAME_WITH_PREFIX} acquired {B_LAST_ABILITY}!");
|
||||
static const u8 sText_TargetStatWontGoHigher[] = _("{B_DEF_NAME_WITH_PREFIX}’s {B_BUFF1}\nwon’t go higher!");
|
||||
static const u8 sText_PkmnMoveBouncedViaAbility[] = _("{B_ATK_NAME_WITH_PREFIX}’s {B_CURRENT_MOVE} was\nbounced back by {B_DEF_NAME_WITH_PREFIX}’s\l{B_DEF_ABILITY}!");
|
||||
|
||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
{
|
||||
@ -1101,6 +1102,12 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
sText_AttackerAquiredAbility,
|
||||
sText_TargetAbilityLoweredStat,
|
||||
sText_TargetStatWontGoHigher,
|
||||
sText_PkmnMoveBouncedViaAbility,
|
||||
};
|
||||
|
||||
const u16 gMagicCoatBounceStringIds[] =
|
||||
{
|
||||
STRINGID_PKMNMOVEBOUNCED, STRINGID_PKMNMOVEBOUNCEDABILITY
|
||||
};
|
||||
|
||||
const u16 gHealingWishStringIds[] =
|
||||
|
@ -968,10 +968,25 @@ static void atk00_attackcanceler(void)
|
||||
|
||||
gHitMarker |= HITMARKER_OBEYS;
|
||||
|
||||
if (gProtectStructs[gBattlerTarget].bounceMove && gBattleMoves[gCurrentMove].flags & FLAG_MAGICCOAT_AFFECTED)
|
||||
if (gProtectStructs[gBattlerTarget].bounceMove
|
||||
&& gBattleMoves[gCurrentMove].flags & FLAG_MAGICCOAT_AFFECTED
|
||||
&& !gProtectStructs[gBattlerAttacker].usesBouncedMove)
|
||||
{
|
||||
PressurePPLose(gBattlerAttacker, gBattlerTarget, MOVE_MAGIC_COAT);
|
||||
gProtectStructs[gBattlerTarget].bounceMove = 0;
|
||||
gProtectStructs[gBattlerTarget].usesBouncedMove = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MagicCoatBounce;
|
||||
return;
|
||||
}
|
||||
else if (GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE
|
||||
&& gBattleMoves[gCurrentMove].flags & FLAG_MAGICCOAT_AFFECTED
|
||||
&& !gProtectStructs[gBattlerAttacker].usesBouncedMove)
|
||||
{
|
||||
RecordAbilityBattle(gBattlerTarget, ABILITY_MAGIC_BOUNCE);
|
||||
gProtectStructs[gBattlerTarget].usesBouncedMove = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MagicCoatBounce;
|
||||
return;
|
||||
@ -4031,7 +4046,7 @@ static void atk48_playstatchangeanimation(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define ATK49_LAST_CASE 17
|
||||
#define ATK49_LAST_CASE 18
|
||||
|
||||
static void atk49_moveend(void)
|
||||
{
|
||||
@ -4307,6 +4322,10 @@ static void atk49_moveend(void)
|
||||
}
|
||||
gBattleScripting.atk49_state++;
|
||||
break;
|
||||
case 17: // Clear bits active just while using a move.
|
||||
gProtectStructs[gBattlerAttacker].usesBouncedMove = 0;
|
||||
gBattleScripting.atk49_state++;
|
||||
break;
|
||||
case ATK49_LAST_CASE:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user