From 3cdcf2a356298ad0bc0e427c30c958adec2e81fb Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Mon, 27 Feb 2023 22:01:19 -0800 Subject: [PATCH] implemented G-Max Chi Strike, finished G-Max Gold Rush --- data/battle_scripts_1.s | 24 ++++++++++++++++++++++++ include/battle.h | 1 + include/battle_scripts.h | 1 + src/battle_dynamax.c | 19 +++++++++++++++++-- src/battle_script_commands.c | 3 ++- 5 files changed, 45 insertions(+), 3 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 0e77b5880e..1667e7a1a8 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -10496,6 +10496,7 @@ BattleScript_Status2FoesIncrement: jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_Status2FoesLoop BattleScript_Status2FoesEnd: restoretarget + jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 1, BattleScript_PrintCoinsScattered goto BattleScript_MoveEnd BattleScript_DoConfuseAnim: @@ -10506,11 +10507,34 @@ BattleScript_DoInfatuationAnim: status2animation BS_TARGET, STATUS2_INFATUATION goto BattleScript_Status2FoesPrintMessage +BattleScript_PrintCoinsScattered: + printstring STRINGID_COINSSCATTERED + goto BattleScript_MoveEnd + BattleScript_TormentEnds:: printstring STRINGID_TORMENTEDNOMORE waitmessage B_WAIT_TIME_LONG end2 +BattleScript_EffectRaiseCritAlliesAnim:: + savetarget + setbyte gBattlerTarget, 0 +BattleScript_RaiseCritAlliesLoop: + jumpiftargetnotally BattleScript_RaiseCritAlliesIncrement + jumpiftargetabsent BattleScript_RaiseCritAlliesIncrement + setstatchanger STAT_ATK, 0, FALSE @ for animation + setgraphicalstatchangevalues + playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 + printstring STRINGID_PKMNGETTINGPUMPED + waitmessage B_WAIT_TIME_LONG +BattleScript_RaiseCritAlliesIncrement: + setbyte sSTAT_ANIM_PLAYED, FALSE + addbyte gBattlerTarget, 1 + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_RaiseCritAlliesLoop +BattleScript_RaiseCritAlliesEnd: + restoretarget + return + BattleScript_PokemonCantUseTheMove:: attackstring ppreduce diff --git a/include/battle.h b/include/battle.h index 26bfe1e38b..94f0fab716 100644 --- a/include/battle.h +++ b/include/battle.h @@ -677,6 +677,7 @@ struct BattleStruct u8 battleBondTransformed[NUM_BATTLE_SIDES]; // Bitfield for each party. u8 storedHealingWish:4; // Each battler as a bit. u8 storedLunarDance:4; // Each battler as a bit. + u8 sideCritStages[NUM_BATTLE_SIDES]; // G-Max Chi Strike boosts crit stages of allies. }; #define F_DYNAMIC_TYPE_1 (1 << 6) diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 604ce10d93..9941288cc4 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -481,5 +481,6 @@ extern const u8 BattleScript_EffectTryReducePP[]; extern const u8 BattleScript_EffectStatus1Foes[]; extern const u8 BattleScript_EffectStatus2Foes[]; extern const u8 BattleScript_TormentEnds[]; +extern const u8 BattleScript_EffectRaiseCritAlliesAnim[]; #endif // GUARD_BATTLE_SCRIPTS_H \ No newline at end of file diff --git a/src/battle_dynamax.c b/src/battle_dynamax.c index 03966c1bca..a14a9c65af 100644 --- a/src/battle_dynamax.c +++ b/src/battle_dynamax.c @@ -29,7 +29,7 @@ static const u16 sMaxMoveTable[] = [TYPE_STEEL] = MOVE_MAX_STEELSPIKE, [TYPE_FIRE] = MOVE_MAX_FLARE, [TYPE_WATER] = MOVE_MAX_GEYSER, - [TYPE_GRASS] = MOVE_MAX_OVERGROWTH, + [TYPE_GRASS] = MOVE_G_MAX_CHI_STRIKE, [TYPE_ELECTRIC] = MOVE_G_MAX_DEPLETION, [TYPE_PSYCHIC] = MOVE_MAX_MINDSTORM, [TYPE_ICE] = MOVE_MAX_HAILSTORM, @@ -92,7 +92,7 @@ bool8 ShouldUseMaxMove(u16 battlerId, u16 baseMove) // return !IsRaidBossUsingRegularMove(battlerId, baseMove); if (gBattleStruct->dynamax.dynamaxTurns[battlerId] > 0) return TRUE; - return FALSE; + return battlerId == B_POSITION_PLAYER_LEFT; } // Returns the appropriate Max Move or G-Max Move for a battler to use. @@ -494,6 +494,15 @@ u16 SetMaxMoveEffect(u16 move) effect++; break; case MAX_EFFECT_CONFUSE_FOES_PAY_DAY: + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) + { + u16 payday = gPaydayMoney; + gPaydayMoney += (gBattleMons[gBattlerAttacker].level * 100); + if (payday > gPaydayMoney) + gPaydayMoney = 0xFFFF; + gBattleCommunication[CURSOR_POSITION] = 1; // add "Coins scattered." message + } + // fall through case MAX_EFFECT_CONFUSE_FOES: case MAX_EFFECT_INFATUATE_FOES: case MAX_EFFECT_TORMENT_FOES: @@ -502,6 +511,12 @@ u16 SetMaxMoveEffect(u16 move) gBattlescriptCurrInstr = BattleScript_EffectStatus2Foes; effect++; break; + case MAX_EFFECT_CRIT_PLUS: + gBattleStruct->sideCritStages[GetBattlerSide(gBattlerAttacker)]++; + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_EffectRaiseCritAlliesAnim; + effect++; + break; } return effect; } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 44e2b21626..23204ccdc5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2054,7 +2054,8 @@ s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbi #if B_AFFECTION_MECHANICS == TRUE + 2 * (GetBattlerFriendshipScore(gBattlerAttacker) >= FRIENDSHIP_200_TO_254) #endif - + (abilityAtk == ABILITY_SUPER_LUCK); + + (abilityAtk == ABILITY_SUPER_LUCK) + + gBattleStruct->sideCritStages[GetBattlerSide(gBattlerAttacker)]; if (critChance >= ARRAY_COUNT(sCriticalHitChance)) critChance = ARRAY_COUNT(sCriticalHitChance) - 1;