diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index d68ad696d..17b426b8d 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -261,6 +261,11 @@ AI_CheckBadMove_CheckEffect: @ 82DC045 if_effect EFFECT_TAUNT, AI_CBM_Taunt if_effect EFFECT_HEAL_BELL, AI_CBM_HealBell if_effect EFFECT_FOLLOW_ME, AI_CBM_FollowMe + if_effect EFFECT_GEOMANCY, AI_CBM_QuiverDance + end + +AI_CBM_Geomancy: + call AI_CBM_QuiverDance end AI_CBM_FollowMe: @@ -3452,6 +3457,7 @@ AI_SetupFirstTurn_SetupEffectsToEncourage: .2byte EFFECT_SUNNY_DAY .2byte EFFECT_SANDSTORM .2byte EFFECT_HAIL + .2byte EFFECT_GEOMANCY .2byte -1 AI_PreferStrongestMove: diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index e87b550c5..7820cef72 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -360,6 +360,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectPurify .4byte BattleScript_EffectBurnUp .4byte BattleScript_EffectShoreUp + .4byte BattleScript_EffectGeomancy BattleScript_EffectBurnUp: attackcanceler @@ -3046,7 +3047,49 @@ BattleScript_EffectTwoTurnsAttackIceBurn: goto BattleScript_EffectTwoTurnsAttackContinue BattleScript_EffectTwoTurnsAttackFreezeShock: setbyte sTWOTURN_STRINGID, 0x0 - goto BattleScript_EffectTwoTurnsAttackContinue + goto BattleScript_EffectTwoTurnsAttackContinue + +BattleScript_EffectGeomancy: + jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_GeomancySecondTurn + jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_GeomancySecondTurn + setbyte sTWOTURN_STRINGID, 0x9 + call BattleScriptFirstChargingTurn + goto BattleScript_MoveEnd + +BattleScript_GeomancySecondTurn: + attackcanceler + setmoveeffect MOVE_EFFECT_CHARGING + setbyte sB_ANIM_TURN, 0x1 + clearstatusfromeffect BS_ATTACKER + orword gHitMarker, HITMARKER_NO_PPDEDUCT + attackstring + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, 0xC, BattleScript_GeomancyDoMoveAnim + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPDEF, 0xC, BattleScript_GeomancyDoMoveAnim + jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPEED, 0xC, BattleScript_CantRaiseMultipleStats +BattleScript_GeomancyDoMoveAnim:: + attackanimation + waitanimation + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF | BIT_SPEED, 0x0 + setstatchanger STAT_SPATK, 2, FALSE + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_GeomancyTrySpDef + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_GeomancyTrySpDef + printfromtable gStatUpStringIds + waitmessage 0x40 +BattleScript_GeomancyTrySpDef:: + setstatchanger STAT_SPDEF, 2, FALSE + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_GeomancyTrySpeed + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_GeomancyTrySpeed + printfromtable gStatUpStringIds + waitmessage 0x40 +BattleScript_GeomancyTrySpeed:: + setstatchanger STAT_SPEED, 2, FALSE + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_GeomancyEnd + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_GeomancyEnd + printfromtable gStatUpStringIds + waitmessage 0x40 +BattleScript_GeomancyEnd:: + goto BattleScript_MoveEnd BattleScript_EffectConfuseHit:: setmoveeffect MOVE_EFFECT_CONFUSION diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 1cae78323..425d83ac1 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -348,5 +348,6 @@ #define EFFECT_PURIFY 342 #define EFFECT_BURN_UP 343 #define EFFECT_SHORE_UP 344 +#define EFFECT_GEOMANCY 345 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 24cdd4f90..ca2d22a9f 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -545,7 +545,8 @@ #define STRINGID_HEALERCURE 541 #define STRINGID_SCRIPTINGABILITYSTATRAISE 542 #define STRINGID_RECEIVERABILITYTAKEOVER 543 +#define STRINGID_PKNMABSORBINGPOWER 544 -#define BATTLESTRINGS_COUNT 544 +#define BATTLESTRINGS_COUNT 545 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_message.c b/src/battle_message.c index 4e3752c9f..0e1822035 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -666,9 +666,11 @@ static const u8 sText_AttackerCuredTargetStatus[] = _("{B_ATK_NAME_WITH_PREFIX} static const u8 sText_AttackerLostFireType[] = _("{B_ATK_NAME_WITH_PREFIX} burned itself out!"); static const u8 sText_HealerCure[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ABILITY}\ncured {B_SCR_ACTIVE_NAME_WITH_PREFIX}'s problem!"); static const u8 sText_ReceiverAbilityTakeOver[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nwas taken over!"); +static const u8 sText_PkmnAbsorbingPower[] = _("{B_ATK_NAME_WITH_PREFIX} is absorbing power!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_PKNMABSORBINGPOWER - 12] = sText_PkmnAbsorbingPower, [STRINGID_RECEIVERABILITYTAKEOVER - 12] = sText_ReceiverAbilityTakeOver, [STRINGID_SCRIPTINGABILITYSTATRAISE - 12] = sText_ScriptingAbilityRaisedStat, [STRINGID_HEALERCURE - 12] = sText_HealerCure, @@ -1334,7 +1336,8 @@ const u16 gStatDownStringIds[] = const u16 gFirstTurnOfTwoStringIds[] = { STRINGID_PKMNWHIPPEDWHIRLWIND, STRINGID_PKMNTOOKSUNLIGHT, STRINGID_PKMNLOWEREDHEAD, STRINGID_PKMNISGLOWING, - STRINGID_PKMNFLEWHIGH, STRINGID_PKMNDUGHOLE, STRINGID_PKMNHIDUNDERWATER, STRINGID_PKMNSPRANGUP, STRINGID_VANISHEDINSTANTLY + STRINGID_PKMNFLEWHIGH, STRINGID_PKMNDUGHOLE, STRINGID_PKMNHIDUNDERWATER, STRINGID_PKMNSPRANGUP, STRINGID_VANISHEDINSTANTLY, + STRINGID_PKNMABSORBINGPOWER }; const u16 gWrappedStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 09148d663..f3ed16def 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7257,9 +7257,7 @@ static void Cmd_various(void) && !NoAliveMonsForEitherParty() && gBattleMons[gBattlerAttacker].statStages[STAT_ATK] != 12) { - if (gBattleMons[gBattlerAttacker].statStages[STAT_ATK] >= 11) - SET_STATCHANGER(STAT_ATK, 1, FALSE); - else if (gBattleMons[gBattlerAttacker].statStages[STAT_ATK] <= 9 && B_FELL_STINGER_STAT_RAISE >= GEN_7) + if (B_FELL_STINGER_STAT_RAISE >= GEN_7) SET_STATCHANGER(STAT_ATK, 3, FALSE); else SET_STATCHANGER(STAT_ATK, 2, FALSE); @@ -8592,6 +8590,10 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr else // try to decrease { statValue = -GET_STAT_BUFF_VALUE(statValue); + if (gBattleMons[gActiveBattler].statStages[statId] == 1) + statValue = -1; + else if (gBattleMons[gActiveBattler].statStages[statId] == 2) + statValue = -2; gBattleTextBuff2[0] = B_BUFF_PLACEHOLDER_BEGIN; index = 1; if (statValue == -2) @@ -8620,12 +8622,15 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr gBattleCommunication[MULTISTRING_CHOOSER] = 2; else gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); - } } else // stat increase { statValue = GET_STAT_BUFF_VALUE(statValue); + if (gBattleMons[gActiveBattler].statStages[statId] == 11) + statValue = 1; + else if (gBattleMons[gActiveBattler].statStages[statId] == 10) + statValue = 2; gBattleTextBuff2[0] = B_BUFF_PLACEHOLDER_BEGIN; index = 1; if (statValue == 2) diff --git a/src/battle_util.c b/src/battle_util.c index 28be831ec..f79c76710 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3192,7 +3192,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA { i = (Random() % statsNum) + STAT_ATK; } while (!(validToRaise & gBitTable[i])); - SET_STATCHANGER(i, (gBattleMons[battler].statStages[i] < 11) ? 2 : 1, FALSE); + SET_STATCHANGER(i, 2, FALSE); validToLower &= ~(gBitTable[i]); // Can't lower the same stat as raising. } if (validToLower != 0) // Find stat to lower diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index ddaaf2c1c..345d2b0fb 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -8436,7 +8436,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_GEOMANCY] = { - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_GEOMANCY, .power = 0, .type = TYPE_FAIRY, .accuracy = 0,