fix merge conflicts with dev

This commit is contained in:
1jamie
2026-08-13 07:39:11 -05:00
60 changed files with 1900 additions and 251 deletions
+18 -18
View File
@@ -1619,26 +1619,26 @@ function Battle:useMove(attacker, defender, moveId)
return
end
-- Damage that skips the formula entirely (constantdamage).
local fixed = Effects.fixedDamage(def.effect, attacker, defender, self.random, def)
-- Damage that skips the formula entirely. The move's own power goes with
-- it: EFFECT_STATIC_DAMAGE's arm of BattleCommand_ConstantDamage reads
-- BATTLE_VARS_MOVE_POWER as the damage (effect_commands.asm:3157-3161).
local fixed = Effects.fixedDamage(def.effect, attacker, defender, self.random,
def.power)
if fixed then
-- StaticDamage's effect script runs resettypematchup after constantdamage
-- (data/moves/effects.asm): immunities still miss (Sonic Boom vs Ghost).
-- Flat damage is otherwise unscaled — no STAB / effectiveness multiply.
if def.effect == "EFFECT_STATIC_DAMAGE" then
local defTypes = (self:speciesDef(defender) or {}).types or defender.types
local matchups = self.data.type_chart and self.data.type_chart.matchups
local mult = Damage.typeMultiplier(def.type, defTypes, matchups)
if mult == 0 then
self:markMissed()
self:emit({ kind = "message",
text = "It doesn't affect " .. self:monName(defender) .. "..." })
return
end
-- The constant-damage effect list carries `resettypematchup` instead of
-- `stab`, and that command misses the move outright when the matchup byte
-- is 0 (effect_commands.asm:1480-1493) -- an immune target is the one
-- thing that stops SONIC BOOM, NIGHT SHADE or SUPER FANG.
local defenderTypes = (self:speciesDef(defender) or {}).types
or defender.types
local matchups = self.data.type_chart and self.data.type_chart.matchups
if Damage.typeMultiplier(def.type, defenderTypes, matchups) == 0 then
self:markMissed()
self:emit({ kind = "message",
text = "It doesn't affect " .. self:monName(defender) .. "..." })
return
end
self:dealDamage(attacker, defender, fixed, {
move = def, moveId = moveId, effectiveness = 10,
})
self:dealDamage(attacker, defender, fixed, { move = def, moveId = moveId })
return
end
+12 -8
View File
@@ -179,10 +179,9 @@ end
-- --------------------------------------------------------------- fixed damage
-- BattleCommand_ConstantDamage / LevelDamage / SuperFang / Psywave /
-- StaticDamage (Sonic Boom, Dragon Rage): skip the damage formula entirely.
-- `move` is optional; EFFECT_STATIC_DAMAGE reads move.power (20 / 40).
function Effects.fixedDamage(effect, attacker, defender, random, move)
-- BattleCommand_ConstantDamage (engine/battle/effect_commands.asm:3131-3205),
-- one command for the whole SuperFang / Psywave / StaticDamage list.
function Effects.fixedDamage(effect, attacker, defender, random, power)
if effect == "EFFECT_LEVEL_DAMAGE" then
return math.max(1, attacker.level or 1)
end
@@ -190,12 +189,17 @@ function Effects.fixedDamage(effect, attacker, defender, random, move)
return math.max(1, math.floor((defender.hp or 1) / 2))
end
if effect == "EFFECT_PSYWAVE" then
-- 1..(level * 1.5), rerolled until it is in range; one roll is enough here.
local ceiling = math.max(1, math.floor((attacker.level or 1) * 3 / 2))
return math.max(1, (random and random(ceiling) or 0) + 1)
-- .psywave rerolls until the byte is nonzero AND below level * 1.5, so the
-- top of the range is that ceiling minus one (effect_commands.asm:3163).
local ceiling = math.max(2, math.floor((attacker.level or 1) * 3 / 2))
return math.max(1, (random and random(ceiling - 1) or 0) + 1)
end
-- SONIC BOOM and DRAGON RAGE share EFFECT_STATIC_DAMAGE, whose arm reads
-- BATTLE_VARS_MOVE_POWER straight into the damage word: their stored power
-- (20 and 40) IS the damage, never a formula input
-- (effect_commands.asm:3157-3161).
if effect == "EFFECT_STATIC_DAMAGE" then
return math.max(1, (move and move.power) or 1)
return math.max(1, math.floor(power or 0))
end
return nil
end