CLOSES #644, CLOSES #703, CLOSES #726, CLOSES #737, CLOSES #750, CLOSES #752, CLOSES #764, CLOSES #765, CLOSES #768, CLOSES #773, CLOSES #774, CLOSES #775, CLOSES #777, CLOSES #780, CLOSES #782

This commit is contained in:
bryanthaboi
2026-08-04 09:25:28 -04:00
parent 6cfc85ca83
commit f2d9b74490
52 changed files with 3099 additions and 252 deletions
+16 -2
View File
@@ -259,15 +259,29 @@ MoveEffects.primary = {
return { romText(battle.data, "_StatusChangesEliminatedText", "All STATUS changes\nare eliminated!") }
end,
-- substitute.asm reaches its PlayCurrentMoveAnimation / AnimationSubstitute
-- Bankswitch only inside the success branch, after `set HAS_SUBSTITUTE_UP`;
-- .alreadyHasSubstitute and .notEnoughHP fall straight through to PrintText,
-- so both failures print with no animation at all. That is load bearing
-- here: the SUBSTITUTE animation opens with SE_SLIDE_MON_OFF, which leaves
-- the user's pic hidden (BattleState.lua slideOff end state) until the doll
-- is drawn in its place -- and with no substituteHP raised there is no doll,
-- so a failed Substitute used to erase the user's sprite for the rest of the
-- battle (#644). The failed flag rides the message list so performMove can
-- peel the announcement-time anim row without matching on printed text.
SUBSTITUTE_EFFECT = function(battle, user)
if user.substituteHP then return { romText(battle.data, "_HasSubstituteText", "%s\nhas a SUBSTITUTE!", displayName(user)) } end
if user.substituteHP then
return { romText(battle.data, "_HasSubstituteText", "%s\nhas a SUBSTITUTE!", displayName(user)),
failed = true }
end
local cost = math.floor(user.mon.stats.hp / 4)
-- substitute.asm only fails on subtraction underflow (current HP
-- strictly below maxHP/4); at equality the substitute is built and
-- the user is left standing on exactly 0 HP (it faints only when
-- the engine next checks HP, not here)
if user.mon.hp < cost then
return { romText(battle.data, "_TooWeakSubstituteText", "Too weak to make\na SUBSTITUTE!") }
return { romText(battle.data, "_TooWeakSubstituteText", "Too weak to make\na SUBSTITUTE!"),
failed = true }
end
user.mon.hp = user.mon.hp - cost
user.substituteHP = cost + 1