implemented G-Max Sweetness, Overgrowth, One Blow, Rapid Flow, and Finale

This commit is contained in:
AgustinGDLV 2023-02-28 16:37:48 -08:00
parent 3cdcf2a356
commit 7c853ef45e
9 changed files with 133 additions and 6 deletions

View file

@ -2247,6 +2247,16 @@
.4byte \ptr
.endm
.macro tryhealsixthhealth, ptr:req
various 0, VARIOUS_TRY_HEAL_SIXTH_HP
.4byte \ptr
.endm
.macro tryrecycleberry, ptr:req
various 0, VARIOUS_TRY_RECYCLE_BERRY
.4byte \ptr
.endm
@ Tries to increase or decrease a battler's stat's stat stage by a specified amount. If impossible, jumps to \script.
.macro modifybattlerstatstage battler:req, stat:req, mode:req, amount:req, script:req, animation:req, customString

View file

@ -10358,6 +10358,7 @@ BattleScript_EffectMaxMove::
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd
@ TODO: Maybe rework to use setallytonexttarget.
BattleScript_EffectRaiseStatAllies::
savetarget
setbyte gBattlerTarget, 0
@ -10535,6 +10536,61 @@ BattleScript_RaiseCritAlliesEnd:
restoretarget
return
BattleScript_EffectHealOneSixthAllies::
jumpifteamhealthy BS_ATTACKER, BattleScript_MoveEnd
setbyte gBattlerTarget, 0
BattleScript_HealOneSixthAlliesLoop:
jumpiftargetnotally BattleScript_HealOneSixthAlliesIncrement
jumpiftargetabsent BattleScript_HealOneSixthAlliesIncrement
tryhealsixthhealth BattleScript_HealOneSixthAlliesIncrement
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
printstring STRINGID_PKMNREGAINEDHEALTH
waitmessage B_WAIT_TIME_LONG
BattleScript_HealOneSixthAlliesIncrement:
addbyte gBattlerTarget, 1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_HealOneSixthAlliesLoop
BattleScript_HealOneSixthAlliesEnd:
restoretarget
return
BattleScript_EffectCureStatusAllies::
jumpifteamhealthy BS_ATTACKER, BattleScript_MoveEnd
setbyte gBattlerTarget, 0
BattleScript_CureStatusAlliesLoop:
jumpiftargetnotally BattleScript_CureStatusAlliesIncrement
jumpiftargetabsent BattleScript_CureStatusAlliesIncrement
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_CureStatusActivate
BattleScript_CureStatusAlliesIncrement:
addbyte gBattlerTarget, 1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_CureStatusAlliesLoop
BattleScript_CureStatusAlliesEnd:
restoretarget
return
BattleScript_CureStatusActivate:
curestatus BS_TARGET
updatestatusicon BS_TARGET
printstring STRINGID_PKMNSTATUSNORMAL
waitmessage B_WAIT_TIME_LONG
goto BattleScript_CureStatusAlliesIncrement
BattleScript_EffectRecycleBerriesAllies::
jumpifteamhealthy BS_ATTACKER, BattleScript_MoveEnd
setbyte gBattlerTarget, 0
BattleScript_RecycleBerriesAlliesLoop:
jumpiftargetnotally BattleScript_RecycleBerriesAlliesIncrement
jumpiftargetabsent BattleScript_RecycleBerriesAlliesIncrement
tryrecycleberry BattleScript_RecycleBerriesAlliesIncrement
printstring STRINGID_XFOUNDONEY
waitmessage B_WAIT_TIME_LONG
BattleScript_RecycleBerriesAlliesIncrement:
addbyte gBattlerTarget, 1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_RecycleBerriesAlliesLoop
BattleScript_RecycleBerriesAlliesEnd:
restoretarget
return
BattleScript_PokemonCantUseTheMove::
attackstring
ppreduce

View file

@ -51,6 +51,7 @@ enum MaxMoveEffect
MAX_EFFECT_LOWER_SPEED_2_FOES,
MAX_EFFECT_FIRE_SPIN_FOES,
MAX_EFFECT_FIXED_POWER,
MAX_EFFECT_BYPASS_PROTECT,
};
bool8 ShouldUseMaxMove(u16 battlerId, u16 baseMove);

View file

@ -482,5 +482,8 @@ extern const u8 BattleScript_EffectStatus1Foes[];
extern const u8 BattleScript_EffectStatus2Foes[];
extern const u8 BattleScript_TormentEnds[];
extern const u8 BattleScript_EffectRaiseCritAlliesAnim[];
extern const u8 BattleScript_EffectHealOneSixthAllies[];
extern const u8 BattleScript_EffectCureStatusAllies[];
extern const u8 BattleScript_EffectRecycleBerriesAllies[];
#endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -267,6 +267,8 @@
#define VARIOUS_DAMAGE_NON_TYPES 175
#define VARIOUS_TRY_SET_STATUS1 176
#define VARIOUS_TRY_SET_STATUS2 177
#define VARIOUS_TRY_HEAL_SIXTH_HP 178
#define VARIOUS_TRY_RECYCLE_BERRY 179
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View file

@ -29,8 +29,8 @@ static const u16 sMaxMoveTable[] =
[TYPE_STEEL] = MOVE_MAX_STEELSPIKE,
[TYPE_FIRE] = MOVE_MAX_FLARE,
[TYPE_WATER] = MOVE_MAX_GEYSER,
[TYPE_GRASS] = MOVE_G_MAX_CHI_STRIKE,
[TYPE_ELECTRIC] = MOVE_G_MAX_DEPLETION,
[TYPE_GRASS] = MOVE_MAX_OVERGROWTH,
[TYPE_ELECTRIC] = MOVE_MAX_LIGHTNING,
[TYPE_PSYCHIC] = MOVE_MAX_MINDSTORM,
[TYPE_ICE] = MOVE_MAX_HAILSTORM,
[TYPE_DRAGON] = MOVE_MAX_WYRMWIND,
@ -92,7 +92,7 @@ bool8 ShouldUseMaxMove(u16 battlerId, u16 baseMove)
// return !IsRaidBossUsingRegularMove(battlerId, baseMove);
if (gBattleStruct->dynamax.dynamaxTurns[battlerId] > 0)
return TRUE;
return battlerId == B_POSITION_PLAYER_LEFT;
return FALSE;
}
// Returns the appropriate Max Move or G-Max Move for a battler to use.
@ -517,6 +517,22 @@ u16 SetMaxMoveEffect(u16 move)
gBattlescriptCurrInstr = BattleScript_EffectRaiseCritAlliesAnim;
effect++;
break;
case MAX_EFFECT_HEAL_TEAM:
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_EffectHealOneSixthAllies;
effect++;
break;
case MAX_EFFECT_AROMATHERAPY:
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_EffectCureStatusAllies;
effect++;
break;
case MAX_EFFECT_RECYCLE_BERRIES:
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_EffectRecycleBerriesAllies;
effect++;
break;
}
return effect;
}

View file

@ -11325,6 +11325,44 @@ static void Cmd_various(void)
}
return;
}
case VARIOUS_TRY_HEAL_SIXTH_HP:
{
VARIOUS_ARGS(const u8 *failInstr);
gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 6;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
gBattleMoveDamage *= -1;
if (gBattleMons[gBattlerTarget].hp == gBattleMons[gBattlerTarget].maxHP)
gBattlescriptCurrInstr = cmd->failInstr; // fail
else
gBattlescriptCurrInstr = cmd->nextInstr; // can heal
return;
}
case VARIOUS_TRY_RECYCLE_BERRY:
{
VARIOUS_ARGS(const u8 *failInstr);
u16* usedHeldItem = &gBattleStruct->usedHeldItems[gBattlerPartyIndexes[gBattlerTarget]][GetBattlerSide(gBattlerTarget)];
if (gBattleMons[gBattlerTarget].item == ITEM_NONE
&& gBattleStruct->changedItems[gBattlerTarget] == ITEM_NONE // Will not inherit an item
&& ItemId_GetPocket(*usedHeldItem) == POCKET_BERRIES
&& Random() % 2 == 0)
{
gLastUsedItem = *usedHeldItem;
*usedHeldItem = ITEM_NONE;
gBattleMons[gActiveBattler].item = gLastUsedItem;
BtlController_EmitSetMonData(BUFFER_A, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[gBattlerTarget].item);
MarkBattlerForControllerExec(gActiveBattler);
gBattlescriptCurrInstr = cmd->nextInstr;
}
else
{
gBattlescriptCurrInstr = cmd->failInstr;
}
return;
}
} // End of switch (cmd->id)
gBattlescriptCurrInstr = cmd->nextInstr;

View file

@ -8295,7 +8295,8 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
// Max Moves bypass any protection except Max Guard.
if (IsMaxMove(move))
{
if (gProtectStructs[battlerId].maxGuarded)
if (gProtectStructs[battlerId].maxGuarded
&& gBattleMoves[move].argument != MAX_EFFECT_BYPASS_PROTECT)
return TRUE;
else
return FALSE;

View file

@ -15779,7 +15779,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =
.priority = 0,
.flags = 0,
.split = SPLIT_PHYSICAL,
.argument = MAX_EFFECT_TORMENT_FOES, //EFFECT TODO
.argument = MAX_EFFECT_BYPASS_PROTECT, //EFFECT TODO
},
[MOVE_G_MAX_RAPID_FLOW] =
@ -15794,7 +15794,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =
.priority = 0,
.flags = 0,
.split = SPLIT_PHYSICAL,
.argument = MAX_EFFECT_TORMENT_FOES, //EFFECT TODO
.argument = MAX_EFFECT_BYPASS_PROTECT, //EFFECT TODO
},
};