Bugfixes for Knock Off, Cover, Thief, Ceaseless Edge and Stone Axe (#7326)
This commit is contained in:
parent
939e168c04
commit
73a2e5104e
@ -588,7 +588,8 @@ struct BattlerState
|
||||
u32 pursuitTarget:1;
|
||||
u32 stompingTantrumTimer:2;
|
||||
u32 canPickupItem:1;
|
||||
u32 padding:16;
|
||||
u32 itemCanBeKnockedOff:1;
|
||||
u32 padding:15;
|
||||
// End of Word
|
||||
};
|
||||
|
||||
|
||||
@ -363,7 +363,6 @@ enum MoveEffects
|
||||
MOVE_EFFECT_REMOVE_ARG_TYPE,
|
||||
MOVE_EFFECT_RECHARGE,
|
||||
MOVE_EFFECT_RAGE,
|
||||
MOVE_EFFECT_STEAL_ITEM,
|
||||
MOVE_EFFECT_PREVENT_ESCAPE,
|
||||
MOVE_EFFECT_NIGHTMARE,
|
||||
MOVE_EFFECT_ALL_STATS_UP,
|
||||
@ -399,8 +398,6 @@ enum MoveEffects
|
||||
MOVE_EFFECT_TRAP_BOTH,
|
||||
MOVE_EFFECT_ROUND,
|
||||
MOVE_EFFECT_DIRE_CLAW,
|
||||
MOVE_EFFECT_STEALTH_ROCK,
|
||||
MOVE_EFFECT_SPIKES,
|
||||
MOVE_EFFECT_SYRUP_BOMB,
|
||||
MOVE_EFFECT_FLORAL_HEALING,
|
||||
MOVE_EFFECT_SECRET_POWER,
|
||||
@ -414,6 +411,11 @@ enum MoveEffects
|
||||
MOVE_EFFECT_LIGHT_SCREEN,
|
||||
MOVE_EFFECT_SALT_CURE,
|
||||
MOVE_EFFECT_EERIE_SPELL,
|
||||
|
||||
// Max move effects happen earlier in the execution chain.
|
||||
// For example stealth rock from G-Max Stonesurge is set up before abilities but from Stone Axe after.
|
||||
// Stone Axe can also fail to set up rocks if user faints where as Stonesurge will always go up.
|
||||
// This means we need to be careful if we want to re-use those effects for (new) vanilla moves
|
||||
MOVE_EFFECT_RAISE_TEAM_ATTACK,
|
||||
MOVE_EFFECT_RAISE_TEAM_DEFENSE,
|
||||
MOVE_EFFECT_RAISE_TEAM_SPEED,
|
||||
@ -455,11 +457,14 @@ enum MoveEffects
|
||||
MOVE_EFFECT_LOWER_EVASIVENESS_SIDE,
|
||||
MOVE_EFFECT_AROMATHERAPY,
|
||||
MOVE_EFFECT_CONFUSE_SIDE,
|
||||
MOVE_EFFECT_STEELSURGE,
|
||||
MOVE_EFFECT_STEELSURGE, // Steel type rocks
|
||||
MOVE_EFFECT_STEALTH_ROCK, // Max Move rocks, not to be confused for rocks set up from Ceasless Edge (same but differ in execution order)
|
||||
MOVE_EFFECT_TORMENT_SIDE,
|
||||
MOVE_EFFECT_LOWER_SPEED_2_SIDE,
|
||||
MOVE_EFFECT_FIRE_SPIN_SIDE,
|
||||
MOVE_EFFECT_FIXED_POWER,
|
||||
// Max move effects end. They can be used for (custom) normal moves.
|
||||
|
||||
NUM_MOVE_EFFECTS
|
||||
};
|
||||
|
||||
|
||||
@ -155,6 +155,7 @@ enum BattleMoveEffects
|
||||
EFFECT_BRICK_BREAK,
|
||||
EFFECT_YAWN,
|
||||
EFFECT_KNOCK_OFF,
|
||||
EFFECT_STEAL_ITEM,
|
||||
EFFECT_ENDEAVOR,
|
||||
EFFECT_POWER_BASED_ON_USER_HP,
|
||||
EFFECT_SKILL_SWAP,
|
||||
@ -351,6 +352,8 @@ enum BattleMoveEffects
|
||||
EFFECT_SMACK_DOWN,
|
||||
EFFECT_ICE_SPINNER, // Removes terrain unless attacker is removed from field either by fainting or ejected out
|
||||
EFFECT_STEEL_ROLLER, // Will fail if there is no terrain up but removes it regardless if attacker is removed from field or not
|
||||
EFFECT_STONE_AXE, // Not to be confused with MOVE_EFFECT_STEALTH_ROCK. They have two different activation timings.
|
||||
EFFECT_CEASELESS_EDGE, // Same applies to spikes
|
||||
NUM_BATTLE_MOVE_EFFECTS,
|
||||
};
|
||||
|
||||
|
||||
@ -260,7 +260,6 @@ enum MoveEndEffects
|
||||
MOVEEND_ATTACKER_VISIBLE,
|
||||
MOVEEND_TARGET_VISIBLE,
|
||||
MOVEEND_ITEM_EFFECTS_TARGET,
|
||||
MOVEEND_FIRST_MOVE_BLOCK,
|
||||
MOVEEND_ITEM_EFFECTS_ALL,
|
||||
MOVEEND_SYMBIOSIS,
|
||||
MOVEEND_KINGSROCK, // These item effects will occur each strike of a multi-hit move
|
||||
@ -271,7 +270,7 @@ enum MoveEndEffects
|
||||
MOVEEND_DEFROST,
|
||||
MOVEEND_NEXT_TARGET, // Everything up until here is handled for each strike of a spread move
|
||||
MOVEEND_MULTIHIT_MOVE,
|
||||
MOVEEND_SECOND_MOVE_BLOCK,
|
||||
MOVEEND_MOVE_BLOCK,
|
||||
MOVEEND_ITEM_EFFECTS_ATTACKER,
|
||||
MOVEEND_ABILITY_BLOCK,
|
||||
MOVEEND_SHEER_FORCE, // If move is Sheer Force affected, skip until Opportunist
|
||||
|
||||
@ -5117,6 +5117,69 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EFFECT_STEAL_ITEM:
|
||||
{
|
||||
bool32 canSteal = FALSE;
|
||||
|
||||
if (B_TRAINERS_KNOCK_OFF_ITEMS == TRUE)
|
||||
canSteal = TRUE;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || IsOnPlayerSide(battlerAtk))
|
||||
canSteal = TRUE;
|
||||
|
||||
if (canSteal && aiData->items[battlerAtk] == ITEM_NONE
|
||||
&& aiData->items[battlerDef] != ITEM_NONE
|
||||
&& CanBattlerGetOrLoseItem(battlerDef, aiData->items[battlerDef])
|
||||
&& CanBattlerGetOrLoseItem(battlerAtk, aiData->items[battlerDef])
|
||||
&& !HasMoveWithEffect(battlerAtk, EFFECT_ACROBATICS)
|
||||
&& aiData->abilities[battlerDef] != ABILITY_STICKY_HOLD)
|
||||
{
|
||||
switch (aiData->holdEffects[battlerDef])
|
||||
{
|
||||
case HOLD_EFFECT_NONE:
|
||||
break;
|
||||
case HOLD_EFFECT_CHOICE_BAND:
|
||||
case HOLD_EFFECT_CHOICE_SCARF:
|
||||
case HOLD_EFFECT_CHOICE_SPECS:
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_TOXIC_ORB:
|
||||
if (ShouldPoison(battlerAtk, battlerAtk))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_FLAME_ORB:
|
||||
if (ShouldBurn(battlerAtk, battlerAtk, aiData->abilities[battlerAtk]))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_BLACK_SLUDGE:
|
||||
if (IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_IRON_BALL:
|
||||
if (HasMoveWithEffect(battlerAtk, EFFECT_FLING))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_LAGGING_TAIL:
|
||||
case HOLD_EFFECT_STICKY_BARB:
|
||||
break;
|
||||
default:
|
||||
ADJUST_SCORE(WEAK_EFFECT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EFFECT_STONE_AXE:
|
||||
case EFFECT_CEASELESS_EDGE:
|
||||
if (AI_ShouldSetUpHazards(battlerAtk, battlerDef, aiData));
|
||||
{
|
||||
if (gDisableStructs[battlerAtk].isFirstTurn)
|
||||
ADJUST_SCORE(BEST_EFFECT);
|
||||
else
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // move effect checks
|
||||
@ -5256,68 +5319,6 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
else if (GetItemPocket(aiData->items[battlerDef]) == POCKET_BERRIES || aiData->holdEffects[battlerDef] == HOLD_EFFECT_GEMS)
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case MOVE_EFFECT_STEAL_ITEM:
|
||||
{
|
||||
bool32 canSteal = FALSE;
|
||||
|
||||
if (B_TRAINERS_KNOCK_OFF_ITEMS == TRUE)
|
||||
canSteal = TRUE;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || IsOnPlayerSide(battlerAtk))
|
||||
canSteal = TRUE;
|
||||
|
||||
if (canSteal && aiData->items[battlerAtk] == ITEM_NONE
|
||||
&& aiData->items[battlerDef] != ITEM_NONE
|
||||
&& CanBattlerGetOrLoseItem(battlerDef, aiData->items[battlerDef])
|
||||
&& CanBattlerGetOrLoseItem(battlerAtk, aiData->items[battlerDef])
|
||||
&& !HasMoveWithEffect(battlerAtk, EFFECT_ACROBATICS)
|
||||
&& aiData->abilities[battlerDef] != ABILITY_STICKY_HOLD)
|
||||
{
|
||||
switch (aiData->holdEffects[battlerDef])
|
||||
{
|
||||
case HOLD_EFFECT_NONE:
|
||||
break;
|
||||
case HOLD_EFFECT_CHOICE_BAND:
|
||||
case HOLD_EFFECT_CHOICE_SCARF:
|
||||
case HOLD_EFFECT_CHOICE_SPECS:
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_TOXIC_ORB:
|
||||
if (ShouldPoison(battlerAtk, battlerAtk))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_FLAME_ORB:
|
||||
if (ShouldBurn(battlerAtk, battlerAtk, aiData->abilities[battlerAtk]))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_BLACK_SLUDGE:
|
||||
if (IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_IRON_BALL:
|
||||
if (HasMoveWithEffect(battlerAtk, EFFECT_FLING))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case HOLD_EFFECT_LAGGING_TAIL:
|
||||
case HOLD_EFFECT_STICKY_BARB:
|
||||
break;
|
||||
default:
|
||||
ADJUST_SCORE(WEAK_EFFECT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_STEALTH_ROCK:
|
||||
case MOVE_EFFECT_SPIKES:
|
||||
if (AI_ShouldSetUpHazards(battlerAtk, battlerDef, aiData));
|
||||
{
|
||||
if (gDisableStructs[battlerAtk].isFirstTurn)
|
||||
ADJUST_SCORE(BEST_EFFECT);
|
||||
else
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_FEINT:
|
||||
if (GetMoveEffect(predictedMove) == EFFECT_PROTECT)
|
||||
ADJUST_SCORE(GOOD_EFFECT);
|
||||
@ -5375,7 +5376,6 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
|
||||
// Effects that are encouraged on the first turn of battle
|
||||
static s32 AI_ForceSetupFirstTurn(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
{
|
||||
u8 i;
|
||||
if (IS_TARGETING_PARTNER(battlerAtk, battlerDef)
|
||||
|| gBattleResults.battleTurnCounter != 0)
|
||||
return score;
|
||||
@ -5473,27 +5473,10 @@ static s32 AI_ForceSetupFirstTurn(u32 battlerAtk, u32 battlerDef, u32 move, s32
|
||||
case EFFECT_CHILLY_RECEPTION:
|
||||
case EFFECT_GEOMANCY:
|
||||
case EFFECT_VICTORY_DANCE:
|
||||
case EFFECT_CEASELESS_EDGE:
|
||||
case EFFECT_STONE_AXE:
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case EFFECT_HIT:
|
||||
{
|
||||
// TEMPORARY - should applied to all moves regardless of EFFECT
|
||||
// Consider move effects
|
||||
u32 additionalEffectCount = GetMoveAdditionalEffectCount(move);
|
||||
for (i = 0; i < additionalEffectCount; i++)
|
||||
{
|
||||
const struct AdditionalEffect *additionalEffect = GetMoveAdditionalEffectById(move, i);
|
||||
switch (additionalEffect->moveEffect)
|
||||
{
|
||||
case MOVE_EFFECT_STEALTH_ROCK:
|
||||
case MOVE_EFFECT_SPIKES:
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -964,8 +964,6 @@ static const u16 sProtectSuccessRates[] = {USHRT_MAX, USHRT_MAX / 2, USHRT_MAX /
|
||||
|
||||
static const u16 sFinalStrikeOnlyEffects[] =
|
||||
{
|
||||
MOVE_EFFECT_BUG_BITE,
|
||||
MOVE_EFFECT_STEAL_ITEM,
|
||||
MOVE_EFFECT_REMOVE_ARG_TYPE,
|
||||
MOVE_EFFECT_REMOVE_STATUS,
|
||||
MOVE_EFFECT_RECOIL_HP_25,
|
||||
@ -2749,6 +2747,14 @@ static void Cmd_datahpupdate(void)
|
||||
&& GetMoveCategory(gCurrentMove) != DAMAGE_CATEGORY_STATUS
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget))
|
||||
gBattleStruct->timesGotHit[GetBattlerSide(gBattlerTarget)][gBattlerPartyIndexes[gBattlerTarget]]++;
|
||||
|
||||
if (GetMoveEffect(gCurrentMove) == EFFECT_KNOCK_OFF
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& gBattleMons[gBattlerTarget].item != 0
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& CanBattlerGetOrLoseItem(gBattlerTarget, gBattleMons[gBattlerTarget].item)
|
||||
&& !NoAliveMonsForEitherParty())
|
||||
gBattleStruct->battlerState[gBattlerTarget].itemCanBeKnockedOff = TRUE;
|
||||
}
|
||||
|
||||
TryRestoreDamageAfterCheekPouch(battler);
|
||||
@ -3132,7 +3138,7 @@ void StealTargetItem(u8 battlerStealer, u8 battlerItem)
|
||||
|
||||
if (B_STEAL_WILD_ITEMS >= GEN_9
|
||||
&& !(gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_PALACE))
|
||||
&& MoveHasAdditionalEffect(gCurrentMove, MOVE_EFFECT_STEAL_ITEM)
|
||||
&& GetMoveEffect(gCurrentMove) == EFFECT_STEAL_ITEM
|
||||
&& battlerStealer == gBattlerAttacker) // ensure that Pickpocket isn't activating this
|
||||
{
|
||||
AddBagItem(gLastUsedItem, 1);
|
||||
@ -3289,10 +3295,8 @@ void SetMoveEffect(bool32 primary, bool32 certain)
|
||||
switch (gBattleScripting.moveEffect) // Set move effects which happen later on
|
||||
{
|
||||
case MOVE_EFFECT_STEALTH_ROCK:
|
||||
case MOVE_EFFECT_SPIKES:
|
||||
case MOVE_EFFECT_PAYDAY:
|
||||
case MOVE_EFFECT_BUG_BITE:
|
||||
case MOVE_EFFECT_STEAL_ITEM:
|
||||
activateAfterFaint = TRUE;
|
||||
break;
|
||||
}
|
||||
@ -3470,6 +3474,26 @@ void SetMoveEffect(bool32 primary, bool32 certain)
|
||||
}
|
||||
gBattlescriptCurrInstr++;
|
||||
break;
|
||||
case MOVE_EFFECT_BUG_BITE:
|
||||
if (GetBattlerHoldEffect(gEffectBattler, TRUE) == HOLD_EFFECT_JABOCA_BERRY)
|
||||
{
|
||||
// jaboca berry triggers instead of being stolen
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else if (GetItemPocket(gBattleMons[gEffectBattler].item) == POCKET_BERRIES
|
||||
&& battlerAbility != ABILITY_STICKY_HOLD)
|
||||
{
|
||||
// target loses their berry
|
||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||
gBattleMons[gEffectBattler].item = 0;
|
||||
CheckSetUnburden(gEffectBattler);
|
||||
|
||||
BtlController_EmitSetMonData(gEffectBattler, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item);
|
||||
MarkBattlerForControllerExec(gEffectBattler);
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite;
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_TRI_ATTACK:
|
||||
if (gBattleMons[gEffectBattler].status1)
|
||||
{
|
||||
@ -3638,35 +3662,6 @@ void SetMoveEffect(bool32 primary, bool32 certain)
|
||||
gBattleMons[gBattlerAttacker].status2 |= STATUS2_RAGE;
|
||||
gBattlescriptCurrInstr++;
|
||||
break;
|
||||
case MOVE_EFFECT_STEAL_ITEM:
|
||||
if (!CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item)
|
||||
|| gBattleMons[gBattlerAttacker].item != ITEM_NONE
|
||||
|| gBattleMons[gBattlerTarget].item == ITEM_NONE)
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else if (GetBattlerAbility(gBattlerTarget) == ABILITY_STICKY_HOLD)
|
||||
{
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_NoItemSteal;
|
||||
|
||||
gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
else
|
||||
{
|
||||
StealTargetItem(gBattlerAttacker, gBattlerTarget); // Attacker steals target item
|
||||
|
||||
if (!(B_STEAL_WILD_ITEMS >= GEN_9
|
||||
&& !(gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_PALACE))))
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].item = ITEM_NONE; // Item assigned later on with thief (see MOVEEND_CHANGED_ITEMS)
|
||||
gBattleStruct->changedItems[gBattlerAttacker] = gLastUsedItem; // Stolen item to be assigned later
|
||||
}
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_ItemSteal;
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_PREVENT_ESCAPE:
|
||||
gBattleMons[gBattlerTarget].status2 |= STATUS2_ESCAPE_PREVENTION;
|
||||
gDisableStructs[gBattlerTarget].battlerPreventingEscape = gBattlerAttacker;
|
||||
@ -3802,26 +3797,6 @@ void SetMoveEffect(bool32 primary, bool32 certain)
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectIncinerate;
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_BUG_BITE:
|
||||
if (GetBattlerHoldEffect(gEffectBattler, TRUE) == HOLD_EFFECT_JABOCA_BERRY)
|
||||
{
|
||||
// jaboca berry triggers instead of being stolen
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
else if (GetItemPocket(gBattleMons[gEffectBattler].item) == POCKET_BERRIES
|
||||
&& battlerAbility != ABILITY_STICKY_HOLD)
|
||||
{
|
||||
// target loses their berry
|
||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||
gBattleMons[gEffectBattler].item = 0;
|
||||
CheckSetUnburden(gEffectBattler);
|
||||
|
||||
BtlController_EmitSetMonData(gEffectBattler, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].item), &gBattleMons[gEffectBattler].item);
|
||||
MarkBattlerForControllerExec(gEffectBattler);
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite;
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_TRAP_BOTH:
|
||||
if (!(gBattleMons[gBattlerTarget].status2 & STATUS2_ESCAPE_PREVENTION) && !(gBattleMons[gBattlerAttacker].status2 & STATUS2_ESCAPE_PREVENTION))
|
||||
{
|
||||
@ -3877,18 +3852,6 @@ void SetMoveEffect(bool32 primary, bool32 certain)
|
||||
gBattlescriptCurrInstr = BattleScript_StealthRockActivates;
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_SPIKES:
|
||||
if (gSideTimers[GetBattlerSide(gEffectBattler)].spikesAmount < 3)
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SPIKESSCATTERED;
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
|
||||
if (gBattleStruct->isSkyBattle)
|
||||
gBattlescriptCurrInstr++;
|
||||
else
|
||||
gBattlescriptCurrInstr = BattleScript_SpikesActivates;
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_SYRUP_BOMB:
|
||||
if (!(gStatuses4[gEffectBattler] & STATUS4_SYRUP_BOMB))
|
||||
{
|
||||
@ -6073,47 +6036,6 @@ static void Cmd_playstatchangeanimation(void)
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 TryKnockOffBattleScript(u32 battlerDef)
|
||||
{
|
||||
if (gBattleMons[battlerDef].item != 0
|
||||
&& CanBattlerGetOrLoseItem(battlerDef, gBattleMons[battlerDef].item)
|
||||
&& !NoAliveMonsForEitherParty())
|
||||
{
|
||||
if (GetBattlerAbility(battlerDef) == ABILITY_STICKY_HOLD && IsBattlerAlive(battlerDef))
|
||||
{
|
||||
gBattlerAbility = battlerDef;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_StickyHoldActivates;
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 side = GetBattlerSide(battlerDef);
|
||||
|
||||
gLastUsedItem = gBattleMons[battlerDef].item;
|
||||
gBattleMons[battlerDef].item = 0;
|
||||
if (gBattleMons[battlerDef].ability != ABILITY_GORILLA_TACTICS)
|
||||
gBattleStruct->choicedMove[battlerDef] = 0;
|
||||
CheckSetUnburden(battlerDef);
|
||||
|
||||
// In Gen 5+, Knock Off removes the target's item rather than rendering it unusable.
|
||||
if (B_KNOCK_OFF_REMOVAL >= GEN_5)
|
||||
{
|
||||
BtlController_EmitSetMonData(battlerDef, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[battlerDef].item), &gBattleMons[battlerDef].item);
|
||||
MarkBattlerForControllerExec(battlerDef);
|
||||
}
|
||||
else
|
||||
{
|
||||
gWishFutureKnock.knockedOffMons[side] |= 1u << gBattlerPartyIndexes[battlerDef];
|
||||
}
|
||||
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_KnockedOff;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline bool32 TryTriggerSymbiosis(u32 battler, u32 ally)
|
||||
{
|
||||
return GetBattlerAbility(ally) == ABILITY_SYMBIOSIS
|
||||
@ -6323,6 +6245,233 @@ static bool32 HandleMoveEndAbilityBlock(u32 battlerAtk, u32 battlerDef, u32 move
|
||||
return effect;
|
||||
}
|
||||
|
||||
static bool32 HandleMoveEndMoveBlock(u32 moveEffect)
|
||||
{
|
||||
if (gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
|
||||
return FALSE;
|
||||
|
||||
u32 effect = FALSE;
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_KNOCK_OFF:
|
||||
if (gBattleStruct->battlerState[gBattlerTarget].itemCanBeKnockedOff && IsBattlerAlive(gBattlerAttacker))
|
||||
{
|
||||
u32 side = GetBattlerSide(gBattlerTarget);
|
||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||
gBattleMons[gBattlerTarget].item = 0;
|
||||
if (gBattleMons[gBattlerTarget].ability != ABILITY_GORILLA_TACTICS)
|
||||
gBattleStruct->choicedMove[gBattlerTarget] = 0;
|
||||
CheckSetUnburden(gBattlerTarget);
|
||||
|
||||
// In Gen 5+, Knock Off removes the target's item rather than rendering it unusable.
|
||||
if (B_KNOCK_OFF_REMOVAL >= GEN_5)
|
||||
{
|
||||
BtlController_EmitSetMonData(gBattlerTarget, B_COMM_TO_CONTROLLER, REQUEST_HELDITEM_BATTLE, 0, sizeof(gBattleMons[gBattlerTarget].item), &gBattleMons[gBattlerTarget].item);
|
||||
MarkBattlerForControllerExec(gBattlerTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
gWishFutureKnock.knockedOffMons[side] |= 1u << gBattlerPartyIndexes[gBattlerTarget];
|
||||
}
|
||||
|
||||
gBattleStruct->battlerState[gBattlerTarget].itemCanBeKnockedOff = FALSE;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_KnockedOff;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_STEAL_ITEM:
|
||||
if (!CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item)
|
||||
|| gBattleMons[gBattlerAttacker].item != ITEM_NONE
|
||||
|| gBattleMons[gBattlerTarget].item == ITEM_NONE
|
||||
|| !IsBattlerAlive(gBattlerAttacker)
|
||||
|| !IsBattlerTurnDamaged(gBattlerTarget))
|
||||
{
|
||||
effect = FALSE;
|
||||
}
|
||||
else if (GetBattlerAbility(gBattlerTarget) == ABILITY_STICKY_HOLD)
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_NoItemSteal;
|
||||
|
||||
gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
effect = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
StealTargetItem(gBattlerAttacker, gBattlerTarget); // Attacker steals target item
|
||||
|
||||
if (!(B_STEAL_WILD_ITEMS >= GEN_9
|
||||
&& !(gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_PALACE))))
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].item = ITEM_NONE; // Item assigned later on with thief (see MOVEEND_CHANGED_ITEMS)
|
||||
gBattleStruct->changedItems[gBattlerAttacker] = gLastUsedItem; // Stolen item to be assigned later
|
||||
}
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_ItemSteal;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_HIT_SWITCH_TARGET:
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& !(gStatuses3[BATTLE_PARTNER(gBattlerTarget)] & STATUS3_COMMANDER))
|
||||
{
|
||||
u32 targetAbility = GetBattlerAbility(gBattlerTarget);
|
||||
if (targetAbility == ABILITY_GUARD_DOG)
|
||||
return FALSE;
|
||||
|
||||
BattleScriptPushCursor();
|
||||
if (targetAbility == ABILITY_SUCTION_CUPS)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_AbilityPreventsPhasingOutRet;
|
||||
}
|
||||
else if (gStatuses3[gBattlerTarget] & STATUS3_ROOTED)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_PrintMonIsRootedRet;
|
||||
}
|
||||
else if (GetActiveGimmick(gBattlerTarget) == GIMMICK_DYNAMAX)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_HitSwitchTargetDynamaxed;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleScripting.switchCase = B_SWITCH_HIT;
|
||||
gBattlescriptCurrInstr = BattleScript_TryHitSwitchTarget;
|
||||
}
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_SMACK_DOWN:
|
||||
if (!IsBattlerGrounded(gBattlerTarget)
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove))
|
||||
{
|
||||
gStatuses3[gBattlerTarget] |= STATUS3_SMACKED_DOWN;
|
||||
gStatuses3[gBattlerTarget] &= ~(STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS | STATUS3_ON_AIR);
|
||||
BattleScriptPush(gBattlescriptCurrInstr);
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectSmackDown;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_RECOIL_IF_MISS:
|
||||
if (IsBattlerAlive(gBattlerAttacker)
|
||||
&& (!IsBattlerTurnDamaged(gBattlerTarget) || gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT)
|
||||
&& !gBattleStruct->noTargetPresent)
|
||||
{
|
||||
if (B_RECOIL_IF_MISS_DMG >= GEN_5 || (B_CRASH_IF_TARGET_IMMUNE == GEN_4 && gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_DOESNT_AFFECT_FOE))
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerAttacker) / 2;
|
||||
else if (B_RECOIL_IF_MISS_DMG == GEN_4 && (GetNonDynamaxMaxHP(gBattlerTarget) / 2) < gBattleStruct->moveDamage[gBattlerTarget])
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerTarget) / 2;
|
||||
else // Fallback if B_RECOIL_IF_MISS_DMG is set to gen3 or lower.
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerTarget) / 2;
|
||||
|
||||
if (gBattleStruct->moveDamage[gBattlerAttacker] == 0)
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = 1;
|
||||
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_RecoilIfMiss;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_RECOIL:
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget) && IsBattlerAlive(gBattlerAttacker))
|
||||
{
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = max(1, gBattleStruct->moveDamage[gBattlerTarget] * max(1, GetMoveRecoil(gCurrentMove)) / 100);
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_EXPLOSION:
|
||||
if (!IsAbilityOnField(ABILITY_DAMP))
|
||||
{
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = 0;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_FaintAttackerForExplosion;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_MAX_HP_50_RECOIL:
|
||||
case EFFECT_MIND_BLOWN:
|
||||
if (IsBattlerAlive(gBattlerAttacker)
|
||||
&& !(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_FAILED)
|
||||
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
||||
{
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = (GetNonDynamaxMaxHP(gBattlerAttacker) + 1) / 2; // Half of Max HP Rounded UP
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MaxHp50Recoil;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_CHLOROBLAST:
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget) && IsBattlerAlive(gBattlerAttacker))
|
||||
{
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = (GetNonDynamaxMaxHP(gBattlerAttacker) + 1) / 2; // Half of Max HP Rounded UP
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_RAPID_SPIN:
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget))
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_RapidSpinAway;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_FELL_STINGER:
|
||||
if (IsBattlerAlive(gBattlerAttacker)
|
||||
&& !IsBattlerAlive(gBattlerTarget)
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& !NoAliveMonsForEitherParty()
|
||||
&& CompareStat(gBattlerAttacker, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
{
|
||||
SET_STATCHANGER(STAT_ATK, GetGenConfig(GEN_CONFIG_FELL_STINGER_STAT_RAISE) >= GEN_7 ? 3 : 2, FALSE);
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_FellStingerRaisesStat;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_STONE_AXE:
|
||||
if (!(gSideStatuses[GetBattlerSide(gBattlerTarget)] & SIDE_STATUS_STEALTH_ROCK) && IsBattlerAlive(gBattlerAttacker))
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_POINTEDSTONESFLOAT;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_StealthRockActivates;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_CEASELESS_EDGE:
|
||||
if (gSideTimers[GetBattlerSide(gBattlerTarget)].spikesAmount < 3 && IsBattlerAlive(gBattlerAttacker))
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SPIKESSCATTERED;
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
if (gBattleStruct->isSkyBattle)
|
||||
{
|
||||
effect = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_SpikesActivates;
|
||||
effect = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
effect = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return effect;
|
||||
}
|
||||
|
||||
static void Cmd_moveend(void)
|
||||
{
|
||||
CMD_ARGS(u8 endMode, u8 endState);
|
||||
@ -6587,72 +6736,6 @@ static void Cmd_moveend(void)
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_FIRST_MOVE_BLOCK:
|
||||
if ((gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_1ST_HIT && IsBattlerAlive(gBattlerTarget))
|
||||
|| gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT
|
||||
|| gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
|
||||
{
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_KNOCK_OFF:
|
||||
if (!DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove))
|
||||
effect = TryKnockOffBattleScript(gBattlerTarget);
|
||||
break;
|
||||
case EFFECT_HIT_SWITCH_TARGET:
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& !(gStatuses3[BATTLE_PARTNER(gBattlerTarget)] & STATUS3_COMMANDER))
|
||||
{
|
||||
u32 targetAbility = GetBattlerAbility(gBattlerTarget);
|
||||
if (targetAbility == ABILITY_GUARD_DOG)
|
||||
{
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
}
|
||||
|
||||
effect = TRUE;
|
||||
BattleScriptPushCursor();
|
||||
if (targetAbility == ABILITY_SUCTION_CUPS)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_AbilityPreventsPhasingOutRet;
|
||||
}
|
||||
else if (gStatuses3[gBattlerTarget] & STATUS3_ROOTED)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_PrintMonIsRootedRet;
|
||||
}
|
||||
else if (GetActiveGimmick(gBattlerTarget) == GIMMICK_DYNAMAX)
|
||||
{
|
||||
gBattlescriptCurrInstr = BattleScript_HitSwitchTargetDynamaxed;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleScripting.switchCase = B_SWITCH_HIT;
|
||||
gBattlescriptCurrInstr = BattleScript_TryHitSwitchTarget;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EFFECT_SMACK_DOWN:
|
||||
if (!IsBattlerGrounded(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove))
|
||||
{
|
||||
gStatuses3[gBattlerTarget] |= STATUS3_SMACKED_DOWN;
|
||||
gStatuses3[gBattlerTarget] &= ~(STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS | STATUS3_ON_AIR);
|
||||
effect = TRUE;
|
||||
BattleScriptPush(gBattlescriptCurrInstr);
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectSmackDown;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_ITEM_EFFECTS_ALL: // item effects for all battlers
|
||||
if (ItemBattleEffects(ITEMEFFECT_MOVE_END, 0, FALSE))
|
||||
effect = TRUE;
|
||||
@ -6992,99 +7075,8 @@ static void Cmd_moveend(void)
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
}
|
||||
case MOVEEND_SECOND_MOVE_BLOCK:
|
||||
if (gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
|
||||
{
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_RECOIL_IF_MISS:
|
||||
if (IsBattlerAlive(gBattlerAttacker)
|
||||
&& (!IsBattlerTurnDamaged(gBattlerTarget) || gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_NO_EFFECT)
|
||||
&& !gBattleStruct->noTargetPresent)
|
||||
{
|
||||
if (B_RECOIL_IF_MISS_DMG >= GEN_5 || (B_CRASH_IF_TARGET_IMMUNE == GEN_4 && gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_DOESNT_AFFECT_FOE))
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerAttacker) / 2;
|
||||
else if (B_RECOIL_IF_MISS_DMG == GEN_4 && (GetNonDynamaxMaxHP(gBattlerTarget) / 2) < gBattleStruct->moveDamage[gBattlerTarget])
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerTarget) / 2;
|
||||
else // Fallback if B_RECOIL_IF_MISS_DMG is set to gen3 or lower.
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerTarget) / 2;
|
||||
|
||||
if (gBattleStruct->moveDamage[gBattlerAttacker] == 0)
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = 1;
|
||||
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_RecoilIfMiss;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_RECOIL:
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget) && IsBattlerAlive(gBattlerAttacker))
|
||||
{
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = max(1, gBattleStruct->moveDamage[gBattlerTarget] * max(1, GetMoveRecoil(gCurrentMove)) / 100);
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_EXPLOSION:
|
||||
if (!IsAbilityOnField(ABILITY_DAMP))
|
||||
{
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = 0;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_FaintAttackerForExplosion;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_MAX_HP_50_RECOIL:
|
||||
case EFFECT_MIND_BLOWN:
|
||||
if (IsBattlerAlive(gBattlerAttacker)
|
||||
&& !(gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_FAILED)
|
||||
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
||||
{
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = (GetNonDynamaxMaxHP(gBattlerAttacker) + 1) / 2; // Half of Max HP Rounded UP
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MaxHp50Recoil;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_CHLOROBLAST:
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget) && IsBattlerAlive(gBattlerAttacker))
|
||||
{
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = (GetNonDynamaxMaxHP(gBattlerAttacker) + 1) / 2; // Half of Max HP Rounded UP
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_RAPID_SPIN:
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget))
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_RapidSpinAway;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
case EFFECT_FELL_STINGER:
|
||||
if (IsBattlerAlive(gBattlerAttacker)
|
||||
&& !IsBattlerAlive(gBattlerTarget)
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& !NoAliveMonsForEitherParty()
|
||||
&& CompareStat(gBattlerAttacker, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
{
|
||||
SET_STATCHANGER(STAT_ATK, GetGenConfig(GEN_CONFIG_FELL_STINGER_STAT_RAISE) >= GEN_7 ? 3 : 2, FALSE);
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_FellStingerRaisesStat;
|
||||
effect = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case MOVEEND_MOVE_BLOCK:
|
||||
effect = HandleMoveEndMoveBlock(moveEffect);
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_ITEM_EFFECTS_ATTACKER:
|
||||
@ -7378,7 +7370,9 @@ static void Cmd_moveend(void)
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_ICE_SPINNER:
|
||||
if (IsBattlerAlive(gBattlerAttacker) && IsBattlerTurnDamaged(gBattlerTarget))
|
||||
if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget))
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_RemoveTerrain;
|
||||
|
||||
@ -839,10 +839,6 @@ static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3)
|
||||
const struct AdditionalEffect *additionalEffect = GetMoveAdditionalEffectById(move, i);
|
||||
switch (additionalEffect->moveEffect)
|
||||
{
|
||||
case MOVE_EFFECT_STEAL_ITEM:
|
||||
if ((additionalEffect->chance == 100 || additionalEffect->chance == 0))
|
||||
baseFromEffect += 3;
|
||||
break;
|
||||
case MOVE_EFFECT_THRASH:
|
||||
if (additionalEffect->self == TRUE)
|
||||
baseFromEffect += 3;
|
||||
|
||||
@ -4354,6 +4354,16 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
case ABILITYEFFECT_MOVE_END: // Think contact abilities.
|
||||
switch (gLastUsedAbility)
|
||||
{
|
||||
case ABILITY_STICKY_HOLD:
|
||||
if (gBattleStruct->battlerState[gBattlerTarget].itemCanBeKnockedOff && IsBattlerAlive(gBattlerTarget))
|
||||
{
|
||||
gBattleStruct->battlerState[gBattlerTarget].itemCanBeKnockedOff = FALSE;
|
||||
gBattlerAbility = gBattlerTarget;
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_StickyHoldActivates;
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_JUSTIFIED:
|
||||
if (!(gBattleStruct->moveResultFlags[battler] & MOVE_RESULT_NO_EFFECT)
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
@ -7045,6 +7055,12 @@ u32 ItemBattleEffects(enum ItemCaseId caseID, u32 battler, bool32 moveTurn)
|
||||
case ITEMEFFECT_MOVE_END:
|
||||
for (battler = 0; battler < gBattlersCount; battler++)
|
||||
{
|
||||
// If item can be knocked off berry activation will be blocked, but not other items
|
||||
if (gBattleStruct->battlerState[battler].itemCanBeKnockedOff
|
||||
&& (GetItemPocket(gBattleMons[battler].item) == POCKET_BERRIES
|
||||
|| GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_RESTORE_HP))
|
||||
continue;
|
||||
|
||||
gLastUsedItem = gBattleMons[battler].item;
|
||||
effect = ItemEffectMoveEnd(battler, GetBattlerHoldEffect(battler, TRUE));
|
||||
if (effect)
|
||||
|
||||
@ -992,6 +992,12 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] =
|
||||
.battleTvScore = 2,
|
||||
},
|
||||
|
||||
[EFFECT_STEAL_ITEM] =
|
||||
{
|
||||
.battleScript = BattleScript_EffectHit,
|
||||
.battleTvScore = 3,
|
||||
},
|
||||
|
||||
[EFFECT_ENDEAVOR] =
|
||||
{
|
||||
.battleScript = BattleScript_EffectEndeavor,
|
||||
@ -2230,4 +2236,16 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] =
|
||||
.battleScript = BattleScript_EffectSteelRoller,
|
||||
.battleTvScore = 0, // TODO: Assign points
|
||||
},
|
||||
|
||||
[EFFECT_STONE_AXE] =
|
||||
{
|
||||
.battleScript = BattleScript_EffectHit,
|
||||
.battleTvScore = 0, // TODO: Assign points
|
||||
},
|
||||
|
||||
[EFFECT_CEASELESS_EDGE] =
|
||||
{
|
||||
.battleScript = BattleScript_EffectHit,
|
||||
.battleTvScore = 0, // TODO: Assign points
|
||||
},
|
||||
};
|
||||
|
||||
@ -4481,7 +4481,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
|
||||
.description = COMPOUND_STRING(
|
||||
"While attacking, it may\n"
|
||||
"steal the foe's held item."),
|
||||
.effect = EFFECT_HIT,
|
||||
.effect = EFFECT_STEAL_ITEM,
|
||||
.power = B_UPDATED_MOVE_DATA >= GEN_6 ? 60 : 40,
|
||||
.type = TYPE_DARK,
|
||||
.accuracy = 100,
|
||||
@ -4490,9 +4490,6 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
|
||||
.priority = 0,
|
||||
.category = DAMAGE_CATEGORY_PHYSICAL,
|
||||
.makesContact = TRUE,
|
||||
.additionalEffects = ADDITIONAL_EFFECTS({
|
||||
.moveEffect = MOVE_EFFECT_STEAL_ITEM,
|
||||
}),
|
||||
.ignoresKingsRock = (B_UPDATED_MOVE_FLAGS == GEN_3 || B_UPDATED_MOVE_FLAGS == GEN_4),
|
||||
.meFirstBanned = TRUE,
|
||||
.metronomeBanned = TRUE,
|
||||
@ -9040,7 +9037,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
|
||||
.description = COMPOUND_STRING(
|
||||
"Cutely begs to obtain an\n"
|
||||
"item held by the foe."),
|
||||
.effect = EFFECT_HIT,
|
||||
.effect = EFFECT_STEAL_ITEM,
|
||||
.power = B_UPDATED_MOVE_DATA >= GEN_5 ? 60 : 40,
|
||||
.type = TYPE_NORMAL,
|
||||
.accuracy = 100,
|
||||
@ -9053,9 +9050,6 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
|
||||
.metronomeBanned = TRUE,
|
||||
.copycatBanned = TRUE,
|
||||
.assistBanned = TRUE,
|
||||
.additionalEffects = ADDITIONAL_EFFECTS({
|
||||
.moveEffect = MOVE_EFFECT_STEAL_ITEM,
|
||||
}),
|
||||
.contestEffect = CONTEST_EFFECT_APPEAL_AS_GOOD_AS_PREV_ONES,
|
||||
.contestCategory = CONTEST_CATEGORY_CUTE,
|
||||
.contestComboStarterId = 0,
|
||||
@ -19208,7 +19202,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
|
||||
.description = COMPOUND_STRING(
|
||||
"High critical hit ratio. Sets\n"
|
||||
"Splinters that hurt the foe."),
|
||||
.effect = EFFECT_HIT,
|
||||
.effect = EFFECT_STONE_AXE,
|
||||
.power = 65,
|
||||
.type = TYPE_ROCK,
|
||||
.accuracy = 90,
|
||||
@ -19219,8 +19213,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
|
||||
.makesContact = TRUE,
|
||||
.slicingMove = TRUE,
|
||||
.additionalEffects = ADDITIONAL_EFFECTS({
|
||||
.moveEffect = MOVE_EFFECT_STEALTH_ROCK,
|
||||
.chance = 100,
|
||||
.sheerForceBoost = SHEER_FORCE_BOOST,
|
||||
}),
|
||||
.battleAnimScript = gBattleAnimMove_StoneAxe,
|
||||
},
|
||||
@ -19534,7 +19527,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
|
||||
.description = COMPOUND_STRING(
|
||||
"High critical hit ratio. Sets\n"
|
||||
"Splinters that hurt the foe."),
|
||||
.effect = EFFECT_HIT,
|
||||
.effect = EFFECT_CEASELESS_EDGE,
|
||||
.power = 65,
|
||||
.type = TYPE_DARK,
|
||||
.accuracy = 90,
|
||||
@ -19545,8 +19538,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_ALL] =
|
||||
.makesContact = TRUE,
|
||||
.slicingMove = TRUE,
|
||||
.additionalEffects = ADDITIONAL_EFFECTS({
|
||||
.moveEffect = MOVE_EFFECT_SPIKES,
|
||||
.chance = 100,
|
||||
.sheerForceBoost = SHEER_FORCE_BOOST,
|
||||
}),
|
||||
.battleAnimScript = gBattleAnimMove_CeaselessEdge,
|
||||
},
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(MoveIsAffectedBySheerForce(MOVE_ELECTRO_SHOT) == TRUE);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
SINGLE_BATTLE_TEST("Sticky Hold prevents item theft")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_THIEF, MOVE_EFFECT_STEAL_ITEM));
|
||||
ASSUME(GetMoveEffect(MOVE_THIEF) == EFFECT_STEAL_ITEM);
|
||||
PLAYER(SPECIES_URSALUNA) { Item(ITEM_NONE); }
|
||||
OPPONENT(SPECIES_GASTRODON) { Ability(ABILITY_STICKY_HOLD); Item(ITEM_LIFE_ORB); }
|
||||
} WHEN {
|
||||
|
||||
@ -102,17 +102,14 @@ SINGLE_BATTLE_TEST("Air Balloon pops before it can be stolen with Magician")
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Air Balloon pops before it can be stolen with Thief or Covet")
|
||||
SINGLE_BATTLE_TEST("Air Balloon pops before it can be stolen by Thief")
|
||||
{
|
||||
u32 move;
|
||||
PARAMETRIZE { move = MOVE_THIEF; }
|
||||
PARAMETRIZE { move = MOVE_COVET; }
|
||||
GIVEN {
|
||||
ASSUME(MoveHasAdditionalEffect(move, MOVE_EFFECT_STEAL_ITEM) == TRUE);
|
||||
ASSUME(GetMoveEffect(MOVE_THIEF) == EFFECT_STEAL_ITEM);
|
||||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); };
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, move); }
|
||||
TURN { MOVE(opponent, MOVE_THIEF); }
|
||||
} SCENE {
|
||||
MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
|
||||
MESSAGE("Wobbuffet's Air Balloon popped!");
|
||||
|
||||
@ -170,7 +170,7 @@ SINGLE_BATTLE_TEST("Red Card does not activate if stolen by a move")
|
||||
bool32 activate;
|
||||
PARAMETRIZE { item = ITEM_NONE; activate = FALSE; }
|
||||
PARAMETRIZE { item = ITEM_POTION; activate = TRUE; }
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_THIEF, MOVE_EFFECT_STEAL_ITEM) == TRUE);
|
||||
ASSUME(GetMoveEffect(MOVE_THIEF) == EFFECT_STEAL_ITEM);
|
||||
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_RED_CARD); }
|
||||
|
||||
@ -132,23 +132,22 @@ SINGLE_BATTLE_TEST("White Herb wont have time to activate if it is knocked off o
|
||||
PARAMETRIZE { move = MOVE_KNOCK_OFF; }
|
||||
|
||||
GIVEN {
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_THIEF, MOVE_EFFECT_STEAL_ITEM) == TRUE);
|
||||
ASSUME(GetMoveEffect(MOVE_KNOCK_OFF) == EFFECT_KNOCK_OFF);
|
||||
ASSUME(GetMoveEffect(MOVE_THIEF) == EFFECT_STEAL_ITEM);
|
||||
PLAYER(SPECIES_SLUGMA) { Ability(ABILITY_WEAK_ARMOR); Item(ITEM_WHITE_HERB); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, move); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
|
||||
if (move == MOVE_THIEF) {
|
||||
MESSAGE("The opposing Wobbuffet stole Slugma's White Herb!");
|
||||
}
|
||||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
MESSAGE("Slugma's Weak Armor lowered its Defense!");
|
||||
MESSAGE("Slugma's Weak Armor raised its Speed!");
|
||||
if (move == MOVE_KNOCK_OFF) {
|
||||
MESSAGE("The opposing Wobbuffet knocked off Slugma's White Herb!");
|
||||
} else if (move == MOVE_THIEF) {
|
||||
MESSAGE("The opposing Wobbuffet stole Slugma's White Herb!");
|
||||
}
|
||||
NONE_OF {
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_CEASELESS_EDGE, MOVE_EFFECT_SPIKES) == TRUE);
|
||||
ASSUME(GetMoveEffect(MOVE_CEASELESS_EDGE) == EFFECT_CEASELESS_EDGE);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Ceaseless Edge sets up hazards after hitting the target")
|
||||
@ -62,3 +62,19 @@ SINGLE_BATTLE_TEST("Ceaseless Edge can set up to 3 layers of Spikes")
|
||||
MESSAGE("The opposing Wynaut was hurt by the spikes!");
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Ceaseless Edge fails to set up hazards if user faints")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ROCKY_HELMET); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_CEASELESS_EDGE); SEND_OUT(player, 1); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_CEASELESS_EDGE, player);
|
||||
HP_BAR(player);
|
||||
MESSAGE("Wobbuffet was hurt by the opposing Wobbuffet's Rocky Helmet!");
|
||||
NOT MESSAGE("Spikes were scattered on the ground all around the opposing team!");
|
||||
}
|
||||
}
|
||||
@ -43,7 +43,7 @@ DOUBLE_BATTLE_TEST("Dragon Tail switches the target with a random non-battler, n
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Dragon Tail does not fail if no replacements")
|
||||
SINGLE_BATTLE_TEST("Dragon Tail fails if no replacements")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
@ -56,7 +56,7 @@ SINGLE_BATTLE_TEST("Dragon Tail does not fail if no replacements")
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Dragon Tail does not fail if replacements fainted")
|
||||
SINGLE_BATTLE_TEST("Dragon Tail fails if replacements fainted")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
|
||||
@ -96,7 +96,10 @@ SINGLE_BATTLE_TEST("Ice Spinner doesn't fail if there is no terrain on the field
|
||||
TURN { MOVE(player, MOVE_ICE_SPINNER); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_ICE_SPINNER, player);
|
||||
NOT MESSAGE("But it failed!");
|
||||
NONE_OF {
|
||||
MESSAGE("But it failed!");
|
||||
MESSAGE("Mist swirled around the battlefield!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -99,6 +99,22 @@ SINGLE_BATTLE_TEST("Knock Off does not remove items through Substitute")
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Knock Off does not remove items through Substitute even if it breaks it")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WYNAUT);
|
||||
OPPONENT(SPECIES_WOBBUFFET) { MaxHP(4); HP(4); Item(ITEM_LEFTOVERS); };
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_KNOCK_OFF); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_KNOCK_OFF, player);
|
||||
MESSAGE("The opposing Wobbuffet's substitute faded!");
|
||||
NOT { ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ITEM_KNOCKOFF); }
|
||||
} THEN {
|
||||
EXPECT(opponent->item == ITEM_LEFTOVERS);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Knock Off does not remove items through Protect")
|
||||
{
|
||||
GIVEN {
|
||||
@ -229,18 +245,6 @@ DOUBLE_BATTLE_TEST("Knock Off does not trigger the opposing ally's Symbiosis")
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Knock Off doesn't knock off items from Pokemon behind substitutes")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_POKE_BALL); }
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_KNOCK_OFF); }
|
||||
} SCENE {
|
||||
NOT MESSAGE("Wobbuffet knocked off the opposing Wobbuffet's Poké Ball!");
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Knock Off does knock off Mega Stones from Pokemon that don't actually use them")
|
||||
{
|
||||
GIVEN {
|
||||
@ -360,3 +364,33 @@ SINGLE_BATTLE_TEST("Knock Off doesn't knock off begin-battle form-change hold it
|
||||
NOT MESSAGE("Wobbuffet knocked off the opposing Zamazenta's Rusted Shield!");
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Knock Off does not activate if user faints")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ROCKY_HELMET); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_KNOCK_OFF); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_KNOCK_OFF, player);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
|
||||
MESSAGE("Wobbuffet was hurt by the opposing Wobbuffet's Rocky Helmet!");
|
||||
MESSAGE("Wobbuffet fainted!");
|
||||
} THEN {
|
||||
EXPECT(opponent->item == ITEM_ROCKY_HELMET);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Knock Off doesn't remove item if it's prevented by Sticky Hold")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_MUK) { MaxHP(100); HP(51); Item(ITEM_ORAN_BERRY); Ability(ABILITY_STICKY_HOLD); }
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_KNOCK_OFF); }
|
||||
} SCENE {
|
||||
ABILITY_POPUP(opponent, ABILITY_STICKY_HOLD);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
|
||||
}
|
||||
}
|
||||
|
||||
94
test/battle/move_effect/stone_axe.c
Normal file
94
test/battle/move_effect/stone_axe.c
Normal file
@ -0,0 +1,94 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(GetMoveEffect(MOVE_STONE_AXE) == EFFECT_STONE_AXE);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Stone Axe sets up hazards after hitting the target")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { SWITCH(opponent, 1); }
|
||||
} SCENE {
|
||||
s32 maxHP = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
MESSAGE("2 sent out Wobbuffet!");
|
||||
HP_BAR(opponent, damage: maxHP / 8);
|
||||
MESSAGE("Pointed stones dug into the opposing Wobbuffet!");
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Stone Axe can set up pointed stones only once")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WYNAUT);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { SWITCH(opponent, 1); }
|
||||
} SCENE {
|
||||
s32 maxHP = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP);
|
||||
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
NOT MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
NOT MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
NOT MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
|
||||
MESSAGE("2 sent out Wynaut!");
|
||||
HP_BAR(opponent, damage: maxHP / 8);
|
||||
MESSAGE("Pointed stones dug into the opposing Wynaut!");
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Stone Axe sets up hazards after any ability activation")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_SKARMORY) { Ability(ABILITY_WEAK_ARMOR); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
ABILITY_POPUP(opponent, ABILITY_WEAK_ARMOR);
|
||||
MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Stone Axe fails to set up hazards if user faints")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ROCKY_HELMET); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); SEND_OUT(player, 1); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(player);
|
||||
MESSAGE("Wobbuffet was hurt by the opposing Wobbuffet's Rocky Helmet!");
|
||||
NOT MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_PAY_DAY, MOVE_EFFECT_PAYDAY));
|
||||
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_PAY_DAY, MOVE_EFFECT_PAYDAY, 0) == TRUE);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Pay Day Scatters coins around after it hits - singles")
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_THIEF, MOVE_EFFECT_STEAL_ITEM) == TRUE);
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_COVET, MOVE_EFFECT_STEAL_ITEM) == TRUE);
|
||||
ASSUME(GetMoveEffect(MOVE_THIEF == EFFECT_STEAL_ITEM));
|
||||
ASSUME(GetMoveEffect(MOVE_COVET == EFFECT_STEAL_ITEM));
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Thief and Covet steal target's held item")
|
||||
@ -127,3 +127,41 @@ WILD_BATTLE_TEST("Thief and Covet steal target's held item and it's added to Bag
|
||||
EXPECT_EQ(opponent->item, ITEM_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Thief and Covet can't steal target's held item if user faints before")
|
||||
{
|
||||
u32 move;
|
||||
PARAMETRIZE { move = MOVE_THIEF; }
|
||||
PARAMETRIZE { move = MOVE_COVET; }
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(1); };
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_ROCKY_HELMET); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, move); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, move, player);
|
||||
HP_BAR(opponent);
|
||||
NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ITEM_STEAL, opponent);
|
||||
} THEN {
|
||||
EXPECT_EQ(player->item, ITEM_NONE);
|
||||
EXPECT_EQ(opponent->item, ITEM_ROCKY_HELMET);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Thief and Covet: Berry activation happens before the item can be stolen")
|
||||
{
|
||||
u32 move;
|
||||
PARAMETRIZE { move = MOVE_THIEF; }
|
||||
PARAMETRIZE { move = MOVE_COVET; }
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WYNAUT);
|
||||
OPPONENT(SPECIES_WOBBUFFET) { MaxHP(200); HP(101); Item(ITEM_ORAN_BERRY); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, move); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, move, player);
|
||||
HP_BAR(opponent);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
|
||||
NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_ITEM_STEAL, opponent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,63 +3,19 @@
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_STONE_AXE, MOVE_EFFECT_STEALTH_ROCK) == TRUE);
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_G_MAX_STONESURGE, MOVE_EFFECT_STEALTH_ROCK));
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Stone Axe sets up hazards after hitting the target")
|
||||
SINGLE_BATTLE_TEST("Steath Rock: Rock from G-Max Stonesurge are set up before any ability activation")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
PLAYER(SPECIES_DREDNAW) { GigantamaxFactor(TRUE); }
|
||||
OPPONENT(SPECIES_SKARMORY) { Ability(ABILITY_WEAK_ARMOR); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { SWITCH(opponent, 1); }
|
||||
TURN { MOVE(player, MOVE_WATERFALL, gimmick: GIMMICK_DYNAMAX); }
|
||||
} SCENE {
|
||||
s32 maxHP = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_G_MAX_STONESURGE, player);
|
||||
MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
MESSAGE("2 sent out Wobbuffet!");
|
||||
HP_BAR(opponent, damage: maxHP / 8);
|
||||
MESSAGE("Pointed stones dug into the opposing Wobbuffet!");
|
||||
ABILITY_POPUP(opponent, ABILITY_WEAK_ARMOR);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Stone Axe can set up pointed stones only once")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WYNAUT);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { MOVE(player, MOVE_STONE_AXE); }
|
||||
TURN { SWITCH(opponent, 1); }
|
||||
} SCENE {
|
||||
s32 maxHP = GetMonData(&OPPONENT_PARTY[1], MON_DATA_MAX_HP);
|
||||
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
NOT MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
NOT MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STONE_AXE, player);
|
||||
HP_BAR(opponent);
|
||||
NOT MESSAGE("Pointed stones float in the air around the opposing team!");
|
||||
|
||||
MESSAGE("2 sent out Wynaut!");
|
||||
HP_BAR(opponent, damage: maxHP / 8);
|
||||
MESSAGE("Pointed stones dug into the opposing Wynaut!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(MoveHasAdditionalEffect(MOVE_MAKE_IT_RAIN, MOVE_EFFECT_PAYDAY));
|
||||
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_MAKE_IT_RAIN, MOVE_EFFECT_PAYDAY, 0) == TRUE);
|
||||
ASSUME(MoveHasAdditionalEffectSelf(MOVE_MAKE_IT_RAIN, MOVE_EFFECT_SP_ATK_MINUS_1));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user