Update Unusable Moves
This commit is contained in:
parent
991e041181
commit
b73075f822
7 changed files with 167 additions and 30 deletions
|
@ -4082,6 +4082,32 @@ BattleScript_MoveUsedIsTaunted::
|
|||
BattleScript_SelectingNotAllowedMoveTauntInPalace::
|
||||
printstring STRINGID_PKMNCANTUSEMOVETAUNT
|
||||
goto BattleScript_SelectingUnusableMoveInPalace
|
||||
|
||||
BattleScript_SelectingNotAllowedMoveGravity::
|
||||
printselectionstring STRINGID_GRAVITYPREVENTSUSAGE
|
||||
endselectionscript
|
||||
|
||||
BattleScript_MoveUsedGravityPrevents::
|
||||
printstring STRINGID_GRAVITYPREVENTSUSAGE
|
||||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_SelectingNotAllowedMoveGravityInPalace::
|
||||
printstring STRINGID_GRAVITYPREVENTSUSAGE
|
||||
goto BattleScript_SelectingUnusableMoveInPalace
|
||||
|
||||
BattleScript_SelectingNotAllowedMoveHealBlock::
|
||||
printselectionstring STRINGID_GRAVITYPREVENTSUSAGE
|
||||
endselectionscript
|
||||
|
||||
BattleScript_MoveUsedHealBlockPrevents::
|
||||
printstring STRINGID_GRAVITYPREVENTSUSAGE
|
||||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_SelectingNotAllowedMoveHealBlockInPalace::
|
||||
printstring STRINGID_GRAVITYPREVENTSUSAGE
|
||||
goto BattleScript_SelectingUnusableMoveInPalace
|
||||
|
||||
BattleScript_WishComesTrue::
|
||||
trywish 0x1, BattleScript_WishButFullHp
|
||||
|
@ -5086,6 +5112,10 @@ BattleScript_ItemHealHP_Ret::
|
|||
BattleScript_SelectingNotAllowedMoveChoiceItem::
|
||||
printselectionstring STRINGID_ITEMALLOWSONLYYMOVE
|
||||
endselectionscript
|
||||
|
||||
BattleScript_SelectingNotAllowedMoveAssaultVest::
|
||||
printselectionstring STRINGID_ASSAULTVESTDOESNTALLOW
|
||||
endselectionscript
|
||||
|
||||
BattleScript_HangedOnMsg::
|
||||
playanimation BS_TARGET, B_ANIM_HANGED_ON, NULL
|
||||
|
|
|
@ -325,5 +325,12 @@ extern const u8 BattleScript_FellStingerRaisesStat[];
|
|||
extern const u8 BattleScript_SnowWarningActivates[];
|
||||
extern const u8 BattleScript_HarvestActivates[];
|
||||
extern const u8 BattleScript_ImposterActivates[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedMoveAssaultVest[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedMoveGravity[];
|
||||
extern const u8 BattleScript_MoveUsedGravityPrevents[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedMoveGravityInPalace[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedMoveHealBlock[];
|
||||
extern const u8 BattleScript_MoveUsedHealBlockPrevents[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedMoveHealBlockInPalace[];
|
||||
|
||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||
|
|
|
@ -486,7 +486,10 @@
|
|||
#define STRINGID_TARGETSTATWONTGOHIGHER 483
|
||||
#define STRINGID_PKMNMOVEBOUNCEDABILITY 484
|
||||
#define STRINGID_IMPOSTERTRANSFORM 485
|
||||
#define STRINGID_ASSAULTVESTDOESNTALLOW 486
|
||||
#define STRINGID_GRAVITYPREVENTSUSAGE 487
|
||||
#define STRINGID_HEALBLOCKPREVENTSUSAGE 488
|
||||
|
||||
#define BATTLESTRINGS_COUNT 496
|
||||
#define BATTLESTRINGS_COUNT 501
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H
|
||||
|
|
|
@ -113,4 +113,6 @@
|
|||
// Gen7 hold effects
|
||||
#define HOLD_EFFECT_PROTECTIVE_PADS 150
|
||||
|
||||
#define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS))
|
||||
|
||||
#endif // GUARD_HOLD_EFFECTS_H
|
||||
|
|
|
@ -628,6 +628,12 @@ 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}!");
|
||||
|
||||
// New selection strings, they must end with "\p".
|
||||
// Use {B_LAST_ITEM} and {B_CURRENT_MOVE}.
|
||||
static const u8 sText_AssaultVestDoesntAllow[] = _("\p");
|
||||
static const u8 sText_GravityPreventsUsage[] = _("\p");
|
||||
static const u8 sText_HealBlockPreventsUsage[] = _("\p");
|
||||
|
||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
{
|
||||
sText_Trainer1LoseText, // 12
|
||||
|
@ -1105,6 +1111,9 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
|||
sText_TargetStatWontGoHigher,
|
||||
sText_PkmnMoveBouncedViaAbility,
|
||||
sText_ImposterTransform,
|
||||
sText_AssaultVestDoesntAllow,
|
||||
sText_GravityPreventsUsage,
|
||||
sText_HealBlockPreventsUsage,
|
||||
};
|
||||
|
||||
const u16 gMagicCoatBounceStringIds[] =
|
||||
|
|
|
@ -4146,7 +4146,7 @@ static void atk49_moveend(void)
|
|||
gBattleScripting.atk49_state++;
|
||||
break;
|
||||
case 6: // update choice band move
|
||||
if (!(gHitMarker & HITMARKER_OBEYS) || holdEffectAtk != HOLD_EFFECT_CHOICE_BAND
|
||||
if (!(gHitMarker & HITMARKER_OBEYS) || !HOLD_EFFECT_CHOICE(holdEffectAtk)
|
||||
|| gChosenMove == MOVE_STRUGGLE || (*choicedMoveAtk != 0 && *choicedMoveAtk != 0xFFFF))
|
||||
goto LOOP;
|
||||
if ((gBattleMoves[gChosenMove].effect == EFFECT_BATON_PASS
|
||||
|
@ -7483,7 +7483,9 @@ static void atk96_weatherdamage(void)
|
|||
{
|
||||
if (ability == ABILITY_ICE_BODY
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND)
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER))
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)
|
||||
&& !BATTLER_MAX_HP(gBattlerAttacker)
|
||||
&& !gStatuses3[gBattlerAttacker] & STATUS3_HEAL_BLOCK)
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
if (gBattleMoveDamage == 0)
|
||||
|
@ -7493,6 +7495,7 @@ static void atk96_weatherdamage(void)
|
|||
else if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)
|
||||
&& ability != ABILITY_SNOW_CLOAK
|
||||
&& ability != ABILITY_OVERCOAT
|
||||
&& ability != ABILITY_ICE_BODY
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND)
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER))
|
||||
{
|
||||
|
|
|
@ -561,11 +561,54 @@ void BattleScriptPop(void)
|
|||
gBattlescriptCurrInstr = gBattleResources->battleScriptsStack->ptr[--gBattleResources->battleScriptsStack->size];
|
||||
}
|
||||
|
||||
static bool32 IsGravityPreventingMove(u32 move)
|
||||
{
|
||||
if (!(gFieldStatuses & STATUS_FIELD_GRAVITY))
|
||||
return FALSE;
|
||||
|
||||
switch (move)
|
||||
{
|
||||
case MOVE_BOUNCE:
|
||||
case MOVE_FLY:
|
||||
case MOVE_FLYING_PRESS:
|
||||
case MOVE_HI_JUMP_KICK:
|
||||
case MOVE_JUMP_KICK:
|
||||
case MOVE_MAGNET_RISE:
|
||||
case MOVE_SKY_DROP:
|
||||
case MOVE_SPLASH:
|
||||
case MOVE_TELEKINESIS:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 IsHealBlockPreventingMove(u8 battler, u32 move)
|
||||
{
|
||||
if (!(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
return FALSE;
|
||||
|
||||
switch (gBattleMoves[move].effect)
|
||||
{
|
||||
case EFFECT_ABSORB:
|
||||
case EFFECT_MORNING_SUN:
|
||||
case EFFECT_MOONLIGHT:
|
||||
case EFFECT_RESTORE_HP:
|
||||
case EFFECT_REST:
|
||||
case EFFECT_ROOST:
|
||||
case EFFECT_HEALING_WISH:
|
||||
case EFFECT_WISH:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
u8 TrySetCantSelectMoveBattleScript(void)
|
||||
{
|
||||
u8 limitations = 0;
|
||||
u16 move = gBattleMons[gActiveBattler].moves[gBattleBufferB[gActiveBattler][2]];
|
||||
u8 holdEffect;
|
||||
u32 move = gBattleMons[gActiveBattler].moves[gBattleBufferB[gActiveBattler][2]];
|
||||
u32 holdEffect = GetBattlerHoldEffect(gActiveBattler, TRUE);
|
||||
u16* choicedMove = &gBattleStruct->choicedMove[gActiveBattler];
|
||||
|
||||
if (gDisableStructs[gActiveBattler].disabledMove == move && move != 0)
|
||||
|
@ -580,7 +623,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
|||
else
|
||||
{
|
||||
gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingDisabledMove;
|
||||
limitations = 1;
|
||||
limitations++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -629,14 +672,38 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (gBattleMons[gActiveBattler].item == ITEM_ENIGMA_BERRY)
|
||||
holdEffect = gEnigmaBerries[gActiveBattler].holdEffect;
|
||||
else
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item);
|
||||
if (IsGravityPreventingMove(move))
|
||||
{
|
||||
gCurrentMove = move;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
|
||||
{
|
||||
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGravityInPalace;
|
||||
gProtectStructs[gActiveBattler].flag_x10 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGravity;
|
||||
limitations++;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsHealBlockPreventingMove(gActiveBattler, move))
|
||||
{
|
||||
gCurrentMove = move;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
|
||||
{
|
||||
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveHealBlockInPalace;
|
||||
gProtectStructs[gActiveBattler].flag_x10 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveHealBlock;
|
||||
limitations++;
|
||||
}
|
||||
}
|
||||
|
||||
gPotentialItemEffectBattler = gActiveBattler;
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != move)
|
||||
if (HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != move)
|
||||
{
|
||||
gCurrentMove = *choicedMove;
|
||||
gLastUsedItem = gBattleMons[gActiveBattler].item;
|
||||
|
@ -650,6 +717,20 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
|||
limitations++;
|
||||
}
|
||||
}
|
||||
else if (holdEffect == HOLD_EFFECT_ASSAULT_VEST && gBattleMoves[move].power == 0)
|
||||
{
|
||||
gCurrentMove = move;
|
||||
gLastUsedItem = gBattleMons[gActiveBattler].item;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
|
||||
{
|
||||
gProtectStructs[gActiveBattler].flag_x10 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveAssaultVest;
|
||||
limitations++;
|
||||
}
|
||||
}
|
||||
|
||||
if (gBattleMons[gActiveBattler].pp[gBattleBufferB[gActiveBattler][2]] == 0)
|
||||
{
|
||||
|
@ -669,34 +750,35 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
|||
|
||||
u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
|
||||
{
|
||||
u8 holdEffect;
|
||||
u8 holdEffect = GetBattlerHoldEffect(battlerId, TRUE);
|
||||
u16 *choicedMove = &gBattleStruct->choicedMove[battlerId];
|
||||
s32 i;
|
||||
|
||||
if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
|
||||
holdEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||
else
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[battlerId].item);
|
||||
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].moves[i] == 0 && check & MOVE_LIMITATION_ZEROMOVE)
|
||||
unusableMoves |= gBitTable[i];
|
||||
if (gBattleMons[battlerId].pp[i] == 0 && check & MOVE_LIMITATION_PP)
|
||||
else if (gBattleMons[battlerId].pp[i] == 0 && check & MOVE_LIMITATION_PP)
|
||||
unusableMoves |= gBitTable[i];
|
||||
if (gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove && check & MOVE_LIMITATION_DISABLED)
|
||||
else if (gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove && check & MOVE_LIMITATION_DISABLED)
|
||||
unusableMoves |= gBitTable[i];
|
||||
if (gBattleMons[battlerId].moves[i] == gLastMoves[battlerId] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[battlerId].status2 & STATUS2_TORMENT)
|
||||
else if (gBattleMons[battlerId].moves[i] == gLastMoves[battlerId] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[battlerId].status2 & STATUS2_TORMENT)
|
||||
unusableMoves |= gBitTable[i];
|
||||
if (gDisableStructs[battlerId].tauntTimer1 && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0)
|
||||
else if (gDisableStructs[battlerId].tauntTimer1 && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0)
|
||||
unusableMoves |= gBitTable[i];
|
||||
if (GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i]) && check & MOVE_LIMITATION_IMPRISION)
|
||||
else if (GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i]) && check & MOVE_LIMITATION_IMPRISION)
|
||||
unusableMoves |= gBitTable[i];
|
||||
if (gDisableStructs[battlerId].encoreTimer1 && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i])
|
||||
else if (gDisableStructs[battlerId].encoreTimer1 && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i])
|
||||
unusableMoves |= gBitTable[i];
|
||||
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != gBattleMons[battlerId].moves[i])
|
||||
else if (HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != gBattleMons[battlerId].moves[i])
|
||||
unusableMoves |= gBitTable[i];
|
||||
else if (holdEffect == HOLD_EFFECT_ASSAULT_VEST && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0)
|
||||
unusableMoves |= gBitTable[i];
|
||||
else if (IsGravityPreventingMove(gBattleMons[battlerId].moves[i]))
|
||||
unusableMoves |= gBitTable[i];
|
||||
else if (IsHealBlockPreventingMove(battlerId, gBattleMons[battlerId].moves[i]))
|
||||
unusableMoves |= gBitTable[i];
|
||||
}
|
||||
return unusableMoves;
|
||||
|
@ -1304,7 +1386,7 @@ u8 DoBattlerEndTurnEffects(void)
|
|||
{
|
||||
if (ability == ABILITY_POISON_HEAL)
|
||||
{
|
||||
if (!BATTLER_MAX_HP(gActiveBattler))
|
||||
if (!BATTLER_MAX_HP(gActiveBattler) && !(gStatuses3[gActiveBattler] & STATUS3_HEAL_BLOCK))
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8;
|
||||
if (gBattleMoveDamage == 0)
|
||||
|
@ -1332,7 +1414,7 @@ u8 DoBattlerEndTurnEffects(void)
|
|||
{
|
||||
if (ability == ABILITY_POISON_HEAL)
|
||||
{
|
||||
if (!BATTLER_MAX_HP(gActiveBattler))
|
||||
if (!BATTLER_MAX_HP(gActiveBattler) && !(gStatuses3[gActiveBattler] & STATUS3_HEAL_BLOCK))
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8;
|
||||
if (gBattleMoveDamage == 0)
|
||||
|
@ -2617,7 +2699,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||
case ABILITY_RAIN_DISH:
|
||||
if (WEATHER_HAS_EFFECT
|
||||
&& (gBattleWeather & WEATHER_RAIN_ANY)
|
||||
&& gBattleMons[battler].maxHP > gBattleMons[battler].hp)
|
||||
&& !BATTLER_MAX_HP(battler)
|
||||
&& !(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_RainDishActivates);
|
||||
gBattleMoveDamage = gBattleMons[battler].maxHP / 16;
|
||||
|
@ -2770,7 +2853,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||
}
|
||||
if (effect == 1) // Drain Hp ability.
|
||||
{
|
||||
if (gBattleMons[battler].maxHP == gBattleMons[battler].hp)
|
||||
if (BATTLER_MAX_HP(battler) || gStatuses3[battler] & STATUS3_HEAL_BLOCK)
|
||||
{
|
||||
if ((gProtectStructs[gBattlerAttacker].notFirstStrike))
|
||||
gBattlescriptCurrInstr = BattleScript_MonMadeMoveUseless;
|
||||
|
|
Loading…
Reference in a new issue