Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into gen_8_moves_batch2

This commit is contained in:
BuffelSaft 2022-02-13 21:06:15 +13:00
commit 6a119c5a30
8 changed files with 820 additions and 867 deletions

View File

@ -1645,7 +1645,7 @@ BattleScript_EffectPsychoShift:
BattleScript_EffectPsychoShiftCanWork:
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpifsafeguard BattleScript_SafeguardProtected
trypsychoshift BattleScript_MoveEnd
trypsychoshift BattleScript_ButItFailed
attackanimation
waitanimation
copybyte gEffectBattler, gBattlerTarget

View File

@ -150,6 +150,7 @@
#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it.
#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage.
#define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing.
#define B_UPDATED_CONVERSION GEN_7 // In Gen6+, Conversion changes the user's type to match their first move's. Before, it would choose a move at random.
// Move accuracy settings
#define B_TOXIC_NEVER_MISS GEN_7 // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss.

View File

@ -1022,9 +1022,9 @@ u8 AI_WhoStrikesFirst(u8 battlerAI, u8 battler2)
{
// Priorities are the same(at least comparing to moves the AI is aware of), decide by speed.
if (GetWhoStrikesFirst(battlerAI, battler2, TRUE) == 0)
return TRUE;
return AI_IS_FASTER;
else
return FALSE;
return AI_IS_SLOWER;
}
}

View File

@ -4876,6 +4876,7 @@ static void CheckQuickClaw_CustapBerryActivation(void)
}
else if (gProtectStructs[gActiveBattler].quickDraw)
{
gBattlerAbility = gActiveBattler;
gProtectStructs[gActiveBattler].quickDraw = FALSE;
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);

View File

@ -510,13 +510,13 @@ static const u8 sText_TwoInGameTrainersDefeated[];
static const u8 sText_Trainer2LoseText[];
// New battle strings.
static const s8 sText_EnduredViaSturdy[] = _("{B_DEF_NAME_WITH_PREFIX} ENDURED\nthe hit using {B_DEF_ABILITY}!");
static const s8 sText_EnduredViaSturdy[] = _("{B_DEF_NAME_WITH_PREFIX} Endured\nthe hit using {B_DEF_ABILITY}!");
static const s8 sText_PowerHerbActivation[] = _("{B_ATK_NAME_WITH_PREFIX} became fully charged\ndue to its {B_LAST_ITEM}!");
static const s8 sText_HurtByItem[] = _("{B_ATK_NAME_WITH_PREFIX} was hurt\nby its {B_LAST_ITEM}!");
static const s8 sText_BadlyPoisonedByItem[] = _("{B_EFF_NAME_WITH_PREFIX} was badly \npoisoned by the {B_LAST_ITEM}!");
static const s8 sText_BurnedByItem[] = _("{B_EFF_NAME_WITH_PREFIX} was burned\nby the {B_LAST_ITEM}!");
static const s8 sText_TargetAbilityActivates[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} activates!");
static const u8 sText_GravityIntensified[] = _("GRAVITY intensified!");
static const u8 sText_GravityIntensified[] = _("Gravity intensified!");
static const u8 sText_TargetIdentified[] = _("{B_DEF_NAME_WITH_PREFIX} was \nidentified!");
static const u8 sText_TargetWokeUp[] = _("{B_DEF_NAME_WITH_PREFIX} woke up!");
static const u8 sText_PkmnStoleAndAteItem[] = _("{B_ATK_NAME_WITH_PREFIX} stole and\nate {B_DEF_NAME_WITH_PREFIX}'s {B_LAST_ITEM}!");
@ -616,9 +616,9 @@ static const u8 sText_TargetStatWontGoHigher[] = _("{B_DEF_NAME_WITH_PREFIX}'s {
static const u8 sText_PkmnMoveBouncedViaAbility[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE} was\nbounced back by {B_DEF_NAME_WITH_PREFIX}'s\l{B_DEF_ABILITY}!");
static const u8 sText_ImposterTransform[] = _("{B_ATK_NAME_WITH_PREFIX} transformed into\n{B_DEF_NAME_WITH_PREFIX} using {B_LAST_ABILITY}!");
static const u8 sText_NotDoneYet[] = _("This move effect is not done yet!\p");
static const u8 sText_PkmnBlewAwayToxicSpikes[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nTOXIC SPIKES!");
static const u8 sText_PkmnBlewAwayStickyWeb[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nSTICKY WEB!");
static const u8 sText_PkmnBlewAwayStealthRock[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nSTEALTH ROCK!");
static const u8 sText_PkmnBlewAwayToxicSpikes[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nToxic Spikes!");
static const u8 sText_PkmnBlewAwayStickyWeb[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nSticky Web!");
static const u8 sText_PkmnBlewAwayStealthRock[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nStealth Rock!");
static const u8 sText_StickyWebUsed[] = _("A sticky web spreads out on the\nground around {B_DEF_TEAM2} team!");
static const u8 sText_QuashSuccess[] = _("The opposing {B_ATK_NAME_WITH_PREFIX}'s move was postponed!");
static const u8 sText_IonDelugeOn[] = _("A deluge of ions showers\nthe battlefield!");
@ -681,7 +681,7 @@ static const u8 sText_AirLockActivates[] = _("The effects of weather\ndisappeare
static const u8 sText_PressureActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is exerting its\npressure!");
static const u8 sText_DarkAuraActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is radiating\na dark aura!");
static const u8 sText_FairyAuraActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is radiating\na fairy aura!");
static const u8 sText_AuraBreakActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} reversed all\nother POKéMON's auras!");
static const u8 sText_AuraBreakActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} reversed all\nother Pokémon's auras!");
static const u8 sText_ComatoseActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is drowsing!");
static const u8 sText_ScreenCleanerActivates[] = _("All screens on the field were\ncleansed!");
static const u8 sText_FetchedPokeBall[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} found\na {B_LAST_ITEM}!");
@ -727,7 +727,7 @@ static const u8 sText_SwappedAbilities[] = _("{B_DEF_NAME_WITH_PREFIX} swapped A
static const u8 sText_PastelVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby a pastel veil!");
static const u8 sText_PastelVeilEnters[] = _("{B_DEF_NAME_WITH_PREFIX} was cured\nof its poisoning!");
static const u8 sText_BattlerTypeChangedTo[] = _("{B_BUFF1}'s type\nchanged to {B_BUFF2}!");
static const u8 sText_BothCanNoLongerEscape[] = _("Neither POKéMON can run away!");
static const u8 sText_BothCanNoLongerEscape[] = _("Neither Pokémon can run away!");
static const u8 sText_CantEscapeDueToUsedMove[] = _("{B_ATK_NAME_WITH_PREFIX} can no longer escape\nbecause it used {B_CURRENT_MOVE}!");
static const u8 sText_PkmnBecameWeakerToFire[] = _("{B_DEF_NAME_WITH_PREFIX} became\nweaker to fire!");
static const u8 sText_PkmnAboutToBeAttackedByItsItem[] = _("{B_DEF_NAME_WITH_PREFIX} is about\nto be attacked by its {B_BUFF1}!");

View File

@ -8742,89 +8742,17 @@ static void Cmd_various(void)
return;
case VARIOUS_PSYCHO_SHIFT:
{
u16 targetAbility = GetBattlerAbility(gBattlerTarget);
i = TRUE;
if (gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS)
if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS && !CanBeParalyzed(gBattlerTarget))
|| (gBattleMons[gBattlerAttacker].status1 & STATUS1_PSN_ANY && !CanBePoisoned(gBattlerAttacker, gBattlerTarget))
|| (gBattleMons[gBattlerAttacker].status1 & STATUS1_BURN && !CanBeBurned(gBattlerTarget))
|| (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP && !CanSleep(gBattlerTarget)))
{
if (targetAbility == ABILITY_LIMBER)
{
gBattlerAbility = gBattlerTarget;
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_PRLZPrevention;
i = FALSE;
}
else if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_ELECTRIC))
{
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_PRLZPrevention;
i = FALSE;
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 3;
}
// fails
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
}
else if (gBattleMons[gBattlerAttacker].status1 & STATUS1_PSN_ANY)
{
if (targetAbility == ABILITY_IMMUNITY)
{
gBattlerAbility = gBattlerTarget;
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
i = FALSE;
}
else if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_POISON) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_STEEL))
{
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_PSNPrevention;
i = FALSE;
}
else
{
if (gBattleMons[gBattlerAttacker].status1 & STATUS1_POISON)
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
else
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
}
}
else if (gBattleMons[gBattlerAttacker].status1 & STATUS1_BURN)
{
if (targetAbility == ABILITY_WATER_VEIL
|| targetAbility == ABILITY_WATER_BUBBLE)
{
gBattlerAbility = gBattlerTarget;
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
i = FALSE;
}
else if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_FIRE))
{
BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
gBattlescriptCurrInstr = BattleScript_BRNPrevention;
i = FALSE;
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
}
}
else if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP)
{
if (targetAbility == ABILITY_INSOMNIA || targetAbility == ABILITY_VITAL_SPIRIT)
{
gBattlerAbility = gBattlerTarget;
// BattleScriptPush(T1_READ_PTR(gBattlescriptCurrInstr + 3));
// gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
i = FALSE;
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
}
}
if (i == TRUE)
else
{
// Psycho shift works
gBattleMons[gBattlerTarget].status1 = gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY;
gActiveBattler = gBattlerTarget;
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1);
@ -10725,12 +10653,34 @@ static void Cmd_forcerandomswitch(void)
}
}
static void Cmd_tryconversiontypechange(void) // randomly changes user's type to one of its moves' type
static void Cmd_tryconversiontypechange(void)
{
u8 validMoves = 0;
u8 moveChecked;
u8 moveType;
#if B_UPDATED_CONVERSION >= GEN_6
// changes user's type to its first move's type
for (moveChecked = 0; moveChecked < MAX_MON_MOVES; moveChecked++)
{
if (gBattleMons[gBattlerAttacker].moves[moveChecked] != MOVE_NONE)
{
moveType = gBattleMoves[gBattleMons[gBattlerAttacker].moves[moveChecked]].type;
break;
}
}
if (IS_BATTLER_OF_TYPE(gBattlerAttacker, moveType))
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
}
else
{
SET_BATTLER_TYPE(gBattlerAttacker, moveType);
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType);
gBattlescriptCurrInstr += 5;
}
#else
// randomly changes user's type to one of its moves' type
while (validMoves < MAX_MON_MOVES)
{
if (gBattleMons[gBattlerAttacker].moves[validMoves] == 0)
@ -10786,6 +10736,7 @@ static void Cmd_tryconversiontypechange(void) // randomly changes user's type to
gBattlescriptCurrInstr += 5;
}
#endif
}
static void Cmd_givepaydaymoney(void)

File diff suppressed because it is too large Load Diff

View File

@ -943,7 +943,7 @@ void ItemUseOutOfBattle_EvolutionStone(u8 taskId)
static u32 GetBallThrowableState(void)
{
if (IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
&& IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)))
&& IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)))
return BALL_THROW_UNABLE_TWO_MONS;
else if (IsPlayerPartyAndPokemonStorageFull() == TRUE)
return BALL_THROW_UNABLE_NO_ROOM;