mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-16 08:11:35 +02:00
CLOSES #1091, CLOSES #1097, CLOSES #1100, CLOSES #1104, CLOSES #1135, CLOSES #1155, CLOSES #1157, CLOSES #1158, CLOSES #1159, CLOSES #1160, CLOSES #1167, CLOSES #1208
This commit is contained in:
+54
-11
@@ -106,6 +106,10 @@ local TEXT_ASK_FORGET_SLOT = Strings.source("Which move should\nbe forgotten?")
|
||||
local TEXT_CANT_FORGET_HM = Strings.source("HM moves can't be\nforgotten now.")
|
||||
local TEXT_STOP_LEARNING = Strings.source("Stop learning\n%s?")
|
||||
|
||||
-- BattleText_EnemyIsAboutToUseWillPlayerChangeMon (data/text/battle.asm:222-231).
|
||||
local TEXT_ENEMY_ABOUT_TO_USE = Strings.source(
|
||||
"%s\nis about to use\v%s.\fWill %s\nchange POKéMON?")
|
||||
|
||||
-- _AskForgetMoveText, all three paragraphs (data/text/common_3.asm:141-165).
|
||||
local TEXT_ASK_FORGET_MOVE = Strings.source(
|
||||
"%s is\ntrying to learn\v%s.\fBut %s\ncan't learn more\vthan four moves."
|
||||
@@ -548,6 +552,14 @@ BattleState.PLAYER_PIC_TILES = 6
|
||||
-- box's own bottom centre.
|
||||
local PIC_RESIZE_TILES = { [0] = 6, [1] = 4, [2] = 2, [3] = 7, [4] = 5, [5] = 3 }
|
||||
|
||||
-- SUBSTATUS_UNDERGROUND / SUBSTATUS_FLYING, which BattleCommand_Charge sets on
|
||||
-- FLY and DIG only (engine/battle/effect_commands.asm:5478-5485); the port
|
||||
-- carries both as the volatile `vanished` flag.
|
||||
function BattleState.isVanished(mon)
|
||||
local volatiles = mon and mon.volatile
|
||||
return (volatiles and volatiles.vanished) and true or false
|
||||
end
|
||||
|
||||
function BattleState:drawPic(mon, back)
|
||||
-- During the intro slide the player-side pic belongs to presentSlide's
|
||||
-- backpic overlay, not to the baked bands (see BattleAnimView).
|
||||
@@ -571,6 +583,13 @@ function BattleState:drawPic(mon, back)
|
||||
-- The box is empty either because the animation running right now has
|
||||
-- cleared it, or because the last one ENDED with it cleared (picHidden).
|
||||
if (anim and anim.hidden) or self.picHidden[side] then return end
|
||||
-- Mid FLY / DIG the box is empty: DisappearUser ClearBoxes it
|
||||
-- (engine/battle/misc.asm:1-13), AppearUserRaiseSub puts it back on the
|
||||
-- stored attack (engine/battle/effect_commands.asm:2113-2117).
|
||||
if not (trainerBack or enemyTrainer) and BattleState.isVanished(mon)
|
||||
and not (self.vanishAnim and self.vanishAnim == self.anim) then
|
||||
return
|
||||
end
|
||||
local G = love.graphics
|
||||
local w, h = image:getDimensions()
|
||||
local px, py
|
||||
@@ -582,10 +601,12 @@ function BattleState:drawPic(mon, back)
|
||||
py = BattleState.PLAYER_PIC_TILE_Y * 8 + (box - h)
|
||||
boxTiles = BattleState.PLAYER_PIC_TILES
|
||||
else
|
||||
-- Bottom-aligned and horizontally centred inside the 7x7 box.
|
||||
-- PadFrontpic pads a short pic and never a long one
|
||||
-- (engine/gfx/load_pics.asm:342-386), so an oversized mod pic pins to the
|
||||
-- box's own corner at hlcoord 12, 0 rather than to a negative offset.
|
||||
local box = BattleState.ENEMY_PIC_TILES * 8
|
||||
px = BattleState.ENEMY_PIC_TILE_X * 8 + math.floor((box - w) / 2)
|
||||
py = BattleState.ENEMY_PIC_TILE_Y * 8 + (box - h)
|
||||
px = BattleState.ENEMY_PIC_TILE_X * 8 + math.max(0, math.floor((box - w) / 2))
|
||||
py = BattleState.ENEMY_PIC_TILE_Y * 8 + math.max(0, box - h)
|
||||
boxTiles = BattleState.ENEMY_PIC_TILES
|
||||
end
|
||||
-- One tile per two frames to the right, SlideBattlePicOut's own step.
|
||||
@@ -903,11 +924,12 @@ function BattleState:startAnim(key, opts)
|
||||
param = opts.param or 0,
|
||||
sfxOrder = audio.sfxOrder,
|
||||
ballPalette = opts.ballPalette,
|
||||
-- BGEffect_CheckFlyDigStatus reads wPlayerSubStatus3 / wEnemySubStatus3
|
||||
-- (engine/battle_anims/bg_effects.asm:2838-2851); the port keeps that bit
|
||||
-- on the mon's volatile table, not on the mon itself.
|
||||
flying = {
|
||||
player = self.battle and self.battle.player
|
||||
and self.battle.player.vanished or false,
|
||||
enemy = self.battle and self.battle.enemy
|
||||
and self.battle.enemy.vanished or false,
|
||||
player = BattleState.isVanished(self.battle and self.battle.player),
|
||||
enemy = BattleState.isVanished(self.battle and self.battle.enemy),
|
||||
},
|
||||
hooks = {
|
||||
-- anim_sound (engine/battle_anims/anim_commands.asm:1105) calls
|
||||
@@ -1365,6 +1387,13 @@ function BattleState:advanceQueue()
|
||||
end
|
||||
end
|
||||
end
|
||||
-- BattleCommand_Charge runs LoadMoveAnim BEFORE DisappearUser
|
||||
-- (engine/battle/effect_commands.asm:5459-5470), so FLY / DIG still draw
|
||||
-- the take-off or the burrow on the turn the substatus goes up; the box
|
||||
-- only empties once THIS animation is done with.
|
||||
if BattleState.isVanished(self:activeMon(event.side)) then
|
||||
self.vanishAnim = self.anim
|
||||
end
|
||||
elseif event.kind == "damage" and event.side then
|
||||
-- ANIM_x_DAMAGE is the MOVE's after-anim (effect_commands.asm:1963-1972),
|
||||
-- so only a move hit gets it; `animMove` is HandleWrap's (core.asm:1198-1203).
|
||||
@@ -1864,6 +1893,20 @@ function BattleState:update(_dt)
|
||||
return
|
||||
end
|
||||
|
||||
-- The prompt's earlier pages: PlaceYesNoBox only follows the LAST one
|
||||
-- (engine/battle/core.asm:3302-3305), so the mon is named and read first.
|
||||
if self.phase == "shift-intro" then
|
||||
if self.messageTimer > 0 then
|
||||
if input:wasPressed("a") or input:wasPressed("b") then
|
||||
self.messageTimer = 0
|
||||
end
|
||||
return
|
||||
end
|
||||
self:nextPage()
|
||||
if not self.messagePages then self.phase = "ask-shift" end
|
||||
return
|
||||
end
|
||||
|
||||
-- OfferSwitch's YesNoBox: YES opens PickSwitchMonInBattle, NO (and B) falls
|
||||
-- straight through to the enemy's send-out (engine/battle/core.asm:3305-3310).
|
||||
if self.phase == "ask-shift" then
|
||||
@@ -2464,13 +2507,13 @@ end
|
||||
-- (engine/battle/core.asm:3298-3304, data/text/battle.asm:222-231).
|
||||
function BattleState:offerShiftSwitch(mon)
|
||||
self.shiftIndex = 1
|
||||
self.phase = "ask-shift"
|
||||
local trainer = (self.battle.trainer and self.battle.trainer.name) or "Foe"
|
||||
local player = (self.save and self.save.player and self.save.player.name)
|
||||
or "GOLD"
|
||||
self.message = trainer .. " is about to use " .. self:name(mon)
|
||||
.. ". Will " .. player .. " change POKéMON?"
|
||||
self.messageTimer = MESSAGE_FRAMES
|
||||
-- The `para` splits this in two (data/text/battle.asm:222-231): the incoming
|
||||
-- mon is NAMED on its own page, and only the second carries the yes/no box.
|
||||
self:showPages(Strings(TEXT_ENEMY_ABOUT_TO_USE, trainer, self:name(mon), player))
|
||||
self.phase = self.messagePages and "shift-intro" or "ask-shift"
|
||||
end
|
||||
|
||||
function BattleState:answerUseNextMon(yes)
|
||||
|
||||
Reference in New Issue
Block a user