From 194139a35b665592d92ea0d0e6bab26493ae7f5c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 24 Nov 2018 19:37:10 +0100 Subject: [PATCH] Add Move Effect - Feint --- data/battle_scripts_1.s | 10 ++++++++++ .../scripts.inc | 10 +++++----- include/battle_scripts.h | 1 + include/constants/battle.h | 2 +- include/constants/battle_move_effects.h | 1 + include/constants/battle_string_ids.h | 3 ++- src/battle_message.c | 2 ++ src/battle_script_commands.c | 20 +++++++++++++++++++ src/data/battle_moves.h | 4 ++-- 9 files changed, 44 insertions(+), 9 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 3a4df269d7..a7d105b4e6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -335,6 +335,16 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectRevelationDance .4byte BattleScript_EffectAuroraVeil .4byte BattleScript_EffectThirdType + .4byte BattleScript_EffectFeint + +BattleScript_MoveEffectFeint:: + printstring STRINGID_FELLFORFEINT + waitmessage 0x40 + return + +BattleScript_EffectFeint: + setmoveeffect MOVE_EFFECT_FEINT + goto BattleScript_EffectHit BattleScript_EffectThirdType: attackcanceler diff --git a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc index 76cf301d64..32c4c038b3 100644 --- a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc +++ b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc @@ -49,13 +49,13 @@ EverGrandeCity_PokemonLeague_1F_Pokemart_229624: @ 8229624 EverGrandeCity_PokemonLeague_1F_EventScript_229636:: @ 8229636 special SavePlayerParty - trainerbattle 10, 264, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF - trainerbattle 11, 263, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF + trainerbattle 10, TRAINER_DRAKE, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF + trainerbattle 11, TRAINER_GLACIA, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF - setvar VAR_0x8004, 11 + setvar VAR_0x8004, SPECIAL_BATTLE_MULTI setvar VAR_0x8005, 0 - setvar VAR_0x8006, 404 - setvar VAR_0x8007, 3 + setvar VAR_0x8006, TRAINER_EDWARDO + setvar VAR_0x8007, TRAINER_BACK_PIC_LEAF special DoSpecialTrainerBattle waitstate diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 63aaab13e0..1a3ef5ed78 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -282,5 +282,6 @@ extern const u8 BattleScript_MoveEffectSmackDown[]; extern const u8 BattleScript_MoveEffectFlameBurst[]; extern const u8 BattleScript_TrainerSlideMsgRet[]; extern const u8 BattleScript_TrainerSlideMsgEnd2[]; +extern const u8 BattleScript_MoveEffectFeint[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle.h b/include/constants/battle.h index 5448b1ab8a..d61e040fd2 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -319,7 +319,7 @@ #define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x3B #define MOVE_EFFECT_SMACK_DOWN 0x3C #define MOVE_EFFECT_FLAME_BURST 0x3D -#define MOVE_EFFECT_NOTHING_3E 0x3E +#define MOVE_EFFECT_FEINT 0x3E #define MOVE_EFFECT_NOTHING_3F 0x3F #define MOVE_EFFECT_AFFECTS_USER 0x40 #define MOVE_EFFECT_CERTAIN 0x80 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 6b956aed7d..d3c569a1eb 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -323,5 +323,6 @@ #define EFFECT_REVELATION_DANCE 317 #define EFFECT_AURORA_VEIL 318 #define EFFECT_THIRD_TYPE 319 +#define EFFECT_FEINT 320 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 3205a30372..214591ed96 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -512,7 +512,8 @@ #define STRINGID_BURSTINGFLAMESHIT 508 #define STRINGID_BESTOWITEMGIVING 509 #define STRINGID_THIRDTYPEADDED 510 +#define STRINGID_FELLFORFEINT 511 -#define BATTLESTRINGS_COUNT 521 +#define BATTLESTRINGS_COUNT 525 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_message.c b/src/battle_message.c index ee47ad46f8..dcd7601cbf 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -649,6 +649,7 @@ static const u8 sText_NoEffectOnTarget[] = _("It had no effect\non {B_DEF_NAME_W static const u8 sText_BurstingFlames[] = _("The bursting flames\nhit {B_SCR_ACTIVE_NAME_WITH_PREFIX}!"); static const u8 sText_BestowItemGiving[] = _("{B_DEF_NAME_WITH_PREFIX} received {B_LAST_ITEM}\nfrom {B_ATK_NAME_WITH_PREFIX}!"); static const u8 sText_ThirdTypeAdded[] = _("{B_BUFF1} type was added to\n{B_DEF_NAME_WITH_PREFIX}!"); +static const u8 sText_FellForFeint[] = _("{B_DEF_NAME_WITH_PREFIX} fell for\nthe feint!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { @@ -1152,6 +1153,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = sText_BurstingFlames, sText_BestowItemGiving, sText_ThirdTypeAdded, + sText_FellForFeint, }; const u16 gTerrainStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7d856dae6e..d5180cb0b0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -926,6 +926,8 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move) { if (!(gBattleMoves[move].flags & FLAG_PROTECT_AFFECTED)) return FALSE; + else if (gBattleMoves[move].effect == MOVE_EFFECT_FEINT) + return FALSE; else if (gProtectStructs[battlerId].protected) return TRUE; else if ((gProtectStructs[battlerId].wideGuarded || gProtectStructs[BATTLE_PARTNER(battlerId)].wideGuarded) @@ -2733,6 +2735,24 @@ void SetMoveEffect(bool8 primary, u8 certain) gBattlescriptCurrInstr = BattleScript_MoveEffectFlameBurst; } break; + case MOVE_EFFECT_FEINT: + if (gProtectStructs[gBattlerTarget].protected + || gProtectStructs[gBattlerTarget].wideGuarded + || gProtectStructs[gBattlerTarget].quickGuarded + || gProtectStructs[gBattlerTarget].spikyShielded + || gProtectStructs[gBattlerTarget].kingsShielded + || gProtectStructs[gBattlerTarget].banefulBunkered) + { + gProtectStructs[gBattlerTarget].protected = 0; + gProtectStructs[gBattlerTarget].wideGuarded = 0; + gProtectStructs[gBattlerTarget].quickGuarded = 0; + gProtectStructs[gBattlerTarget].spikyShielded = 0; + gProtectStructs[gBattlerTarget].kingsShielded = 0; + gProtectStructs[gBattlerTarget].banefulBunkered = 0; + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_MoveEffectFeint; + } + break; } } } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index a00ac461ed..7038e30727 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -4374,12 +4374,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .split = SPLIT_PHYSICAL, }, { // MOVE_FEINT - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_FEINT, .power = 30, .type = TYPE_NORMAL, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 2, .flags = FLAG_MIRROR_MOVE_AFFECTED,