diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4f8447987..9b7e3a070 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -413,6 +413,7 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectTerrainHit @ EFFECT_DAMAGE_SET_TERRAIN .4byte BattleScript_EffectDarkVoid @ EFFECT_DARK_VOID .4byte BattleScript_EffectSleepHit @ EFFECT_SLEEP_HIT + .4byte BattleScript_EffectDoubleShock @ EFFECT_DOUBLE_SHOCK BattleScript_AffectionBasedEndurance:: playanimation BS_TARGET, B_ANIM_AFFECTION_HANGED_ON @@ -1281,6 +1282,23 @@ BattleScript_BurnUpRemoveType:: printstring STRINGID_ATTACKERLOSTFIRETYPE waitmessage B_WAIT_TIME_LONG return + +BattleScript_EffectDoubleShock: + attackcanceler + attackstring + ppreduce + jumpiftype BS_ATTACKER, TYPE_ELECTRIC, BattleScript_DoubleShockWorks + goto BattleScript_ButItFailed + +BattleScript_DoubleShockWorks: + setmoveeffect MOVE_EFFECT_DOUBLE_SHOCK | MOVE_EFFECT_CERTAIN + goto BattleScript_EffectHit + +BattleScript_DoubleShockRemoveType:: + losetype BS_ATTACKER, TYPE_ELECTRIC + printstring STRINGID_ATTACKERLOSTELECTRICTYPE + waitmessage B_WAIT_TIME_LONG + return BattleScript_EffectPurify: attackcanceler diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 23f18e3be..16ac7a8c8 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -433,6 +433,7 @@ extern const u8 BattleScript_SymbiosisActivates[]; extern const u8 BattleScript_MultiHitPrintStrings[]; extern const u8 BattleScript_BurnUpRemoveType[]; extern const u8 BattleScript_TargetAbilityStatRaiseRet[]; +extern const u8 BattleScript_DoubleShockRemoveType[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle.h b/include/constants/battle.h index 366471e47..d6e21d0ae 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -369,8 +369,9 @@ #define MOVE_EFFECT_RECOIL_HP_25 0x44 #define MOVE_EFFECT_RELIC_SONG 0x45 #define MOVE_EFFECT_TRAP_BOTH 0x46 +#define MOVE_EFFECT_DOUBLE_SHOCK 0x47 -#define NUM_MOVE_EFFECTS 0x47 +#define NUM_MOVE_EFFECTS 0x48 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 2292dfa1f..a2a633fb8 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -394,7 +394,8 @@ #define EFFECT_DAMAGE_SET_TERRAIN 388 // genesis supernova #define EFFECT_DARK_VOID 389 #define EFFECT_SLEEP_HIT 390 +#define EFFECT_DOUBLE_SHOCK 391 -#define NUM_BATTLE_MOVE_EFFECTS 391 +#define NUM_BATTLE_MOVE_EFFECTS 392 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 4bce51a45..e1bcf983a 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -630,8 +630,9 @@ #define STRINGID_ATTACKERHEALEDITSBURN 628 #define STRINGID_ATTACKERMELTEDTHEICE 629 #define STRINGID_TARGETTOUGHEDITOUT 630 +#define STRINGID_ATTACKERLOSTELECTRICTYPE 631 -#define BATTLESTRINGS_COUNT 631 +#define BATTLESTRINGS_COUNT 632 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 9604f1195..e141a45bf 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -2007,6 +2007,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (!IS_BATTLER_OF_TYPE(battlerAtk, TYPE_FIRE)) score -= 10; break; + case EFFECT_DOUBLE_SHOCK: + if (!IS_BATTLER_OF_TYPE(battlerAtk, TYPE_ELECTRIC)) + score -= 10; + break; case EFFECT_DEFOG: if (gSideStatuses[GetBattlerSide(battlerDef)] & (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL | SIDE_STATUS_SAFEGUARD | SIDE_STATUS_MIST) diff --git a/src/battle_message.c b/src/battle_message.c index 9503fbaaf..07598d95a 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -759,7 +759,7 @@ static const u8 sText_AttackerBrokeThroughParalysis[] = _("{B_ATK_NAME_WITH_PREF static const u8 sText_AttackerHealedItsBurn[] = _("{B_ATK_NAME_WITH_PREFIX} healed its burn with\nits sheer determination!"); static const u8 sText_AttackerMeltedTheIce[] = _("{B_ATK_NAME_WITH_PREFIX} melted the ice with\nits fiery determination!"); static const u8 sText_TargetToughedItOut[] = _("{B_DEF_NAME_WITH_PREFIX} toughed it out\nto show you its best side!"); - +static const u8 sText_AttackerLostElectricType[] = _("{B_ATK_NAME_WITH_PREFIX} discharged itself out!"); // Unofficial text until the string from the main games is known const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { @@ -1381,6 +1381,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_CANTESCAPEBECAUSEOFCURRENTMOVE - BATTLESTRINGS_TABLE_START] = sText_CantEscapeBecauseOfCurrentMove, [STRINGID_PKMNTOOKTARGETHIGH - BATTLESTRINGS_TABLE_START] = sText_PkmnTookTargetHigh, [STRINGID_TARGETTOOHEAVY - BATTLESTRINGS_TABLE_START] = sText_TargetTooHeavy, + [STRINGID_ATTACKERLOSTELECTRICTYPE - BATTLESTRINGS_TABLE_START] = sText_AttackerLostElectricType, }; const u16 gZEffectStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3e52aa618..013faa8dd 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1131,6 +1131,7 @@ static const u16 sFinalStrikeOnlyEffects[] = EFFECT_BUG_BITE, EFFECT_THIEF, EFFECT_BURN_UP, + EFFECT_DOUBLE_SHOCK, EFFECT_SECRET_POWER, EFFECT_SMACK_DOWN, EFFECT_SPARKLING_ARIA, @@ -3647,6 +3648,11 @@ void SetMoveEffect(bool32 primary, u32 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_BurnUpRemoveType; break; + case MOVE_EFFECT_DOUBLE_SHOCK: + // This seems unnecessary but is done to make it work properly with Parental Bond + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_DoubleShockRemoveType; + break; } } } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 44aa3227e..c7f1064cc 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -14355,7 +14355,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_DOUBLE_SHOCK] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_DOUBLE_SHOCK + .effect = EFFECT_DOUBLE_SHOCK, .power = 120, .type = TYPE_ELECTRIC, .accuracy = 100,