Skip to content

fix(skills): Beast Uppercut no longer crashes when a bomb stone takes a fist's slot - #1148

Merged
Mosch0512 merged 3 commits into
Mutizens:mainfrom
leqatoavgust-dot:fix/beast-uppercut-slot-reuse
Dec 4, 2026
Merged

Mosch0512 merged 3 commits into
Mutizens:mainfrom
leqatoavgust-dot:fix/beast-uppercut-slot-reuse

Conversation

@leqatoavgust-dot

@leqatoavgust-dot leqatoavgust-dot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Bug

Casting the Rage Fighter's Beast Uppercut can crash the client (access violation, 0xC0000005).

Three crash dumps all point to the same instruction in Move_MODEL_DOWN_ATTACK_DUMMY_R (src/source/Render/Effects/Behaviors/MoveHandlers.cpp): a read of Owner->Angle (offset 0x120) through a null o->Owner, right after CreateJointFpsChecked(BITMAP_FORCEPILLAR, ...).

Cause

CreateBomb3 creates MODEL_STONE1/2 effects without an owner (ZzzEffect.cpp). A fist marks itself dead (o->Live = false) when its animation ends: the right fist at frame 6, the left fist at frame 8. If that happens on the same tick as its bomb (frame 3 for the right fist, frame 5 for the left one), CreateBomb3 runs while the fist's slot is already free, and a stone can take it. The handler then goes on with o, which is now the stone: it writes LifeTime into the stone and reads o->Owner->Angle through null.

That tick happens when the frame jumps over the bomb frame and the end frame at once (high attack speed at a low frame rate), or when the target becomes valid on the end tick. It fits the dumps: the null read is the VectorCopy(o->Owner->Angle, ...) after the bomb branch ran.

Fix

  • Both fists keep their owner in a local and are marked dead as their last step, after the bomb, the trail, the owner follow and the flare. So no effect created on that tick can take the slot while the handler still uses o.
  • A dead or missing owner ends the fist at the top of the handler (early return instead of wrapping the body).
  • The right fist creates the left one with CreateEffect instead of CreateEffectFpsChecked: it is a one-time creation, and the FPS check dropped the second punch, its hit and its sound on most casts above 25 FPS. After creating it, the handler returns false, so MoveEffect's shared tail doesn't run on the new effect if it took the slot.
  • A small helper, SkillTargetOf, returns the owner's target CHARACTER*, or nullptr for no target, FindCharacterIndex's "not found" (400) or a slot whose character is gone. Every user guards only what it creates at the target: the fists' CreateBomb3, Killing Blow's particles (Move_BITMAP_SBUMB), Chain Drive's BITMAP_DAMAGE1 and BITMAP_SHINY + 4 (Move_BITMAP_SWORDEFF) and Move_BITMAP_DAMAGE1's particles. Sounds and LifeTime steps run either way, so no blow repeats and no sound is lost without a target.
  • Move_BITMAP_SWORDEFF is marked dead as its last step too.

Changes: MoveHandlers.cpp, and a new test (tests/effects/test_rage_skill_targets.cpp).

Before / After

No video. The fix is checked by the new test (it fails on the previous commit) and in game (Beast Uppercut and Chain Drive cast 36 times on Twin Tales, no crash).

Testing

  • Built on Windows x64 Release (our fork, with the same changes as this branch).
  • In game (OpenMU, our fork): a Fist Master with 7000 agility cast Beast Uppercut about 170 times in round 1 and 30 more now, on Lorencia monsters and on Twin Tales in Kanturu Relics. No crash, both punches, both hits and the stamp sound play. Chain Drive was cast 6 times on Twin Tales.
  • Bug reproduced first: the crash came from three crash dumps on our fork before the fix (null o->Owner read in Move_MODEL_DOWN_ATTACK_DUMMY_R). Not reproduced on current main.
  • New test test_rage_skill_targets passes (4 cases, 30 checks); 3 of its cases fail on the previous commit. test_phoenix_shot still passes.
  • scripts/check_format.sh passes (clang-format 21.1.8).
  • Not tested: Killing Blow in game (our test character doesn't have it), a target leaving the view mid-skill, Linux and macOS.

Coding rules

I read docs/CODING_RULES.md and docs/PULL_REQUESTS.md and followed them for this change.

🤖 Generated with Claude Code

@Mosch0512 Mosch0512 self-assigned this Nov 20, 2026

@Mosch0512 Mosch0512 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. The right fist no longer crashes, but the left fist still has the same crash, and the cause given in the comment and PR description is not what happens.

Required:

  1. The left fist (Move_MODEL_DOWN_ATTACK_DUMMY_L) can still read a null owner (line 9342 comment).
  2. The root-cause comment at 9383 is wrong (line 9383 comment).
  3. The left fist is created with CreateEffectFpsChecked, so above 25 FPS it often never appears (line 9388 comment).

Non-blocking:

  • return true drops the right fist's hit on the crash tick and runs MoveEffect's tail on the reused slot (line 9390 comment).
  • "Target not found" (index 400) now freezes the fists, and the target check is copied twice (line 9395 comment).
  • Exit early instead of wrapping the body (line 9376 comment).
  • Line 9337 keeps || !o->Owner->Live, which can't be true inside if (o->Owner != nullptr && o->Owner->Live); the PR removed the same dead check from the right fist.
  • A suggestion that fixes both fists in one way: mark the fist dead as the last step of the handler. Do the bomb, the trail, the flare and the owner follow first, then OBJECT* owner = o->Owner; o->Live = false; CreateEffect(MODEL_DOWN_ATTACK_DUMMY_L, ...owner...); return false;. Then nothing can take the slot while the handler still uses o, and the right fist keeps its hit. Move_BITMAP_SWORDEFF (9430-9455) has the same pattern: it sets o->Live = false, then creates MODEL_SHOCKWAVE01, which can take the slot, and o->LifeTime = 45 then lands on the new shockwave. No crash there, since every effect it creates gets the owner, but it is the same class of bug.
  • There is no test. tests/effects (test_effect_creation.cpp, EffectRecorder) can drive CreateEffect and MoveEffect on the real Effects array. A test can make the fist's slot the lowest free one, set Velocity/AnimationFrame so the kill and the bomb fall on the same tick (LifeTime > 50, valid target), run MoveEffect, and check that the left fist was created and nothing read a null owner. That test fails today for the left fist.

if (o->AnimationFrame >= 5.0f && o->LifeTime > 50)
{
if (o->Owner->m_sTargetIndex < 0)
if (o->Owner->m_sTargetIndex < 0 || o->Owner->m_sTargetIndex >= MAX_CHARACTERS_CLIENT)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required. The left fist still has the crash this PR fixes in the right fist.

The null owner doesn't come from the left fist taking the slot (see the 9383 comment). It comes from CreateBomb3: it creates MODEL_STONE1/2 effects with no owner (ZzzEffect.cpp:5558/5561). If a fist has already set o->Live = false when it calls CreateBomb3, a stone can take its slot, and the handler then reads o->Owner of the stone.

The left fist does exactly that: line 9337 sets o->Live = false at frame >= 8, and this branch then calls CreateBomb3 on the same tick if the bomb hasn't fired yet. Then o->LifeTime = 40 is written to the stone, and VectorCopy(o->Owner->Angle, o->Angle) at 9354 reads through null.

When it happens: the left fist starts at frame 0 with LifeTime 100. At 25 FPS or less, with Velocity in [4, 5) (stamp PlaySpeed 2 to 2.5 from high attack speed), the handler sees frame 0, then 4.x (no bomb, below 5), then 8+: the kill and the first bomb on the same tick. The crash follows when no lower Effects slot is free. A target index that turns valid on the kill tick also triggers it. The null check at 9332 runs only at the start of the handler, so it doesn't help here.

if (o->AnimationFrame >= 6.0f || !o->Owner->Live)
if (o->AnimationFrame >= 6.0f)
{
// The right fist is done; the left one follows. The new effect may take this very slot (it is

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required. This explanation isn't right, and it's why the left fist was missed.

CreateEffect always sets the new effect's owner (ZzzEffect.cpp:426-429: if (Owner) o->Owner = Owner;). If the left fist takes this slot, o->Owner is still the player, AnimationFrame is 0 and LifeTime is 100, so the old code skipped the bomb and read a valid owner at 9407. No crash.

The null comes from CreateBomb3's stones, created with no owner, taking the freed slot on a tick where the kill (frame >= 6) and the first bomb (frame >= 3, LifeTime > 50) happen together. That happens when the frame jumps from below 3 to 6+ in one tick (Velocity >= 6 at 25 FPS or less), or when the target becomes valid on the kill tick. That also fits the dumps: the null read is the VectorCopy(o->Owner->Angle, ...) after CreateJointFpsChecked, after the bomb branch ran. Please correct the comment (and the PR description) to name CreateBomb3's ownerless effects.

OBJECT* owner = o->Owner;
o->Live = false;
CreateEffectFpsChecked(MODEL_DOWN_ATTACK_DUMMY_L, o->Owner->Position, o->Owner->Angle, o->Owner->Light, 0, o->Owner);
CreateEffectFpsChecked(MODEL_DOWN_ATTACK_DUMMY_L, owner->Position, owner->Angle, owner->Light, 0,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required. Please use CreateEffect here. The right fist sets itself dead every time, but the left fist is only created when rand_fps_check(1) passes, which is true with probability 25/FPS (Random::ChanceOf(1, FPS_ANIMATION_FACTOR)). At 60 FPS that is 42% of casts; at 144 FPS about 17%. Every other cast has no second punch, no left-fist hit and no stamp sound.

This was CreateEffect until b0ed56c ("Added more fps checks for effects") changed it. That change fits effects spawned every tick, but this is a one-time creation. Since the PR rewrites this line, it's a one-word fix here.

CreateEffectFpsChecked(MODEL_DOWN_ATTACK_DUMMY_L, o->Owner->Position, o->Owner->Angle, o->Owner->Light, 0, o->Owner);
CreateEffectFpsChecked(MODEL_DOWN_ATTACK_DUMMY_L, owner->Position, owner->Angle, owner->Light, 0,
owner);
return true;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. Two things about this return true:

  1. On the tick the PR is about (the kill and the first bomb on the same tick), the early return skips the frame-3 branch below. The right fist's CreateBomb3 hit and SOUND_RAGESKILL_STAMP_ATTACK never play, and that tick's trail, flare and owner follow are skipped too. Before, they played whenever no stone took the slot. Marking the fist dead as the last step instead (see the review body) keeps them.
  2. true tells MoveEffect to run its shared tail on o (ZzzEffect.cpp:5797-5802: a false return skips it). The tail calls PlayAnimation and MoveParticle on o and lowers its LifeTime. If the left fist took this slot, that runs on the new left fist before its first handler tick, so the comment's "nothing of o is read after it" doesn't hold. return false matches the intent.

if (o->AnimationFrame >= 3.0f && o->LifeTime > 50)
{
if (o->Owner->m_sTargetIndex < 0)
if (o->Owner->m_sTargetIndex < 0 || o->Owner->m_sTargetIndex >= MAX_CHARACTERS_CLIENT)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. The upper bound doesn't stop an out-of-bounds read: CharactersClient has MAX_CHARACTERS_CLIENT + 1 entries (Winmain.cpp:2418-2419), and 400 is what FindCharacterIndex returns for "not found". What changes is that a target not found locally (e.g. out of view) now takes this early return true. That return skips the rest of the handler, not just the bomb, so for those ticks the fist stops following the player, loses its trail and flare, and plays no stamp sound. Guarding only the CreateBomb3 call (and still setting o->LifeTime = 40) avoids that. The same check is now copied into both fists (9342, 9395), while Move_BITMAP_SBUMB (9308), Move_BITMAP_SWORDEFF (9452) and MonkSystem.cpp index CharactersClient with the same field and check only < 0. A small helper that returns the target CHARACTER* or nullptr would give them one rule.

Vector(1.f, 1.f, 1.f, Light);
{
if (o->Owner->Live)
if (o->Owner != nullptr && o->Owner->Live)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. This changed guard still wraps the whole handler. docs/CODING_RULES.md rule 2 says to prefer if (bad) return; over wrapping the entire body in if (good) { ... }, for new or changed code. For example: if (o->Owner == nullptr || !o->Owner->Live) { o->Live = false; return true; } at the top of both fists, and the else goes away.

leqatoavgust-dot and others added 2 commits November 25, 2026 11:04
…s the right one's slot

The right fist's effect (MODEL_DOWN_ATTACK_DUMMY_R) set itself dead and then
created the left fist's effect, which can take the very slot it just freed.
It then went on with o->Owner, now the new effect's (still null), and crashed
(access violation reading Owner->Angle). It now returns at once after it
creates the left fist, and both fists check their owner and the target index.
CreateBomb3 creates MODEL_STONE1/2 effects without an owner. A fist which
was already marked dead when it created its bomb could have its slot taken
by such a stone, and the handler then read o->Owner through null. Both
fists now keep their owner in a local and are marked dead at the end.

The left fist is created with CreateEffect (a one-time creation; the FPS
check dropped it on most casts above 25 FPS), and the right fist returns
false afterwards so MoveEffect's shared tail does not run on it. A missing
target now skips only the bomb. SkillTargetOf gives the Rage Fighter skill
handlers one rule for the target index.

Review feedback on Mutizens#1148.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leqatoavgust-dot
leqatoavgust-dot force-pushed the fix/beast-uppercut-slot-reuse branch from 60c6952 to ede964a Compare November 25, 2026 07:08
@leqatoavgust-dot leqatoavgust-dot changed the title fix(skills): Beast Uppercut no longer crashes when its left fist takes the right one's slot fix(skills): Beast Uppercut no longer crashes when a bomb stone takes a fist's slot Nov 25, 2026
@leqatoavgust-dot

Copy link
Copy Markdown
Contributor Author

Thanks for the careful review, you were right about the cause. I pushed the changes:

  • Left fist crash and root cause: both fists now keep their owner in a local and set o->Live = false as their last step, so a CreateBomb3 stone can't take the slot while the handler still uses o. The comment and the PR description now name CreateBomb3's ownerless MODEL_STONE1/2 effects.
  • Left fist creation: CreateEffect instead of CreateEffectFpsChecked, so every cast has the second punch, its hit and the stamp sound.
  • Right fist after creating the left one: returns false, so MoveEffect's shared tail doesn't run on the new effect.
  • Target check: a SkillTargetOf helper returns the target CHARACTER* or nullptr. In the fists it guards only the CreateBomb3 call, so the sound, LifeTime, trail, flare and owner follow still run. Move_BITMAP_SBUMB, Move_BITMAP_SWORDEFF and Move_BITMAP_DAMAGE1 use it too. I left MonkSystem.cpp as it is, to keep this PR to one file; I can move the helper to a shared header if you prefer.
  • Early exit: a dead or missing owner returns at the top of both fists, and the else is gone.

Tested on our fork with a high attack speed Fist Master: about 170 casts on Lorencia monsters and on Twin Tales in Kanturu Relics, no crash, and both punches play every time. The branch is rebased on current main.

@Mosch0512 Mosch0512 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. Thanks, the fists look right now: they are marked dead as their last step, the left fist is created every time, and the cause is explained correctly. All three Required items from round 1 are fixed. One new problem comes from the helper, though.

Required:

  1. For a target that isn't in view (index 400), SkillTargetOf now returns nullptr, and Chain Drive and Killing Blow still return true on that. So Chain Drive repeats its second hit on every tick, and Killing Blow plays none of its hit sounds (line 9494 and 9320 comments).

Non-blocking:

  • Move_BITMAP_SWORDEFF's first target read (9466-9469) wasn't moved to the helper. It still checks only < 0 and uses CharactersClient[o->Owner->m_sTargetIndex], so index 400 creates BITMAP_DAMAGE1 at the unused slot 400, while block 2 of the same handler treats 400 as "no target". The PR description says SWORDEFF uses the helper.
  • Old bug in the same block: with no target (< 0), the early return true at 9466-9467 comes after the two CreateEffectFpsChecked calls but before o->LifeTime = 45. The block then runs again on every tick while LifeTime falls from 200 to 50 (up to about 6 s), creating MODEL_SHOCKWAVE01 and MODEL_WOLF_HEAD_EFFECT2 each time. Guarding only the BITMAP_DAMAGE1 creation fixes both points.
  • Old bug, same class as the fists: Move_BITMAP_SWORDEFF sets o->Live = false at 9443-9444 and then keeps creating effects and writing to o, so a new shockwave can take the slot and get o->LifeTime = 45 or 20. It doesn't crash (every effect it creates gets the owner), but marking it dead last would fix it the same way as the fists.
  • Old bug: MonkSystem.cpp:1253 (Killing Blow, also 1385 and 1506) reads CharactersClient[_pObj->m_sTargetIndex] with no check, so a caster without a target reads before the array.
  • There is no automated test. tests/effects (test_effect_creation.cpp, EffectRecorder) can drive CreateEffect and MoveEffect. A test could make the fist's slot the lowest free one, put the bomb and the end frame on one tick, and check that the left fist exists and no null owner was read.
  • docs/PULL_REQUESTS.md: the fix changes what players see (the second punch now always appears), so the description needs a short before/after video, a line saying the crash or the missing punch was reproduced on main first, a "not tested" line and the coding-rules confirmation.

The red CI isn't from this PR: main fails the same Magic Skeleton cloth test since #996.

CreateEffectFpsChecked(MODEL_SHOCKWAVE_SPIN01, vPosition, Angle, Light, 1, o->Owner, -1, 0, 0, 0, 0.9f);

if (o->Owner->m_sTargetIndex < 0)
const CHARACTER* target = SkillTargetOf(o->Owner);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required. For a target that isn't in view, this now repeats the whole block on every tick.

SkillTargetOf returns nullptr for index 400 (FindCharacterIndex's "not found"). The return true here comes before o->LifeTime = 20, so while the owner's frame is above 11 and LifeTime above 20 (about 25 ticks after block 1 set it to 45), every tick creates MODEL_SHOCKWAVE02, MODEL_WOLF_HEAD_EFFECT2 and two MODEL_SHOCKWAVE_SPIN01 again, and SOUND_RAGESKILL_GIANTSWING_ATTACK never plays. Before this PR, index 400 ran the block once.

Same as in the fists: guard only the BITMAP_SHINY + 4 creation with the target, and keep the sound and o->LifeTime = 20 outside the guard.

vec3_t vLight, vPosition;
Vector(1.0f, 1.0f, 1.0f, vLight);
if (o->Owner->m_sTargetIndex < 0)
const CHARACTER* target = SkillTargetOf(o->Owner);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required (same point as the 9494 comment). With index 400 this now returns before the sound block at 9330. The effect is in this branch at LifeTime 15, 9 and 6, so none of Killing Blow's three SOUND_RAGESKILL_THRUST_ATTACK plays when the target isn't in view; before this PR they played. Guard only the particle creation and let the function go on to the sounds.

return true;
}

// The character a skill's owner is aiming at, or nullptr when it has none or it isn't in view

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. "or it isn't in view" is more than this checks: it only rejects the "not found" index. A target that left the view (or died) after the index was stored still comes back, even if its slot is now dead or holds another character, so the bomb can land on whoever took the slot. Either also return nullptr when !CharactersClient[index].Object.Live, or say in the comment that only the "not found" index is rejected.

… without a target in view

Review round 2: SkillTargetOf's nullptr now guards only what is created at the target.
Chain Drive's second blow no longer repeats every tick and Killing Blow's thrust sounds play
when the target isn't in view. Chain Drive's first blow uses the helper too (index 400 no
longer creates BITMAP_DAMAGE1 at slot 400, and no target no longer repeats the first blow),
and its effect is marked dead as its last step. SkillTargetOf also rejects a slot whose
character is gone. Tests: test_rage_skill_targets.
@leqatoavgust-dot

Copy link
Copy Markdown
Contributor Author

Thanks, good catch on the early returns. Pushed 5bfdeec:

Required

  • Chain Drive (9494) and Killing Blow (9320): SkillTargetOf now guards only what is created at the target (BITMAP_SHINY + 4, the BITMAP_SBUMB particles). The sounds and o->LifeTime = 20 run without a target, so the second blow runs once and Killing Blow's three thrust sounds play again.

Non-blocking, also done

  • Move_BITMAP_SWORDEFF's first blow uses the helper too and guards only BITMAP_DAMAGE1. So index 400 no longer creates it at slot 400, and with no target the first blow no longer repeats every tick (LifeTime = 45 is set either way).
  • Move_BITMAP_SWORDEFF is marked dead as its last step, like the fists.
  • SkillTargetOf also returns nullptr for a slot whose character is gone (!Object.Live). The comment says that a slot another character took since still gives that character.
  • Test: tests/effects/test_rage_skill_targets.cpp (test_rage_skill_targets). It covers Chain Drive with its target in view, with index 400 and with a dead slot (both blows and both sounds once, nothing repeats, BITMAP_DAMAGE1 and BITMAP_SHINY + 4 only at a target), Chain Drive ending with the swing, and Killing Blow's three sounds with and without a target. Run against the previous commit, 3 of its 4 cases fail (7 checks). Against this one all pass, and test_phoenix_shot still passes.

Not in this PR

  • MonkSystem.cpp:1253/1385/1506 (the unchecked target reads in RageCreateEffect): another file and older than this PR, so I'd do it as a follow-up.
  • A test for the fist slot reuse itself: the fists need an animated model with bones in the test, so the new test covers the target helper only.
  • The before/after video will follow in the description.

@Mosch0512 Mosch0512 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Thanks, everything from round 2 is fixed: the targets out of view, Chain Drive's first blow and its "dead last" order, the Live check in SkillTargetOf, and there is a test now. CI is green. The points below are Non-blocking; fixing them here or in a follow-up is fine.

Non-blocking:

  • Move_BITMAP_SWORDEFF (old code) still reads o->Owner with no null or Live check, unlike the fists now. The guard the fists got at the top would end it cleanly if the owner goes.
  • MonkSystem.cpp:1253 (old code, also 1385 and 1506): RageCreateEffect still reads CharactersClient[_pObj->m_sTargetIndex] unchecked when the skill is cast. With no target it reads before the array. SkillTargetOf in a header would cover it.
  • Test nits: see the three inline comments.
  • docs/PULL_REQUESTS.md: a short before/after clip (Beast Uppercut at high FPS, second punch missing before) would still be good.

Models = previousModels;
}

static void ClearPools()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. ClearPools clears Effects and Particles but not the Joints. Chain Drive's handler creates BITMAP_SWORDEFF joints whose Target is this scope's caster, and the scope frees characters when it ends, so those joints keep a dangling Target. Nothing in this binary moves joints today, but a later test that does would read freed memory. Clearing Joints (and g_SkillEffects) here too avoids that.

EffectTestData::BuildShippedRegistry();
Models = models.get();
CharactersClient = characters.get();
Hero = nullptr;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. With Hero = nullptr, every CreateEffect goes through CSkillEffectMgr::IsSkillEffect, which evaluates Owner != &Hero->Object. Taking a member's address through a null pointer is undefined behaviour: it works today, but a UBSan build would flag it. Pointing Hero at a test-owned CHARACTER (as tests/data/HeroScope.h does) avoids it.

for (int move = 0; move < 10; ++move)
MoveEffects();
CHECK(scope.audio.Plays(SOUND_RAGESKILL_GIANTSWING_ATTACK) == 2);
CHECK(LiveEffects(MODEL_SHOCKWAVE01) <= 1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. A shockwave lives only a few ticks, so a handler that re-creates one every tick still keeps about one alive at a time, and <= 1 passes. Only the sound count catches a repeat here. Counting creations (for example the number of shockwaves created over the ten moves) would make this check catch it too.

@Mosch0512
Mosch0512 merged commit 1795ba8 into Mutizens:main Dec 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants