From b60915539d2d4f19c8f65c0732971c62628d17c6 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 8 Dec 2018 16:19:50 +0100 Subject: [PATCH] Fix Phantom Force --- data/battle_anim_scripts.s | 8 ++++++++ data/battle_scripts_1.s | 11 ++++++----- include/battle.h | 1 + include/constants/battle.h | 4 ++-- src/battle_debug.c | 8 +++----- src/battle_main.c | 2 +- src/battle_message.c | 4 ++-- src/battle_script_commands.c | 36 +++++++++++++++++------------------- src/data/battle_moves.h | 4 +++- 9 files changed, 43 insertions(+), 35 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 491277060..cc73938d8 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1893,7 +1893,15 @@ Move_FELL_STINGER: end Move_PHANTOM_FORCE: + choosetwoturnanim PhantomForceSetUp, PhantomForceUnleash +PhantomForceEnd: end +PhantomForceSetUp: + invisible ANIM_ATTACKER + goto PhantomForceEnd +PhantomForceUnleash: + visible ANIM_ATTACKER + goto PhantomForceEnd Move_TRICK_OR_TREAT: end diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ac9cd6cb0..a05302cc8 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3495,17 +3495,19 @@ BattleScript_EffectSemiInvulnerable:: jumpifmove MOVE_FLY, BattleScript_FirstTurnFly jumpifmove MOVE_DIVE, BattleScript_FirstTurnDive jumpifmove MOVE_BOUNCE, BattleScript_FirstTurnBounce + jumpifmove MOVE_PHANTOM_FORCE, BattleScript_FirstTurnPhantomForce + jumpifmove MOVE_SHADOW_FORCE, BattleScript_FirstTurnPhantomForce setbyte sTWOTURN_STRINGID, 0x5 goto BattleScript_FirstTurnSemiInvulnerable - BattleScript_FirstTurnBounce:: setbyte sTWOTURN_STRINGID, 0x7 goto BattleScript_FirstTurnSemiInvulnerable - BattleScript_FirstTurnDive:: setbyte sTWOTURN_STRINGID, 0x6 goto BattleScript_FirstTurnSemiInvulnerable - +BattleScript_FirstTurnPhantomForce: + setbyte sTWOTURN_STRINGID, 0x8 + goto BattleScript_FirstTurnSemiInvulnerable BattleScript_FirstTurnFly:: setbyte sTWOTURN_STRINGID, 0x4 BattleScript_FirstTurnSemiInvulnerable:: @@ -3519,8 +3521,7 @@ BattleScript_SecondTurnSemiInvulnerable:: setbyte sB_ANIM_TURN, 0x1 clearstatusfromeffect BS_ATTACKER orword gHitMarker, HITMARKER_NO_PPDEDUCT - jumpifnotmove MOVE_BOUNCE, BattleScript_SemiInvulnerableTryHit - setmoveeffect MOVE_EFFECT_PARALYSIS + argumenttomoveeffect BattleScript_SemiInvulnerableTryHit:: accuracycheck BattleScript_SemiInvulnerableMiss, ACC_CURR_MOVE clearsemiinvulnerablebit diff --git a/include/battle.h b/include/battle.h index 7d84043df..4c4af3d19 100644 --- a/include/battle.h +++ b/include/battle.h @@ -129,6 +129,7 @@ struct UnknownFlags #define RESOURCE_FLAG_FLASH_FIRE 0x1 #define RESOURCE_FLAG_ROOST 0x2 +#define RESOURCE_FLAG_UNBURDEN 0x4 struct DisableStruct { diff --git a/include/constants/battle.h b/include/constants/battle.h index b801f90a1..22f7be7c6 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -154,7 +154,7 @@ #define STATUS3_SMACKED_DOWN 0x200000 #define STATUS3_ME_FIRST 0x400000 #define STATUS3_TELEKINESIS 0x800000 -#define STATUS3_UNBURDEN 0x1000000 +#define STATUS3_PHANTOM_FORCE 0x1000000 #define STATUS3_MIRACLE_EYED 0x2000000 #define STATUS3_MAGNET_RISE 0x4000000 #define STATUS3_HEAL_BLOCK 0x8000000 @@ -162,7 +162,7 @@ #define STATUS3_LASER_FOCUS 0x20000000 #define STATUS3_ELECTRIFIED 0x40000000 #define STATUS3_POWER_TRICK 0x80000000 -#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER) +#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER | STATUS3_PHANTOM_FORCE) // Not really sure what a "hitmarker" is. #define HITMARKER_x10 0x00000010 diff --git a/src/battle_debug.c b/src/battle_debug.c index d7e5cd393..d1c256802 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -182,7 +182,6 @@ static const u8 sText_ShowOpponentHP[] = _("Opponent Hp"); static const u8 sText_Types[] = _("Types"); static const u8 sText_GastroAcid[] = _("Gastro Acid"); static const u8 sText_SmackDown[] = _("Smacked Down"); -static const u8 sText_Unburden[] = _("Unburden"); static const u8 sText_MiracleEye[] = _("Miracle Eye"); static const u8 sText_AquaRing[] = _("Aqua Ring"); static const u8 sText_AuroraVeil[] = _("Aurora Veil"); @@ -265,7 +264,7 @@ static const struct BitfieldInfo sStatus3Bitfield[] = {/*Smacked Down*/ 1, 21}, // Me First 1, 22, // Telekinesis 1, 23, - {/*Unburden*/ 1, 24}, + // Phantom Force 1, 24}, {/*Miracle Eyed*/ 1, 25}, // Magnet Rise 1, 26, // Heal Block 1, 27, @@ -379,9 +378,8 @@ static const struct ListMenuItem sStatus3ListItems[] = {sText_NoCrit, 6}, {sText_GastroAcid, 7}, {sText_SmackDown, 8}, - {sText_Unburden, 9}, - {sText_MiracleEye, 10}, - {sText_AquaRing, 11}, + {sText_MiracleEye, 9}, + {sText_AquaRing, 10}, }; static const struct ListMenuItem sSideStatusListItems[] = diff --git a/src/battle_main.c b/src/battle_main.c index 585713b50..96280c24b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4714,7 +4714,7 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId) // various effects if (gSideStatuses[GET_BATTLER_SIDE(battlerId)] & SIDE_STATUS_TAILWIND) speed *= 2; - if (gStatuses3[battlerId] & STATUS3_UNBURDEN) + if (gBattleResources->flags->flags[battlerId] & RESOURCE_FLAG_UNBURDEN) speed *= 2; // paralysis drop diff --git a/src/battle_message.c b/src/battle_message.c index 42cc6aef1..b29583c93 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -550,7 +550,7 @@ static const u8 sText_PkmnTwistedDimensions[] = _("{B_ATK_NAME_WITH_PREFIX} twis static const u8 sText_PointedStonesFloat[] =_("Pointed stones float in the air\naround your foe's team!"); static const u8 sText_CloakedInMysticalMoonlight[] =_("It became cloaked in mystical\nmoonlight!"); static const u8 sText_TrappedBySwirlingMagma[] =_("{B_DEF_NAME_WITH_PREFIX} became\ntrapped by swirling magma!"); -static const u8 sText_VanishedInstantly[] =_("{B_ATK_NAME_WITH_PREFIX} Vanished\ninstantly!"); +static const u8 sText_VanishedInstantly[] =_("{B_ATK_NAME_WITH_PREFIX} vanished\ninstantly!"); static const u8 sText_ProtectedTeam[] =_("{B_CURRENT_MOVE} protected\nyour team!"); static const u8 sText_SharedItsGuard[] =_("{B_ATK_NAME_WITH_PREFIX} shared its\nguard with the target!"); static const u8 sText_SharedItsPower[] =_("{B_ATK_NAME_WITH_PREFIX} shared its\npower with the target!"); @@ -1287,7 +1287,7 @@ const u16 gStatDownStringIds[] = const u16 gFirstTurnOfTwoStringIds[] = { STRINGID_PKMNWHIPPEDWHIRLWIND, STRINGID_PKMNTOOKSUNLIGHT, STRINGID_PKMNLOWEREDHEAD, STRINGID_PKMNISGLOWING, - STRINGID_PKMNFLEWHIGH, STRINGID_PKMNDUGHOLE, STRINGID_PKMNHIDUNDERWATER, STRINGID_PKMNSPRANGUP + STRINGID_PKMNFLEWHIGH, STRINGID_PKMNDUGHOLE, STRINGID_PKMNHIDUNDERWATER, STRINGID_PKMNSPRANGUP, STRINGID_VANISHEDINSTANTLY }; const u16 gWrappedStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e003adaf7..145ea24a3 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1158,7 +1158,6 @@ static bool32 AccuracyCalcHelper(u16 move) JumpIfMoveFailed(7, move); return TRUE; } - gHitMarker &= ~HITMARKER_IGNORE_ON_AIR; if (!(gHitMarker & HITMARKER_IGNORE_UNDERGROUND) && gStatuses3[gBattlerTarget] & STATUS3_UNDERGROUND) @@ -1167,7 +1166,6 @@ static bool32 AccuracyCalcHelper(u16 move) JumpIfMoveFailed(7, move); return TRUE; } - gHitMarker &= ~HITMARKER_IGNORE_UNDERGROUND; if (!(gHitMarker & HITMARKER_IGNORE_UNDERWATER) && gStatuses3[gBattlerTarget] & STATUS3_UNDERWATER) @@ -1176,9 +1174,15 @@ static bool32 AccuracyCalcHelper(u16 move) JumpIfMoveFailed(7, move); return TRUE; } - gHitMarker &= ~HITMARKER_IGNORE_UNDERWATER; + if (gStatuses3[gBattlerTarget] & STATUS3_PHANTOM_FORCE) + { + gMoveResultFlags |= MOVE_RESULT_MISSED; + JumpIfMoveFailed(7, move); + return TRUE; + } + if ((WEATHER_HAS_EFFECT && (gBattleWeather & WEATHER_RAIN_ANY) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) || (gBattleMoves[move].accuracy == 0)) @@ -2767,8 +2771,11 @@ void SetMoveEffect(bool8 primary, u8 certain) gProtectStructs[gBattlerTarget].spikyShielded = 0; gProtectStructs[gBattlerTarget].kingsShielded = 0; gProtectStructs[gBattlerTarget].banefulBunkered = 0; - BattleScriptPush(gBattlescriptCurrInstr + 1); - gBattlescriptCurrInstr = BattleScript_MoveEffectFeint; + if (gCurrentMove == MOVE_FEINT) + { + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_MoveEffectFeint; + } } break; } @@ -9728,6 +9735,10 @@ static void atkC5_setsemiinvulnerablebit(void) case MOVE_DIVE: gStatuses3[gBattlerAttacker] |= STATUS3_UNDERWATER; break; + case MOVE_PHANTOM_FORCE: + case MOVE_SHADOW_FORCE: + gStatuses3[gBattlerAttacker] |= STATUS3_PHANTOM_FORCE; + break; } gBattlescriptCurrInstr++; @@ -9735,20 +9746,7 @@ static void atkC5_setsemiinvulnerablebit(void) static void atkC6_clearsemiinvulnerablebit(void) { - switch (gCurrentMove) - { - case MOVE_FLY: - case MOVE_BOUNCE: - gStatuses3[gBattlerAttacker] &= ~STATUS3_ON_AIR; - break; - case MOVE_DIG: - gStatuses3[gBattlerAttacker] &= ~STATUS3_UNDERGROUND; - break; - case MOVE_DIVE: - gStatuses3[gBattlerAttacker] &= ~STATUS3_UNDERWATER; - break; - } - + gStatuses3[gBattlerAttacker] &= ~(STATUS3_SEMI_INVULNERABLE); gBattlescriptCurrInstr++; } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index a6e8061d8..9c6ded27c 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -4774,6 +4774,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED, .split = SPLIT_PHYSICAL, + .argument = MOVE_EFFECT_PARALYSIS, }, [MOVE_MUD_SHOT] = @@ -7942,11 +7943,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_GHOST, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED | FLAG_DMG_MINIMIZE, .split = SPLIT_PHYSICAL, + .argument = MOVE_EFFECT_FEINT, }, [MOVE_TRICK_OR_TREAT] =