Compare commits
9 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
c0f7f5fbd8 | |
|
|
da8ae49a72 | |
|
|
7814ed3951 | |
|
|
f650592676 | |
|
|
3b7fa17d06 | |
|
|
3b1a883787 | |
|
|
23376e8cbb | |
|
|
9ca343c214 | |
|
|
a7eec730d2 |
|
|
@ -4,3 +4,4 @@ dist/
|
|||
config.json
|
||||
package-lock.json
|
||||
*.log
|
||||
.omo
|
||||
106
agent.md
106
agent.md
|
|
@ -1,7 +1,107 @@
|
|||
# Update: Restrained Team Card Styling
|
||||
|
||||
- Team score cards keep the existing label, elite/normal count, click behavior, and focused-team state.
|
||||
- Team color is limited to a compact team marker and muted inner divider instead of a full-height side stripe or filled card background.
|
||||
- Hover and focus states are quieter: no raised hover motion, reduced brightness, and a subtle inset focus treatment instead of an outer glow.
|
||||
|
||||
# Update: Battle Notice Rolling Text
|
||||
|
||||
- `battleDeathNotice.js` now renders notice text inside a message span, measures the rendered content width on the next animation frame, and switches to a rolling track only when the text exceeds the notice box content width.
|
||||
- Overflowing battle notices duplicate the message in an `aria-hidden` track and use `aria-label` on the status node so assistive text is not repeated.
|
||||
- Rolling speed, gap, and duration clamps are tuned by `UI.BATTLE_NOTICE_ROLL_*` constants; non-overflowing notices keep the normal centered display.
|
||||
|
||||
# Update: Special Projectile Trail
|
||||
|
||||
- Special projectile movement can leave short-lived visual afterimages controlled by `SPECIAL_EFFECT.PROJECTILE.TRAIL`.
|
||||
- Trail sprites copy the projectile's current texture frame, scale, rotation, and flip state, then fade out without affecting hit detection or damage.
|
||||
- Trail density and cost are bounded by `TRAIL.INTERVAL_MS` and `TRAIL.LIFETIME_MS`.
|
||||
|
||||
# Update: Split Special Projectile Visual Configs
|
||||
|
||||
- Special projectile visual asset settings are split by caster type: melee visuals live under `SPECIAL_EFFECT.MELEE`, and ranged visuals live under `SPECIAL_EFFECT.RANGE`.
|
||||
- `SPECIAL_EFFECT.PROJECTILE` now owns shared movement, hit-detection, and trail tuning only, such as acceleration, travel duration, hold time, target area, arena clamp, hit radius, lifetime, and afterimages.
|
||||
|
||||
# Update: One-Shot Accelerating Special Projectile
|
||||
|
||||
- Melee special sprites now use `SPECIAL_EFFECT.MELEE.REPEAT = 0`, so the configured sprite sheet plays once instead of looping while the projectile travels.
|
||||
- `special-melee-effect-1` has its `frameSequence` commented out for now, restoring the natural sprite-sheet order. A commented example remains next to the asset for quick tuning later.
|
||||
- Special projectile movement now uses a tween instead of constant `physics.moveTo`. `SPECIAL_EFFECT.PROJECTILE.startHoldMs` controls the stationary pre-launch tell, `travelDurationMs` controls launch speed when set, and `movementEase` controls the acceleration curve; `speed` remains the fallback if `travelDurationMs` is unset.
|
||||
|
||||
# Update: Special Effect Frame Sequence Refresh
|
||||
|
||||
- Special effect animations now compare the existing Phaser animation against the current configured frames, repeat count, and frame rate. If the config changed, the old global animation key is removed and recreated so `frameSequence` edits take effect without stale animation data.
|
||||
- `frameSequence` remains 1-based for sprite-sheet inspection, then converts through `generateFrameNumbers(..., { frames })`, preserving repeated frames when a special asset enables a custom sequence.
|
||||
|
||||
# Update: Special Effect Frame Rate And Render Budget
|
||||
|
||||
- Special effect sprite animations now multiply their configured `frameRate` by `SPECIAL_EFFECT.FRAME_RATE_MULTIPLIER`. This changes only visual frame playback; caster hold time, launch delay, projectile speed, travel distance, and timers keep their existing progress speed.
|
||||
- The special focus blur snapshot is skipped when the living fighter count is above `SPECIAL_EFFECT.FOCUS_LAYER.BLUR_MAX_FIGHTERS`. The dim layer and raised caster focus still render, avoiding the expensive full-arena render-texture blur during larger battles.
|
||||
- Special projectile hit checks now use the per-frame combat spatial index to inspect only fighters near the projectile segment when the index is available, while preserving the full-array fallback.
|
||||
|
||||
# Update: Elite Kill Splash
|
||||
|
||||
- Elite fighters now trigger a kill splash when they directly kill an enemy. The splash is centered on the killed fighter's body position.
|
||||
- Splash damage is `COMBAT.ELITE_KILL_SPLASH_DAMAGE_PERCENT` of the killed fighter's max HP and applies to living enemy fighters inside `COMBAT.ELITE_KILL_SPLASH_RADIUS`.
|
||||
- Splash kills still use the normal kill/death flow for logs, death statistics, despawn, split-on-death, scoreboard, and match-finish checks. `COMBAT.ELITE_KILL_SPLASH_CHAIN_ENABLED` is `false` by default, so splash kills do not recursively trigger more splashes unless explicitly enabled.
|
||||
- A short team-colored pixel-dot burst is rendered for the splash when supplemental combat effects are enabled, avoiding smooth vector circles.
|
||||
|
||||
# Update: Team Card Focus Toggle
|
||||
|
||||
- Team cards in the left HUD still select a random living fighter from the clicked team and zoom the camera in.
|
||||
- Clicking the same already-focused team card again clears the selected fighter, requests `CAMERA.MIN_ZOOM`, restores the match status summary, and removes the focused team-card state. If automatic spectator focus is active, that camera mode immediately reapplies its own zoom; this is intended.
|
||||
|
||||
# Update: Special Effect Projectile
|
||||
|
||||
- Special battle effects are implemented separately from meteor/frost barrages in `src/game/combat/specialEffects.js`.
|
||||
- Tuning lives under `SPECIAL_EFFECT` in `src/constants.js`; the same object is also exposed as `WORLD_EFFECT.SPECIAL` for world-effect domain access.
|
||||
- Each live match schedules one special-effect attempt at a random time between `SPECIAL_EFFECT.TRIGGER_DELAY_MIN_MS` and `TRIGGER_DELAY_MAX_MS`. It retries briefly only when no eligible caster exists, and never fires more than once per match.
|
||||
- Eligible casters are living, non-elite, non-magic fighters from teams that are not currently tied for first by represented living count. `SPECIAL_EFFECT.CASTER.BALANCE_NON_MAGIC_TYPES` first balances between available non-magic caster types, then picks a fighter inside that type, so ranged casters are not drowned out by the larger melee roster. The caster holds Hurt frame index `1` long enough for the zoom/focus layer to read, then the attack animation launches a giant projectile.
|
||||
- The caster receives realtime special invulnerability for `SPECIAL_EFFECT.CASTER.INVULNERABLE_MS`. Normal attacks, world-effect damage/frost survivor effects, and special instant kills all skip fighters whose invulnerability window is still active.
|
||||
- During that Hurt-frame preparation hold, combat is frozen by pausing fighter AI, Arcade Physics, and the scene clock, so combat/world timers do not advance. A realtime cinematic timer releases the pause when the attack motion begins.
|
||||
- While the caster holds the Hurt frame, `SPECIAL_EFFECT.CASTER_SPARKLE` plays only frames 2, 3, and 4 from `public/assets/effects/special/effect.png` above the caster's eye area, then removes the sparkle before the attack motion begins.
|
||||
- The caster is emphasized with a temporary focus stack: a blurred render-texture snapshot of the battlefield, a dim layer, then the caster and special launch/projectile effects above that layer. `SPECIAL_EFFECT.FOCUS_LAYER` controls depths, blur, alpha, and fades.
|
||||
- `SPECIAL_EFFECT.CAMERA.CENTER_ON_CASTER_AT_START` makes the camera center on the caster location immediately when the special cast begins, before the slower zoom/focus motion continues.
|
||||
- When the special projectile starts moving, the special camera stops zooming in and zooms out in place through `SPECIAL_EFFECT.CAMERA.PROJECTILE_VIEW_ZOOM` and `PROJECTILE_ZOOM_OUT_MS`; it does not follow the projectile.
|
||||
- Special melee sprites can use explicit 1-based `frameSequence` arrays, but `special-melee-effect-1` currently leaves the sequence disabled to play the sheet once in natural order. The projectile uses `startHoldMs` to remain visible near the caster before traveling.
|
||||
- At target-selection time, the projectile locks onto the densest enemy tile area using represented `stackCount` population. `SPECIAL_EFFECT.PROJECTILE.targetAreaTiles` controls that scan footprint.
|
||||
- The moving special projectile visual is selected by caster type: melee casters fire one random sprite from `SPECIAL_EFFECT.MELEE.ASSETS`, while ranged casters use `SPECIAL_EFFECT.RANGE`. Projectile movement uses a tweened Arcade Physics sprite so acceleration can be tuned while path hit checks still run per update. Projectile travel is clamped by `SPECIAL_EFFECT.PROJECTILE.arenaEdgePadding`, and any living fighter intersecting the projectile path is killed instantly, with kill/death records flowing through the normal combat cleanup path.
|
||||
- Special preparation pauses existing combat objects as well as fighters: active battle tweens, world-effect fall tweens, combat-object animations, physics velocities, scene time, and Arcade Physics are restored only after the realtime Hurt-frame hold finishes.
|
||||
|
||||
# Update: Large-Battle Render Budget
|
||||
|
||||
- When the user-entered total fighter count is greater than `PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD`, match setup enforces `PERFORMANCE.LARGE_BATTLE_RENDERED_FIGHTER_LIMIT` as a hard budget for physically rendered fighter plans.
|
||||
- Randomized compression still rolls blocks first. If the resulting rendered count exceeds the budget, failed normal 100-member blocks and normal remainder groups are promoted to elite groups until the rendered count is within the limit or no promotable groups remain.
|
||||
- `stackCount` is preserved, so team totals, death statistics, spectator weighting, and dense-area targeting continue to use the represented population.
|
||||
|
||||
# Update: Field HUD Text Removal
|
||||
|
||||
- Zoom-visible fighter HUD slots no longer create battlefield name text. Team identity is carried by the team-colored sprite shadow, so selected and zoom-visible fighters only borrow health-bar HUD objects.
|
||||
|
||||
# Update: Large-Battle Elite Probability
|
||||
|
||||
- When the user-entered total fighter count is greater than `PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD`, randomized elite compression uses `FIGHTER.ELITE.RANDOMIZED_COMPRESSION.LARGE_BATTLE_ELITE_BLOCK_PROBABILITY` instead of the normal block probability.
|
||||
- The large-battle elite probability is `0.8` by default and is clamped against the normal probability so large battles never use a lower elite block ratio than regular randomized compression.
|
||||
|
||||
# Update: Elite Magic Attack Effect Scale
|
||||
|
||||
- Instant-spell attack effects use `FIGHTER.ATTACK_EFFECT_SCALE_MULTIPLIER` for their normal visual scale.
|
||||
- Elite magic fighters multiply that normal spell-effect scale by `FIGHTER.ELITE.ATTACK_EFFECT_SCALE_MULTIPLIER`, so giant elite casters can have attack effects sized independently from fighter body scale.
|
||||
- Elite spawn plans select skins only from the configured `FIGHTER.ELITE.TYPE` list (`melee`, `magic`); normal plans retain the full skin pool.
|
||||
|
||||
# Update: Elite Stacking Compression
|
||||
|
||||
- Below `FIGHTER.ELITE.RANDOMIZED_COMPRESSION.MIN_TEAM_SIZE`, complete `FIGHTER.ELITE.STACK_SIZE = 100` blocks use fixed elite compression; with the current threshold of `100`, entries containing a complete block use randomized compression instead.
|
||||
- At or above the randomized-compression threshold, each complete 100-member block becomes one elite with probability `ELITE_BLOCK_PROBABILITY = 0.6`; a non-elite block remains 100 rendered normal fighters. When the total requested fighter count is above the large-battle threshold, the probability increases to `LARGE_BATTLE_ELITE_BLOCK_PROBABILITY = 0.8`.
|
||||
- Elite fighters use nested `FIGHTER.ELITE` settings for their type, 5x visual scale, magic attack-effect scale, HP ratio, attack range, attack damage, and attack/movement speed formulas. A bonus multiplier of `0` disables that added elite bonus; `1` applies the configured stack exponent fully.
|
||||
- Critical hits and world effects distinguish elite targets: elites take max-HP based critical/meteor/frost damage (10%/40%/20%), while normal fighters take 2x critical hit damage and the existing fixed meteor/frost damage.
|
||||
- `COMBAT.KILL_REWARD_ENABLED` is `false` for elite-compressed battles. Kills still update logs and death statistics, but no fighter heals, grows, or gains attack/movement speed from a kill.
|
||||
- Team cards display living physical composition as `E : elite count | N : normal count`. Death statistics, spectator thresholds/centers, and dense-area world-effect targeting continue to use represented `stackCount` population.
|
||||
- Elite representative fighters do not expand Slime `spawnMultiplier` or `splitOnDeath`; applying a randomly selected per-unit trait to an aggregated army would duplicate the represented population.
|
||||
|
||||
# Update: Focused Combat Effects In Large Battles
|
||||
|
||||
- When the live fighter count reaches `PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD`, supplemental combat visuals are suppressed unless a meteor camera focus is active.
|
||||
- Large-battle suppression covers critical-hit labels, instant-spell attack sprites, kill-heal sprites, and kill-growth tweens; damage, critical kills, healing values, and growth multipliers remain unchanged.
|
||||
- Large-battle suppression covers critical-hit labels, instant-spell attack sprites, kill-heal sprites, and kill-growth tweens; damage outcomes remain unchanged. Kill healing/growth is now disabled by the elite-compression policy.
|
||||
- Meteor/frost world-effect visuals remain visible because they establish the temporary camera focus. Projectile visuals remain active because their current objects also perform hit detection.
|
||||
|
||||
# Update: Dense-Area Meteor Barrage
|
||||
|
|
@ -24,7 +124,7 @@
|
|||
|
||||
- Combat target acquisition now builds a per-frame spatial grid so every fighter that needs a fresh target can search nearby cells instead of scanning the full battlefield array.
|
||||
- Large battle thresholds and related tuning live in `PERFORMANCE` inside `src/constants.js`, including target grid size, HUD pool size, minimap dot size, and large-battle corpse despawn delay.
|
||||
- Fighter name/health HUD objects are pooled. Fighters no longer own permanent text/bar objects; selected and zoom-visible nearby fighters borrow HUD slots.
|
||||
- Fighter health HUD objects are pooled. Fighters no longer own permanent HUD objects, and selected or zoom-visible nearby fighters borrow health-bar slots without battlefield name text.
|
||||
- The minimap is separated from the field camera. During live matches, `ArenaScene` draws a lightweight graphics minimap through a dedicated `minimap-hud` camera while the main camera ignores the minimap object and the HUD camera ignores field objects. Presentation/waiting mode hides the minimap.
|
||||
- Dead fighter despawn switches to the large-battle delay when the current fighter count reaches `PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD`.
|
||||
|
||||
|
|
@ -139,7 +239,7 @@
|
|||
- **[인프라 및 전역 설정] [context/core.md](./context/core.md)**: `main.js`, `constants.js`, 개발/유지보수 공통 규칙.
|
||||
- **[서버 및 API] [context/server.md](./context/server.md)**: Fastify 서버, MongoDB 연동, 방문자 및 사망 통계 API 상세.
|
||||
- **[아레나 및 카메라] [context/arena.md](./context/arena.md)**: `ArenaScene` 오케스트레이션, 지능형 카메라 추적, 미니맵 가이드라인.
|
||||
- **[전투 엔진] [context/combat.md](./context/combat.md)**: 전투 AI, 투사체 판정, 처치 보상 성장, 슬로우모션 및 월드 이펙트 연출.
|
||||
- **[전투 엔진] [context/combat.md](./context/combat.md)**: 전투 AI, 엘리트 피해 판정, 비활성화된 처치 보너스 경로, 슬로우모션 및 월드 이펙트 연출.
|
||||
- **[캐릭터 및 에셋] [context/fighter.md](./context/fighter.md)**: 캐릭터 공장, 동적 실루엣 생성, 종족 및 특성(Slime 등) 정의.
|
||||
- **[매치 로직 및 UI] [context/match-ui.md](./context/match-ui.md)**: 팀 구성 및 스폰 알고리즘, HUD 레이아웃, 킬로그, 승리 연출 UI.
|
||||
- **[스타일 및 디자인] [context/style.md](./context/style.md)**: CSS 모듈 구조, 디자인 변수, 반응형 및 애니메이션 가이드.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,24 @@
|
|||
# Update: Special Effect Camera Focus
|
||||
|
||||
- `ArenaScene` preloads and creates special-effect animations beside the existing fighter and world-effect assets, then starts `startSpecialEffects()` for live matches only.
|
||||
- During a special cast, `beginSpecialEffectCameraFocus()` zooms toward the caster, `zoomOutSpecialEffectCameraFocus()` zooms back out in place when the projectile starts moving, and `clearSpecialEffectCameraFocus()` restores the previous camera after the configured hold/outro timing.
|
||||
- Special focus temporarily takes priority over selected-fighter, spectator, and meteor focus so the Hurt-frame pose and projectile launch are visible.
|
||||
- When `SPECIAL_EFFECT.CAMERA.CENTER_ON_CASTER_AT_START` is enabled, special focus centers the main camera on the caster's location immediately and keeps it snapped there until projectile handoff, then continues the slower follow motion.
|
||||
- The Hurt-frame preparation window sets `scene.specialEffectPreparationPaused`, pauses the scene clock and Arcade Physics, freezes living fighter animations, pauses active combat-object tweens/animations/velocities, and places a blurred battlefield snapshot plus dim layer beneath the raised caster. Camera focus tweening stays active so the zoom-in can complete while combat and world-effect progression are stopped.
|
||||
- The projectile is not used as a camera target. Special camera targets are still clamped against the current zoom viewport so the focus stack cannot drag the camera outside the arena bounds.
|
||||
- Match restart and match finish both call `clearSpecialEffects()` so pending timers, projectile objects, caster locks, and special camera tweens do not leak into the next battle.
|
||||
|
||||
# Update: Elite-Weighted Scene Counts
|
||||
|
||||
- `ArenaScene.recordDeath()` records an elite death as its represented `stackCount`, keeping persisted species death totals aligned with the displayed army size.
|
||||
- `arenaSpectatorCamera.js` uses summed `stackCount` for late/final thresholds, underdog comparison, and weighted team center positions. A match containing two large compressed armies therefore does not enter final-combat camera mode at match start.
|
||||
- Minimap dots remain physical fighter markers; an elite is visible as its single large battlefield representative while numeric population remains in the scoreboard.
|
||||
|
||||
# Update: Graphics Minimap And HUD Candidates
|
||||
|
||||
- The minimap is drawn during live matches by `ArenaScene` as a lightweight `Graphics` overlay through a dedicated `minimap-hud` camera instead of reusing the field camera. Presentation/waiting mode hides it.
|
||||
- The main camera ignores the minimap graphics object, and the HUD camera ignores field objects as they are added to the scene. Minimap rendering uses team-colored living fighter dots and the main camera viewport rectangle, so the minimap frame stays fixed while the main camera follows combat or meteor focus.
|
||||
- `ArenaScene` refreshes HUD candidates on an interval, choosing selected fighters plus nearby visible fighters when zoomed in, then releases unused HUD pool slots.
|
||||
- `ArenaScene` refreshes HUD candidates on an interval, choosing selected fighters plus nearby visible fighters when zoomed in, then releases unused health-bar HUD pool slots. Battlefield name text is not shown.
|
||||
|
||||
# Context: Arena & Scene
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,60 @@
|
|||
# Update: Special Projectile Trail
|
||||
|
||||
- `SPECIAL_EFFECT.PROJECTILE.TRAIL` controls optional afterimages for the moving special projectile. Each trail copy uses the projectile's current texture frame, scale, rotation, and flip state.
|
||||
- Trail objects are visual-only combat objects: they fade out and self-dispose, but they do not participate in hit detection.
|
||||
- `TRAIL.INTERVAL_MS` and `TRAIL.LIFETIME_MS` bound how many afterimages can exist at once.
|
||||
|
||||
# Update: Split Special Projectile Visual Configs
|
||||
|
||||
- Special projectile visual asset settings are separated by caster type. Melee visual sheets are configured under `SPECIAL_EFFECT.MELEE`; ranged visual sheets are configured under `SPECIAL_EFFECT.RANGE`.
|
||||
- `SPECIAL_EFFECT.PROJECTILE` now carries shared projectile behavior only: hold time, acceleration/ease, fallback speed, target density area, travel clamp, hit radius, max lifetime, and optional trail visuals.
|
||||
|
||||
# Update: One-Shot Accelerating Special Projectile
|
||||
|
||||
- `SPECIAL_EFFECT.MELEE.REPEAT = 0` makes melee special sprites play once. `special-melee-effect-1` currently has `frameSequence` commented out, so it uses the sprite sheet's natural frame order.
|
||||
- Special projectile movement now uses a tween instead of constant `physics.moveTo`. `SPECIAL_EFFECT.PROJECTILE.startHoldMs` keeps the effect stationary for the pre-launch tell, `travelDurationMs` controls the launch duration when set, and `movementEase` controls the acceleration curve. If `travelDurationMs` is unset, movement falls back to `speed`.
|
||||
- Projectile hit checks still run from the scene UPDATE event while the tween moves the sprite, so instant-kill path detection remains active during acceleration.
|
||||
|
||||
# Update: Special Effect Frame Sequence Refresh
|
||||
|
||||
- `createSpecialAnimation()` now rebuilds a special animation when the existing Phaser global animation no longer matches the configured frames, repeat count, or frame rate. This prevents stale animation keys from hiding `frameSequence` edits.
|
||||
- `frameSequence` values stay 1-based in config and are converted with `generateFrameNumbers(..., { frames })`, so repeated frames are preserved when a special asset enables a custom sequence.
|
||||
|
||||
# Update: Special Effect Frame Rate And Render Budget
|
||||
|
||||
- `SPECIAL_EFFECT.FRAME_RATE_MULTIPLIER` multiplies only special-effect animation frame rates. Caster sparkle, melee special sprites, and ranged special projectile frames can play faster or slower without changing caster hold time, launch delay, projectile movement speed, travel distance, or cleanup timers.
|
||||
- `SPECIAL_EFFECT.FOCUS_LAYER.BLUR_MAX_FIGHTERS` caps when `specialEffects.js` creates the full-arena blurred render-texture snapshot. Above that living-fighter count, the special focus keeps the dim layer and raised caster but skips the expensive blur pass.
|
||||
- Special projectile hit checks prefer `scene.combatTargetIndex` and scan only spatial cells around the projectile segment, falling back to `scene.fighters` when no index exists.
|
||||
|
||||
# Update: Special Effect Projectile
|
||||
|
||||
- `specialEffects.js` owns the one-shot special effect flow: asset preload/animation creation, random live-match scheduling, underdog caster selection, caster pose lock, launch visuals, projectile path checks, and cleanup.
|
||||
- `SPECIAL_EFFECT` in `src/constants.js` tunes trigger timing, caster Hurt-frame hold, camera zoom, melee projectile assets, ranged projectile asset scale/speed/travel distance/hit radius, target density area, arena edge padding, and lifetime. `WORLD_EFFECT.SPECIAL` points to the same config object.
|
||||
- Casters must be living, non-elite, non-magic fighters from teams that are not currently tied for first by represented living count. When `SPECIAL_EFFECT.CASTER.BALANCE_NON_MAGIC_TYPES` is enabled, caster selection first picks among available non-magic types and then picks a fighter from that type, preventing the larger melee roster from overwhelming ranged special casts. If no caster exists at the chosen time, the timer retries within the configured window instead of firing multiple times.
|
||||
- Special casters receive realtime invulnerability for `SPECIAL_EFFECT.CASTER.INVULNERABLE_MS`. `combat.js` checks that window in normal attacks, world-effect damage, and special instant kills, while `worldEffects.js` also skips frost survivor effects for invulnerable fighters.
|
||||
- While the caster holds the Hurt frame, `specialEffects.js` pauses fighter AI, Arcade Physics, the scene clock, existing combat-object physics velocity, combat-object animations, and combat-object tweens. Existing combat/world delayed calls and already-falling meteor/frost tweens stop advancing until the realtime preparation hold releases into the attack animation.
|
||||
- The Hurt-frame preparation also spawns a caster sparkle overlay from `public/assets/effects/special/effect.png`. Its animation uses the 1-based frame sequence `[2, 3, 4]` only, positions near the caster's eyes through `SPECIAL_EFFECT.CASTER_SPARKLE`, and is disposed before the attack animation starts.
|
||||
- Caster emphasis uses `SPECIAL_EFFECT.FOCUS_LAYER`: `specialEffects.js` snapshots the current battlefield into a render texture, applies Phaser Blur FX when available, adds a dim layer, and raises the caster above both layers until cleanup.
|
||||
- The special camera does not follow the projectile. When projectile movement begins, `zoomOutSpecialEffectCameraFocus()` zooms out in place using `SPECIAL_EFFECT.CAMERA.PROJECTILE_VIEW_ZOOM` and `PROJECTILE_ZOOM_OUT_MS` so the projectile remains readable without dragging the camera off the arena.
|
||||
- Melee special projectile effects can define 1-based `frameSequence` arrays. `specialEffects.js` converts them to Phaser frames so specific frames can be repeated for readability. The projectile's `startHoldMs` keeps it visible at the caster before travel begins.
|
||||
- At target-selection time, the special projectile scans living enemies with a summed-area table and locks onto the `SPECIAL_EFFECT.PROJECTILE.targetAreaTiles` square containing the highest represented `stackCount` population. The moving projectile visual is type-based: melee casters fire one random `SPECIAL_EFFECT.MELEE.ASSETS` sprite, while ranged casters use `SPECIAL_EFFECT.RANGE`. Movement uses a tweened Arcade Physics sprite, matching normal ranged projectile path-update checks while allowing acceleration, and projectile travel is cut to the arena bounds using `arenaEdgePadding`.
|
||||
- The special projectile calls `applySpecialEffectInstantKill()` from `combat.js`, so instant kills still use the normal death animation, death-stat recording, kill log attribution when there is a surviving caster, split-on-death behavior, scoreboard refresh, and match-finish checks.
|
||||
|
||||
# Update: Elite Magic Attack Effect Scale
|
||||
|
||||
- `combat.js` resolves instant-spell attack effect scale through constants instead of hard-coding `FIGHTER.SCALE`.
|
||||
- Normal spell effects use `FIGHTER.SCALE * FIGHTER.ATTACK_EFFECT_SCALE_MULTIPLIER`.
|
||||
- Elite magic spell effects additionally multiply by `FIGHTER.ELITE.ATTACK_EFFECT_SCALE_MULTIPLIER`, keeping caster body scale and effect scale separately tunable.
|
||||
|
||||
# Update: Elite Target Damage And Density
|
||||
|
||||
- `combat.js` uses `fighter.isElite` to split damage rules. Elite critical hits deal the greater of the ordinary hit or `COMBAT.CRITICAL_DAMAGE_PERCENT` of max HP; normal critical hits deal `NORMAL_CRITICAL_DAMAGE_MULTIPLIER` times the ordinary hit.
|
||||
- Elite attack and movement speed are calculated through `FIGHTER.ELITE.ATTACK_SPEED_*` and `MOVE_SPEED_*` constants. Each multiplier is additive: `0` removes its added stack bonus, while `1` applies its configured exponent.
|
||||
- Elite direct kills trigger a kill splash at the killed fighter's body position. The splash deals `COMBAT.ELITE_KILL_SPLASH_DAMAGE_PERCENT` of that killed fighter's max HP to living enemies inside `COMBAT.ELITE_KILL_SPLASH_RADIUS`; splash kills are recorded normally, recursive splash chaining is controlled by `ELITE_KILL_SPLASH_CHAIN_ENABLED`, and the optional visual uses square pixel dots rather than smooth circles.
|
||||
- Kills still record the attacker/defender and drive match resolution, but `COMBAT.KILL_REWARD_ENABLED = false` prevents heal effects, scale growth, and kill-derived speed multipliers in compressed elite battles.
|
||||
- `worldEffects.js` passes an effect type into `applyWorldEffectDamage()`: normal targets retain fixed fire/frost damage, while elite targets take `WORLD_EFFECT.METEOR_DAMAGE_PERCENT` or `FROST_DAMAGE_PERCENT` of max HP.
|
||||
- Dense-area target scanning adds each fighter's represented `stackCount` into its tile, preventing compressed armies from disappearing from meteor/frost targeting pressure.
|
||||
|
||||
# Update: Dense-Area Meteor Barrage
|
||||
|
||||
- `worldEffects.js` aggregates living fighters on the arena tile grid and uses a summed-area scan to select the `WORLD_EFFECT.AREA_TILES` square with the highest population.
|
||||
|
|
@ -20,19 +77,19 @@
|
|||
- `combat.js` resolves fighter animation keys through `ensureFighterTeamAnimation()` so every action can use the team-shadow baked texture generated from the original spritesheet.
|
||||
- `playIfNeeded()` compares against the team-shadow animation key. This avoids switching back to the original non-team-colored spritesheet when fighters move, attack, take damage, or die.
|
||||
- Frost stun remains a body tint effect in `worldEffects.js`. Since team identity is baked into the floor shadow pixels, there is no `teamMarker` tint state to update or restore.
|
||||
- The removed `teamMarker` display object means death handling no longer needs to hide or destroy a separate marker. HUD cleanup only owns the name label and health bar objects.
|
||||
- The removed `teamMarker` display object means death handling no longer needs to hide or destroy a separate marker. HUD cleanup only owns health-bar objects because battlefield name labels are no longer created.
|
||||
|
||||
# Update: Focused Combat Effects In Large Battles
|
||||
|
||||
- `combat.js` exposes supplemental combat visuals only while a large battle is inside the temporary meteor camera-focus window.
|
||||
- Outside that window, large battles skip critical labels, instant-spell sprites, kill-heal sprites, and kill-growth tweens while retaining the underlying damage and reward calculations.
|
||||
- Outside that window, large battles skip critical labels, instant-spell sprites, kill-heal sprites, and kill-growth tweens while retaining underlying damage calculations. Kill rewards are globally disabled by the elite policy.
|
||||
- World-effect meteor/frost visuals remain visible, and projectile objects remain enabled because projectiles currently participate in hit detection.
|
||||
|
||||
# Context: Combat System
|
||||
|
||||
## 1. 모듈별 상세 역할 (`src/game/combat/`)
|
||||
|
||||
- **`combat.js`**: 전투 AI, 피해 계산, 처치 보상 등 핵심 전투 로직을 담당합니다. `fighterStats.js`에서 해석한 역할별 수치로 이동, 공격, 투사체 발사 등을 처리합니다.
|
||||
- **`combat.js`**: 전투 AI, 피해 계산, 처치 기록 및 비활성화된 보너스 경로를 담당합니다. `fighterStats.js`에서 해석한 역할별 수치로 이동, 공격, 투사체 발사 등을 처리합니다.
|
||||
- **`combatSettings.js`**: 전투 속도 배율 등 런타임 전투 설정을 관리합니다.
|
||||
- **`arenaFinalCombatEffects.js`**: 최종 교전 시 슬로우 모션 등 연출 효과를 담당합니다. 수학적인 이징(easing) 함수와 물리 시간 배율 계산을 포함합니다.
|
||||
- **`worldEffects.js`**: 실제 전투에서 설정 주기마다 생존자 밀집 구역을 탐색하고 화염/냉기 소형 메테오 포격을 실행하며, 대각선 낙하 연출, 개별 탄착 판정, 냉기 동결과 감속 구역 수명주기를 처리합니다.
|
||||
|
|
@ -41,13 +98,14 @@
|
|||
|
||||
### 전투 AI 및 유닛 동작
|
||||
- **`updateFighter()`**: 가장 가까운 적을 찾아 이동하거나 공격하는 유닛 AI의 핵심입니다.
|
||||
- **`applyHit()`**: 일반 공격 피해량은 공격자의 `melee`/`ranged`/`magic` 프로필 피해량 범위에서 계산하고, 치명타 적중은 `Critical!` 표기와 즉시 처치를 처리합니다.
|
||||
- **`applyHit()`**: 일반 공격 피해량은 공격자의 `melee`/`ranged`/`magic` 프로필 피해량 범위에서 계산합니다. 치명타 적중은 `Critical!`을 표시하고, 일반 대상에는 일반 피해의 2배, elite 대상에는 최대 체력 비례 피해를 적용합니다.
|
||||
- **역할별 기본값**: `src/constants.js`의 `FIGHTER_TYPE_STATS`에서 체력, 이동속도, 사거리, 공격 쿨다운, 피해량, 치명타 확률, 발동 지연을 독립적으로 조절합니다. 투사체 속도는 `ranged`, 효과 적중 지연은 `magic` 프로필에 포함됩니다.
|
||||
- **`projectilePathHitsDefender()`**: 투사체가 대상을 스쳐 지나가지 않도록 궤적(Line)과 히트박스(Rectangle) 겹침 검사를 수행합니다.
|
||||
|
||||
### 처치 보상 및 성장
|
||||
- **`applyKillReward()`**: 처치한 캐릭터의 체력 회복(현재 체력 30%), 크기 증가, 공격속도/이동속도 배율 증가를 처리합니다. 누적 배율은 `KILL_GROWTH_MAX_MULTIPLIER`로 제한합니다.
|
||||
- **`clampFighterInsideArena()`**: 처치 성장 중 커진 캐릭터가 전장 바깥으로 나가지 않도록 위치를 보정합니다.
|
||||
### 처치 보너스 정책
|
||||
- elite 압축 전투에서는 `COMBAT.KILL_REWARD_ENABLED`가 `false`이므로 처치자 체력 회복, 크기 성장, 공격속도/이동속도 보너스와 회복 이펙트가 적용되지 않습니다.
|
||||
- 킬로그, 사망 통계, 분열 판정, 승패 판정은 처치 보너스와 별개로 계속 처리됩니다.
|
||||
- `applyKillReward()`와 관련 상수는 향후 별도의 비압축 모드에서 명시적으로 활성화할 수 있는 경로로만 보존합니다.
|
||||
|
||||
### 월드 이펙트
|
||||
- **발동 규칙**: 프리뷰가 아닌 실제 전투에서 시작 후 첫 포격은 `WORLD_EFFECT.INTERVAL`이 지난 뒤 발생하고, 이후 일반 포격은 `WORLD_EFFECT.REPEAT_INTERVAL` 간격으로 발생합니다. 각 포격은 `AREA_TILES` 크기의 모든 후보 구역을 타일 누적합으로 평가해, 생존 캐릭터가 가장 많이 모인 범위를 선택합니다. 같은 밀도의 후보가 여러 개일 때만 그 후보 사이에서 무작위로 고릅니다.
|
||||
|
|
@ -67,10 +125,10 @@
|
|||
- Arcade Physics는 timeScale 방향이 반대라 물리 이동에는 역수 배율을 적용합니다.
|
||||
|
||||
## 3. 유지보수 규칙
|
||||
- **처치 성장 상한**: `src/constants.js`의 `KILL_GROWTH_MAX_MULTIPLIER`를 수정합니다.
|
||||
- **공격력 조정**: `src/constants.js`의 `FIGHTER_TYPE_STATS.<type>.damageMin/damageMax`를 수정합니다.
|
||||
- **처치 보너스**: elite 압축 규칙을 유지하는 동안 `src/constants.js`의 `COMBAT.KILL_REWARD_ENABLED`는 `false`로 유지합니다.
|
||||
- **공격력 조정**: 일반 역할 피해량은 `src/constants.js`의 `FIGHTER_TYPE_STATS.<type>.damageMin/damageMax`를 수정하고, elite 추가 공격력은 `FIGHTER.ELITE.ATTACK_DAMAGE_BONUS_MULTIPLIER`와 `ATTACK_DAMAGE_STACK_EXPONENT`를 수정합니다.
|
||||
- **월드 이펙트 및 서든 데스 조정**:
|
||||
- `src/constants.js`의 `WORLD_EFFECT.METEOR_DAMAGE`와 `WORLD_EFFECT.FROST_DAMAGE`로 피해량을 조정합니다.
|
||||
- `src/constants.js`의 `WORLD_EFFECT.METEOR_DAMAGE`와 `WORLD_EFFECT.FROST_DAMAGE`는 normal 고정 피해를, `METEOR_DAMAGE_PERCENT`와 `FROST_DAMAGE_PERCENT`는 elite 최대 체력 비례 피해를 조정합니다.
|
||||
- `SUDDEN_DEATH.ENABLED`로 서든 데스 활성화 여부를 결정하며, `TRIGGER_MS`(시작 시간), `INTERVAL_MS`(주기), `FORCE_FROST`(냉기 고정) 설정을 변경할 수 있습니다.
|
||||
- `INTERVAL`은 첫 포격까지의 대기 시간, `REPEAT_INTERVAL`은 이후 일반 포격 주기입니다. `AREA_TILES`는 밀집도를 검색하고 경고로 표시할 큰 구역이며, `WARNING_DURATION_MS`는 그 경고 표시 시간입니다. `IMPACT_AREA_TILES`, `IMPACT_COUNT_MIN`/`IMPACT_COUNT_MAX`, `IMPACT_STAGGER_MS`, `IMPACT_VISUAL_SCALE`는 내부 소형 포격의 판정 범위, 발수, 간격, 시각 크기를 조정합니다.
|
||||
- `WORLD_EFFECT.FROST_STUN_DURATION`/`FROST_STUN_TINT`로 동결 시간과 표시 색상을 조정합니다.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,35 @@
|
|||
# Update: Special Effect Constants
|
||||
|
||||
- `src/constants.js` now exports `SPECIAL_EFFECT` for the special projectile system, while `WORLD_EFFECT.SPECIAL` references the same object for world-effect domain grouping.
|
||||
- `SPECIAL_EFFECT.TRIGGER_DELAY_MIN_MS`, `TRIGGER_DELAY_MAX_MS`, and `RETRY_DELAY_MS` control the once-per-match activation window.
|
||||
- `SPECIAL_EFFECT.CASTER`, `CAMERA`, `MELEE`, and `PROJECTILE` centralize the Hurt-frame pose, non-magic caster type balancing, caster invulnerability time, caster-start centering, zoom timing, projectile-view zoom-out timing, melee projectile frame sequences/looping assets, projectile start hold, size, speed, target density area, arena edge padding, hit radius, travel distance, and lifetime.
|
||||
- `SPECIAL_EFFECT.FOCUS_LAYER` controls the temporary caster-emphasis stack: blurred battlefield snapshot depth/alpha, dim depth/alpha, caster depth, Blur FX quality/strength/steps, and fade timing.
|
||||
|
||||
# Update: Large-Battle Render Budget
|
||||
|
||||
- `PERFORMANCE.LARGE_BATTLE_RENDERED_FIGHTER_LIMIT` caps the number of physical fighter plans produced for large battles.
|
||||
- `matchSetup.js` applies the budget after randomized elite compression by promoting normal 100-member blocks or normal remainder groups to elite groups as needed. It does not change represented `stackCount` population.
|
||||
|
||||
# Update: Large-Battle Elite Probability
|
||||
|
||||
- `FIGHTER.ELITE.RANDOMIZED_COMPRESSION.LARGE_BATTLE_ELITE_BLOCK_PROBABILITY` controls the randomized elite block ratio once the user-entered total fighter count exceeds `PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD`.
|
||||
- `matchSetup.js` keeps the threshold under `PERFORMANCE` and the elite ratio under `FIGHTER.ELITE`, so performance detection and elite balancing remain separately tunable.
|
||||
|
||||
# Update: Elite Magic Attack Effect Scale
|
||||
|
||||
- `FIGHTER.ATTACK_EFFECT_SCALE_MULTIPLIER` controls normal instant-spell attack effect size.
|
||||
- `FIGHTER.ELITE.ATTACK_EFFECT_SCALE_MULTIPLIER` applies only to elite magic fighters, multiplying the normal spell-effect scale without changing body scale, HP, range, or damage formulas.
|
||||
- Elite skin selection uses the full `FIGHTER.ELITE.TYPE` list, currently `melee` and `magic`.
|
||||
|
||||
# Update: Elite Balance Constants
|
||||
|
||||
- `FIGHTER.ELITE` contains elite type, stack/appearance/HP/range tuning, attack-damage and speed tuning, and randomized large-team compression settings inside the fighter domain.
|
||||
- `COMBAT.CRITICAL_DAMAGE_PERCENT` sets elite critical damage from target max HP, while `COMBAT.NORMAL_CRITICAL_DAMAGE_MULTIPLIER` replaces normal-fighter instant critical kills with multiplied attack damage.
|
||||
- `COMBAT.ELITE_KILL_SPLASH_ENABLED`, `ELITE_KILL_SPLASH_DAMAGE_PERCENT`, `ELITE_KILL_SPLASH_RADIUS`, and `ELITE_KILL_SPLASH_CHAIN_ENABLED` tune the elite-only on-kill area damage centered on the killed fighter.
|
||||
- `COMBAT.KILL_REWARD_ENABLED` is `false` by default because one compressed kill is not equivalent to one represented casualty. The legacy heal/growth constants remain available only for an explicitly re-enabled mode.
|
||||
- `WORLD_EFFECT.METEOR_DAMAGE_PERCENT` and `WORLD_EFFECT.FROST_DAMAGE_PERCENT` apply only to elite targets. Existing fixed `METEOR_DAMAGE` and `FROST_DAMAGE` remain the normal-target values.
|
||||
- `ATTACK_DAMAGE_*`, `ATTACK_SPEED_*`, and `MOVE_SPEED_*` constants control elite stack bonuses. For each bonus, multiplier `0` removes the added bonus and multiplier `1` applies the configured stack exponent fully.
|
||||
|
||||
# Context: Core & Infrastructure
|
||||
|
||||
# Update: Dense-Area Meteor Barrage
|
||||
|
|
@ -34,8 +66,8 @@
|
|||
- **`src/constants.js`**: 게임 내 모든 튜닝 수치를 관리합니다.
|
||||
- `FIGHTER_TYPE_STATS`: `melee`, `ranged`, `magic`별 최대 체력, 이동속도, 사거리, 쿨다운, 피해량, 치명타 및 공격 발동 지연 기본값.
|
||||
- `FIGHTER_HITBOX_*`: 100x100 캐릭터 프레임 안에서 실제 충돌 판정이 놓이는 위치와 크기.
|
||||
- `KILL_HEALTH_RECOVERY_RATIO`, `KILL_GROWTH_MULTIPLIER`, `KILL_GROWTH_MAX_MULTIPLIER`: 처치 후 회복량, 크기/공격속도/이동속도 성장 배율, 누적 보상 상한.
|
||||
- `WORLD_EFFECT.*`: 첫/반복 포격 간격, 밀집 경고 범위, 개별 탄착 범위/발수/시각 배율, 대각선 낙하 거리, 화염/냉기 메테오 피해량, 냉기 동결 시간/색상, 냉각지대 지속시간과 감속 배율.
|
||||
- `KILL_REWARD_ENABLED`, `KILL_HEALTH_RECOVERY_RATIO`, `KILL_GROWTH_MULTIPLIER`, `KILL_GROWTH_MAX_MULTIPLIER`: 기본적으로 비활성화된 처치 보너스 토글과, 명시적으로 재활성화할 때 사용하는 회복/성장 값.
|
||||
- `WORLD_EFFECT.*`: 첫/반복 포격 간격, 밀집 경고 범위, 개별 탄착 범위/발수/시각 배율, 대각선 낙하 거리, normal 고정 화염/냉기 피해량, elite 최대 체력 비례 화염/냉기 피해량, 냉기 동결 시간/색상, 냉각지대 지속시간과 감속 배율.
|
||||
- `SELECTED_FIGHTER_OUTLINE_GAP`, `SELECTED_FIGHTER_OUTLINE_WIDTH`, `SELECTED_FIGHTER_OUTLINE_ALPHA`: 팀 색상 실루엣 마커의 캐릭터 이격 거리, 두께, 투명도.
|
||||
- `TEAM_COLORS`, `getTeamColor()`: 8팀 이하에서는 기본 팔레트를 쓰고, 9팀 이상에서는 팀 수에 맞춰 중복 없는 색상을 동적으로 생성합니다.
|
||||
- `CAMERA.SPECTATOR_LERP`: 카메라 추적의 부드러움 정도.
|
||||
|
|
@ -50,8 +82,8 @@
|
|||
- **신규 캐릭터 추가**: `public/assets/characters/`에 에셋 배치 후 `fighterManifest.js`에 정의를 추가하면 즉시 게임에 반영됩니다.
|
||||
- **종족값 유지**: 신규 스킨을 추가할 때는 사망 통계가 누락되지 않도록 `species`를 `human`, `orc`, `skeleton`, `slime`, `wolf`, `bear` 중 하나로 지정해야 합니다.
|
||||
- **물리 수치 조정**: 역할별 기본 체력/속도/사거리/공격 수치는 `src/constants.js`의 `FIGHTER_TYPE_STATS`에서 변경하고, 특정 스킨만 다르게 할 때는 `fighterManifest.js`의 `stats` 또는 `combat` 설정을 사용하십시오.
|
||||
- **처치 성장 상한 조정**: 처치 보상으로 캐릭터가 커지는 최대치와 공격/이동 배율 상한은 `src/constants.js`의 `KILL_GROWTH_MAX_MULTIPLIER`를 수정합니다.
|
||||
- **처치 보너스 정책**: elite 압축 전투에서는 `src/constants.js`의 `COMBAT.KILL_REWARD_ENABLED`를 `false`로 유지합니다. 별도 모드에서 재활성화할 때만 `KILL_GROWTH_MAX_MULTIPLIER` 등 보너스 수치를 조정합니다.
|
||||
- **공격력 조정**: 역할별 기본 피해량은 `src/constants.js`의 `FIGHTER_TYPE_STATS.<type>.damageMin/damageMax`를 수정합니다. 캐릭터별 특수 공격 방식은 `fighterManifest.js`의 `combat` 설정을 우선 확인합니다.
|
||||
- **월드 이펙트 조정**: `src/constants.js`의 `WORLD_EFFECT.INTERVAL`, `WORLD_EFFECT.REPEAT_INTERVAL`, `WORLD_EFFECT.AREA_TILES`, `WORLD_EFFECT.WARNING_DURATION_MS`, `WORLD_EFFECT.IMPACT_AREA_TILES`, `WORLD_EFFECT.IMPACT_COUNT_MIN`, `WORLD_EFFECT.IMPACT_COUNT_MAX`, `WORLD_EFFECT.IMPACT_STAGGER_MS`, `WORLD_EFFECT.IMPACT_VISUAL_SCALE`, `WORLD_EFFECT.SIZE_SCALE_VARIANCE`, `WORLD_EFFECT.FALL_TRAVEL_TILES`, `WORLD_EFFECT.METEOR_SHAKE_DURATION_MS`, `WORLD_EFFECT.METEOR_SHAKE_INTENSITY`, `WORLD_EFFECT.METEOR_DAMAGE`, `WORLD_EFFECT.FROST_DAMAGE`, `WORLD_EFFECT.FROST_STUN_DURATION`, `WORLD_EFFECT.FROST_STUN_TINT`, `WORLD_EFFECT.FROST_DURATION`, `WORLD_EFFECT.FROST_SPEED_MULTIPLIER`를 수정합니다. `INTERVAL`은 첫 포격까지의 대기 시간, `REPEAT_INTERVAL`은 이후 일반 포격 주기, `AREA_TILES`와 `WARNING_DURATION_MS`는 밀집 경고 구역과 표시 시간이며, `IMPACT_*` 값은 그 내부 실제 포격을 제어합니다. 임시 메테오 카메라는 `CAMERA.METEOR_FOCUS_ENABLED`로 끌 수 있습니다.
|
||||
- **월드 이펙트 조정**: `src/constants.js`의 `WORLD_EFFECT.INTERVAL`, `WORLD_EFFECT.REPEAT_INTERVAL`, `WORLD_EFFECT.AREA_TILES`, `WORLD_EFFECT.WARNING_DURATION_MS`, `WORLD_EFFECT.IMPACT_AREA_TILES`, `WORLD_EFFECT.IMPACT_COUNT_MIN`, `WORLD_EFFECT.IMPACT_COUNT_MAX`, `WORLD_EFFECT.IMPACT_STAGGER_MS`, `WORLD_EFFECT.IMPACT_VISUAL_SCALE`, `WORLD_EFFECT.SIZE_SCALE_VARIANCE`, `WORLD_EFFECT.FALL_TRAVEL_TILES`, `WORLD_EFFECT.METEOR_SHAKE_DURATION_MS`, `WORLD_EFFECT.METEOR_SHAKE_INTENSITY`, `WORLD_EFFECT.METEOR_DAMAGE`, `WORLD_EFFECT.FROST_DAMAGE`, `WORLD_EFFECT.METEOR_DAMAGE_PERCENT`, `WORLD_EFFECT.FROST_DAMAGE_PERCENT`, `WORLD_EFFECT.FROST_STUN_DURATION`, `WORLD_EFFECT.FROST_STUN_TINT`, `WORLD_EFFECT.FROST_DURATION`, `WORLD_EFFECT.FROST_SPEED_MULTIPLIER`를 수정합니다. `INTERVAL`은 첫 포격까지의 대기 시간, `REPEAT_INTERVAL`은 이후 일반 포격 주기, `AREA_TILES`와 `WARNING_DURATION_MS`는 밀집 경고 구역과 표시 시간이며, `IMPACT_*` 값은 그 내부 실제 포격을 제어합니다. 임시 메테오 카메라는 `CAMERA.METEOR_FOCUS_ENABLED`로 끌 수 있습니다.
|
||||
- **DOM 접근**: 성능을 위해 `ArenaScene`은 좌측 HUD badge 등 필요한 시점에만 최소한으로 DOM에 접근합니다.
|
||||
- **패키지 락 파일**: 이 프로젝트는 `package-lock.json`을 저장소에서 제외합니다. 의존성 변경 시 `package.json`을 기준으로 관리합니다.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,20 @@
|
|||
# Update: Field HUD Text Removal
|
||||
|
||||
- `fighterFactory.js` no longer creates pooled battlefield name labels. Zoom-visible and selected fighters can still show pooled health bars, while team identity comes from the team-colored sprite shadow.
|
||||
- HUD cleanup now owns only health-bar display objects.
|
||||
|
||||
# Update: Elite Representative Fighter
|
||||
|
||||
- `fighterFactory.js` accepts `isElite` and `stackCount` on a spawn plan. Elite attack damage is tuned by `FIGHTER.ELITE.ATTACK_DAMAGE_BONUS_MULTIPLIER` and `ATTACK_DAMAGE_STACK_EXPONENT`; HP, scale, and range use the other nested elite settings.
|
||||
- `fighterSelection.js` assigns elite plans only skins whose derived type matches `FIGHTER.ELITE.TYPE` (currently `melee` and `magic`); normal plans still draw from the complete manifest.
|
||||
- Elite scale becomes its `baseScaleX`/`baseScaleY`; kill-growth is currently disabled by `COMBAT.KILL_REWARD_ENABLED = false`, but this baseline remains correct if a separate mode enables it later.
|
||||
- Elite magic attack effects are scaled in `combat.js` through `FIGHTER.ELITE.ATTACK_EFFECT_SCALE_MULTIPLIER`, so spell visuals can be tuned independently from body scale.
|
||||
- Elite representatives cannot use `splitOnDeath`. Elite attack-speed and movement-speed bonuses are configurable independently under `FIGHTER.ELITE`.
|
||||
|
||||
# Update: HUD Pooling
|
||||
|
||||
- `fighterFactory.js` no longer creates permanent name labels or health bars for every fighter.
|
||||
- HUD display objects are pooled on the scene and assigned only to selected fighters or zoom-visible nearby fighters chosen by `ArenaScene`.
|
||||
- `fighterFactory.js` no longer creates permanent health bars for every fighter, and battlefield name labels are not created at all.
|
||||
- Health-bar HUD display objects are pooled on the scene and assigned only to selected fighters or zoom-visible nearby fighters chosen by `ArenaScene`.
|
||||
- `syncFighterHud()` acquires a slot lazily and `releaseFighterHud()` returns it to the pool when the fighter leaves the HUD candidate set, dies, or is destroyed.
|
||||
- Tune pool size and visible candidate limits in `PERFORMANCE.FIGHTER_HUD_POOL_SIZE` and `PERFORMANCE.FIGHTER_HUD_VISIBLE_LIMIT`.
|
||||
|
||||
|
|
@ -41,7 +54,7 @@
|
|||
### 캐릭터별 특성 (예: Slime)
|
||||
- **`spawnMultiplier`**: 배정된 슬롯 1개를 지정된 수만큼 확장하여 스폰합니다.
|
||||
- **`splitOnDeath`**: 사망 시 확률적으로 지정된 수만큼 분열체를 생성합니다.
|
||||
- **스탯 상한**: 처치 보상은 현재 체력을 회복시키지만 `maxHp`를 넘을 수 없습니다. (예: Slime은 항상 1 HP)
|
||||
- **처치 보너스 비활성화**: elite 압축 전투에서는 처치 회복/성장 보너스가 적용되지 않습니다. 따라서 Slime을 포함한 모든 fighter는 처치로 HP 또는 크기/속도 배율을 얻지 않습니다.
|
||||
|
||||
### 역할별 전투 스탯
|
||||
- `combat.type`이 `projectile`이면 `ranged`, `instant-spell`이면 `magic`, 그 외에는 `melee` 기본 프로필을 사용합니다.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,27 @@
|
|||
# Update: Restrained Team Card Styling
|
||||
|
||||
- Team score cards preserve their existing content and selection behavior while using a neutral dark card surface.
|
||||
- Per-team color now reads mainly through a compact marker and a small divider segment, making the HUD feel less saturated.
|
||||
- Focus and hover feedback uses subtle inset emphasis without the previous raised motion or strong glow.
|
||||
|
||||
# Update: Battle Notice Rolling Text
|
||||
|
||||
- `battleDeathNotice.js` measures the rendered message against the visible notice content width and only enables rolling text when the message would overflow.
|
||||
- Rolling notices render an internal duplicated track for continuous movement while exposing the single message through the status node's `aria-label`.
|
||||
- `UI.BATTLE_NOTICE_ROLL_GAP_PX`, `BATTLE_NOTICE_ROLL_SPEED_PX_PER_SECOND`, and min/max duration constants tune the marquee behavior.
|
||||
|
||||
# Update: Elite Compression And Population Display
|
||||
|
||||
- Below `FIGHTER.ELITE.RANDOMIZED_COMPRESSION.MIN_TEAM_SIZE`, `matchSetup.js` converts each complete `FIGHTER.ELITE.STACK_SIZE = 100` block into one elite plan and keeps the remainder as individual normal plans. With the current threshold of `100`, complete blocks are randomized.
|
||||
- For starting-zone matches, each elite consumes the assigned spawn point at the start of its represented 100-member block, while remainder normals retain their corresponding individual spawn points.
|
||||
- At or above the randomized-compression threshold, each complete 100-member block becomes one elite at probability `0.6`, or expands into 100 normal plans otherwise.
|
||||
- If the user-entered total fighter count exceeds `PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD`, randomized compression uses `FIGHTER.ELITE.RANDOMIZED_COMPRESSION.LARGE_BATTLE_ELITE_BLOCK_PROBABILITY` (`0.8` by default) for every eligible team block.
|
||||
- Large battles also enforce `PERFORMANCE.LARGE_BATTLE_RENDERED_FIGHTER_LIMIT` by promoting failed normal blocks or normal remainder groups to elite groups after the random roll. This keeps physical sprites bounded while preserving represented `stackCount`.
|
||||
- `arenaMatchRuntime.js` keeps the submitted population represented through `stackCount`, while `arenaScoreboard.js` intentionally shows living physical composition as `E : <elite sprites> | N : <normal sprites>`.
|
||||
- Trait-generated extra spawning remains enabled for normal fighters only. Elite plans do not apply `spawnMultiplier`, because one aggregate fighter multiplying would multiply the entire represented army.
|
||||
- `ArenaScene` uses setup-aware fighter selection so elite plans receive only skins matching `FIGHTER.ELITE.TYPE` (currently `melee` and `magic`), while normal plans keep the existing full selection pool.
|
||||
- The team card layout reserves enough horizontal space for values such as `E : 32 | N : 800`, including the horizontally scrolling mobile scoreboard.
|
||||
|
||||
# Context: Match & UI
|
||||
|
||||
# Update: Direct Fighter Count Entries And Zone Distribution
|
||||
|
|
@ -30,7 +54,7 @@
|
|||
- **설정 유지**: 닉네임, 인원, 배치 모드는 `localStorage`에 저장되어 재접속 시 복원됩니다.
|
||||
|
||||
### 전투 화면 레이아웃 (HUD)
|
||||
- **팀 Badge**: 좌측 HUD 레일에 배치되며, 클릭 시 해당 팀의 생존 유닛 중 무작위 1명으로 시점을 고정합니다.
|
||||
- **팀 Badge**: 좌측 HUD 레일에 배치되며, 클릭 시 해당 팀의 생존 유닛 중 무작위 1명으로 시점을 고정합니다. 이미 고정된 동일 팀 Badge를 다시 클릭하면 선택을 해제하고 기본 줌을 요청합니다. 단, 자동 관전 줌 조건이 활성화되어 있으면 다음 카메라 갱신에서 자동 줌이 즉시 다시 적용됩니다.
|
||||
- **팀 Badge 갱신 안정성**: 사망으로 생존 수가 바뀔 때 기존 badge 버튼 DOM을 유지한 채 숫자, 비활성 상태, 선택 강조만 갱신하여 사망 프레임에 겹친 클릭도 시점 고정으로 전달되도록 합니다.
|
||||
- **킬로그**: 처치자와 피처치자를 좌우로 배치하고, 피처치자 아이콘에 빨간 X를 겹쳐 사망 관계를 명확히 표시합니다. 캐릭터 idle 시트의 `100x100` 프레임 내 투명 여백을 제외한 중앙 하단 영역을 확대 표시해 작은 아이콘 박스에서도 실루엣이 충분히 보이도록 합니다.
|
||||
- **하단 메타 정보**: 전투 화면 우측 하단(`arena-meta` 컨테이너)에 방문자 카운터와 About 버튼이 Pill(알약) 형태로 디자인이 통일되어 나란히 고정 배치됩니다. 드로어가 열려도 동일한 위치를 유지합니다.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,262 @@
|
|||
# Elite 캐릭터 구현 문서
|
||||
|
||||
## 현재 상태
|
||||
|
||||
이 문서는 `major` 브랜치에서 `30d7be41bef258685bf67219f2fcf77334c191f8`를
|
||||
기준으로 구현한 elite 압축 전투 규칙을 설명한다. 이전 WIP에서 누락됐던 월드 이펙트
|
||||
비율 상수까지 포함해 구현했으며, `npm run build`로 빌드를 검증했다.
|
||||
|
||||
## 기능 의도
|
||||
|
||||
### 1. 인원 압축
|
||||
|
||||
- 참가자 입력은 기존의 `닉네임*N` 형식을 유지한다.
|
||||
- `FIGHTER.ELITE.RANDOMIZED_COMPRESSION.MIN_TEAM_SIZE` 미만에서는 `STACK_SIZE = 100`명마다 elite fighter 1개체를 소환한다.
|
||||
- 소규모 팀에서 100명으로 묶이지 않는 나머지는 normal fighter를 1명당 1개체씩 소환한다.
|
||||
- 현재 `MIN_TEAM_SIZE = 100` 설정에서는 100명 블록이 있는 입력부터 랜덤 압축 대상이다.
|
||||
- 일반 랜덤 압축은 100명 블록마다 `ELITE_BLOCK_PROBABILITY = 0.6`으로 elite 압축 여부를 판정한다.
|
||||
- 사용자가 입력한 총 fighter 수가 `PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD`보다 크면
|
||||
`LARGE_BATTLE_ELITE_BLOCK_PROBABILITY = 0.8`을 사용해 elite 압축 비율을 높인다.
|
||||
예: `Alice*4000`은 40개 블록 중 장기 평균 32개가 elite 32개체로 압축되어 3,200명을
|
||||
대표하고, 나머지 8개 블록은 normal 800개체로 실제 렌더링된다.
|
||||
- 대규모 전투에서는 `PERFORMANCE.LARGE_BATTLE_RENDERED_FIGHTER_LIMIT`도 적용한다.
|
||||
랜덤 판정 후 실제 렌더링 수가 제한을 넘으면 normal 100명 블록이나 remainder 묶음을 elite 그룹으로 추가 승격한다.
|
||||
- 팀 카드는 대표 인원 합계 대신 생존 렌더 구성을 `E : <elite 수> | N : <normal 수>`로 표시한다.
|
||||
- 사망 통계, 관전 판정, 밀집 구역 표적 선정은 계속 `stackCount` 합계를 사용한다.
|
||||
|
||||
### 2. Elite 스탯
|
||||
|
||||
Update: elite magic attack effects now use `FIGHTER.ELITE.ATTACK_EFFECT_SCALE_MULTIPLIER`
|
||||
on top of the normal `FIGHTER.ATTACK_EFFECT_SCALE_MULTIPLIER`, so spell visuals can be tuned
|
||||
separately from the elite fighter body scale.
|
||||
|
||||
구현된 상수:
|
||||
|
||||
```js
|
||||
export const FIGHTER = {
|
||||
// ...
|
||||
ATTACK_EFFECT_SCALE_MULTIPLIER: 1,
|
||||
ELITE: {
|
||||
TYPE: ["melee", "magic"],
|
||||
STACK_SIZE: 100,
|
||||
VISUAL_SCALE_MULTIPLIER: 5,
|
||||
ATTACK_EFFECT_SCALE_MULTIPLIER: 5,
|
||||
HP_BONUS_RATIO: 1,
|
||||
ATTACK_RANGE_MULTIPLIER: 1.5,
|
||||
ATTACK_DAMAGE_BONUS_MULTIPLIER: 1,
|
||||
ATTACK_DAMAGE_STACK_EXPONENT: 0.1,
|
||||
ATTACK_SPEED_BONUS_MULTIPLIER: 1,
|
||||
ATTACK_SPEED_STACK_EXPONENT: 0.1,
|
||||
MOVE_SPEED_BONUS_MULTIPLIER: 1,
|
||||
MOVE_SPEED_STACK_EXPONENT: 0,
|
||||
RANDOMIZED_COMPRESSION: {
|
||||
MIN_TEAM_SIZE: 100,
|
||||
ELITE_BLOCK_PROBABILITY: 0.6,
|
||||
LARGE_BATTLE_ELITE_BLOCK_PROBABILITY: 0.8,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const PERFORMANCE = {
|
||||
LARGE_BATTLE_FIGHTER_THRESHOLD: 3000,
|
||||
LARGE_BATTLE_RENDERED_FIGHTER_LIMIT: 1200,
|
||||
// ...
|
||||
};
|
||||
```
|
||||
|
||||
elite 계산 의도:
|
||||
|
||||
```js
|
||||
const attackDamageMultiplier = 1
|
||||
+ FIGHTER.ELITE.ATTACK_DAMAGE_BONUS_MULTIPLIER
|
||||
* (stackCount ** FIGHTER.ELITE.ATTACK_DAMAGE_STACK_EXPONENT - 1);
|
||||
const visualScale = FIGHTER.SCALE * FIGHTER.ELITE.VISUAL_SCALE_MULTIPLIER;
|
||||
const rangeBonus =
|
||||
(visualScale - FIGHTER.SCALE) * (FIGHTER.HITBOX_WIDTH / 2);
|
||||
|
||||
damageMin = baseDamageMin * attackDamageMultiplier;
|
||||
damageMax = baseDamageMax * attackDamageMultiplier;
|
||||
maxHp = baseMaxHp * stackCount * FIGHTER.ELITE.HP_BONUS_RATIO;
|
||||
attackRange =
|
||||
baseAttackRange * FIGHTER.ELITE.ATTACK_RANGE_MULTIPLIER + rangeBonus;
|
||||
attackSpeedMultiplier *= 1 + FIGHTER.ELITE.ATTACK_SPEED_BONUS_MULTIPLIER
|
||||
* (stackCount ** FIGHTER.ELITE.ATTACK_SPEED_STACK_EXPONENT - 1);
|
||||
moveSpeedMultiplier *= 1 + FIGHTER.ELITE.MOVE_SPEED_BONUS_MULTIPLIER
|
||||
* (stackCount ** FIGHTER.ELITE.MOVE_SPEED_STACK_EXPONENT - 1);
|
||||
```
|
||||
|
||||
- 피해량, 공격속도, 이동속도 보너스는 각각 `FIGHTER.ELITE.*_BONUS_MULTIPLIER`와
|
||||
`*_STACK_EXPONENT`로 조정한다. multiplier `0`은 추가 보너스 없음이고,
|
||||
multiplier `1`은 설정한 stack 곡선을 그대로 적용한다.
|
||||
- HP는 압축 인원수와 현재 `FIGHTER.ELITE.HP_BONUS_RATIO = 1` 설정에 따라 선형 비례한다.
|
||||
- 이동속도에는 `stackCount` 보정을 적용하지 않는다. 공격 DPS와 생존력만 대표
|
||||
인원에 맞춰 증가시키고, 거대 elite의 전장 이동은 일반 이동 규칙을 유지한다.
|
||||
|
||||
### 3. 처치 보너스 비활성화
|
||||
|
||||
- elite는 여러 명의 피해량과 체력을 하나의 객체로 대표하므로, 물리 객체 기준의
|
||||
처치 1회에 회복/성장 보너스를 주면 실제 대표 인원 기준으로 보상이 과대 적용된다.
|
||||
- `COMBAT.KILL_REWARD_ENABLED = false`를 기본 정책으로 두고, 모든 fighter의
|
||||
처치 회복, 크기 성장, 공격속도/이동속도 보너스, 회복 이펙트를 비활성화한다.
|
||||
- 킬로그, 사망 통계, 승패 판정은 계속 동작한다. 기존 보너스 구현은 별도 모드가
|
||||
필요할 경우 명시적으로 재활성화할 수 있도록 코드에 남겨 둔다.
|
||||
|
||||
### 4. Elite 대상 피해 이원화
|
||||
|
||||
구현된 치명타 상수:
|
||||
|
||||
```js
|
||||
COMBAT.CRITICAL_DAMAGE_PERCENT = 0.1;
|
||||
COMBAT.NORMAL_CRITICAL_DAMAGE_MULTIPLIER = 2;
|
||||
```
|
||||
|
||||
의도한 판정:
|
||||
|
||||
- normal 대상 치명타: 일반 랜덤 피해의 2배를 적용한다.
|
||||
- elite 대상 치명타: `maxHp`의 10% 피해를 적용하되, 일반 타격 피해보다 낮아지지 않게 한다.
|
||||
- normal 대상 메테오/냉기: 기존 고정 피해인 `WORLD_EFFECT.METEOR_DAMAGE`,
|
||||
`WORLD_EFFECT.FROST_DAMAGE`를 유지한다.
|
||||
- elite 대상 메테오: `maxHp`의 40% 피해를 적용한다.
|
||||
- elite 대상 냉기: `maxHp`의 20% 피해를 적용한다.
|
||||
|
||||
이전 WIP에서 누락됐고 이번 구현에서 보완한 상수:
|
||||
|
||||
```js
|
||||
WORLD_EFFECT.METEOR_DAMAGE_PERCENT = 0.4;
|
||||
WORLD_EFFECT.FROST_DAMAGE_PERCENT = 0.2;
|
||||
```
|
||||
|
||||
위 두 값은 `src/constants.js`에 정의되어 elite 월드 이펙트 피해 계산에 사용된다.
|
||||
|
||||
## 구현 변경 지점
|
||||
|
||||
### `src/constants.js`
|
||||
|
||||
- `COMBAT.CRITICAL_DAMAGE_PERCENT`, `COMBAT.NORMAL_CRITICAL_DAMAGE_MULTIPLIER`를 추가했다.
|
||||
- `COMBAT.KILL_REWARD_ENABLED = false`를 추가해 처치 보너스를 비활성화했다.
|
||||
- `WORLD_EFFECT.METEOR_DAMAGE_PERCENT`, `WORLD_EFFECT.FROST_DAMAGE_PERCENT`를 추가했다.
|
||||
- fighter 도메인 아래 `FIGHTER.ELITE` 키로 elite 상수를 관리한다.
|
||||
- 일반 마법 공격 이펙트는 `FIGHTER.ATTACK_EFFECT_SCALE_MULTIPLIER`, elite 마법 공격 이펙트는
|
||||
`FIGHTER.ELITE.ATTACK_EFFECT_SCALE_MULTIPLIER`로 조정한다.
|
||||
- 카메라/렌더/worker 성능 리팩터링 없이 elite 밸런스 상수만 추가했다.
|
||||
|
||||
### `src/game/match/matchSetup.js`
|
||||
|
||||
- 기존에는 `team.size`만큼 실제 fighter plan을 만들었다.
|
||||
- 임계값 미만 팀은 완전한 100명 블록마다 `stackCount: 100`, `isElite: true`
|
||||
plan을 하나 만들고, 나머지는 `stackCount: 1`, `isElite: false` plan으로 유지한다.
|
||||
- 임계값 이상 팀은 완전한 100명 블록마다
|
||||
`RANDOMIZED_COMPRESSION.ELITE_BLOCK_PROBABILITY`로 elite 여부를 판정한다.
|
||||
성공 블록은 `stackCount: 100`인 elite 하나가 되고, 실패 블록은 normal 100개체로 렌더링한다.
|
||||
- 전체 입력 fighter 수가 `PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD`보다 크면
|
||||
`RANDOMIZED_COMPRESSION.LARGE_BATTLE_ELITE_BLOCK_PROBABILITY`를 사용한다.
|
||||
- 랜덤 압축 결과가 `PERFORMANCE.LARGE_BATTLE_RENDERED_FIGHTER_LIMIT`를 넘으면
|
||||
실패한 normal 100명 블록이나 normal remainder 묶음을 elite 그룹으로 승격해 실제 렌더링 개체 수를 제한한다.
|
||||
- 스폰 좌표 배열은 요청 인원 기준으로 생성하며, 각 elite는 대표하는 100명 블록의
|
||||
첫 스폰 지점을 사용하고 나머지 normal은 대응하는 개별 스폰 지점을 사용한다.
|
||||
|
||||
### `src/game/match/arenaMatchRuntime.js`
|
||||
|
||||
- 팀 크기 동기화는 물리 Sprite 수 대신 `stackCount` 합계를 사용한다.
|
||||
- elite plan에는 `spawnMultiplier`를 적용하지 않아 대표 스택 전체가 한 번에
|
||||
복제되지 않게 한다. normal plan의 기존 trait 동작은 유지한다.
|
||||
|
||||
### `src/game/fighter/fighterFactory.js`
|
||||
|
||||
- `stackCount`, `isElite`를 입력으로 받고 HP, 피해량, 사거리, 외형 크기를 계산한다.
|
||||
- elite의 `baseScaleX`/`baseScaleY`도 큰 외형 기준으로 저장한다. 현재는 킬 보너스가
|
||||
꺼져 있지만, 별도 모드에서 다시 활성화할 경우 elite 기준 크기를 보존한다.
|
||||
- 기존 Sprite 기반 `createFighter()`에만 적용했으며, elite는 `splitOnDeath`를
|
||||
사용하지 않는다.
|
||||
|
||||
### `src/game/fighter/fighterSelection.js`
|
||||
|
||||
- `pickFightersForSetups()`는 elite plan에 `FIGHTER.ELITE.TYPE`과 일치하는 스킨만 배정한다.
|
||||
- normal plan은 기존과 동일하게 전체 fighter manifest에서 스킨을 선택한다.
|
||||
|
||||
### `src/game/combat/combat.js`
|
||||
|
||||
- 치명타 판정을 normal 즉사에서 normal 2배 피해 / elite 최대 HP 비례 피해로 바꿨다.
|
||||
- 월드 이펙트 함수 인자를 고정 `damage` 값에서 `"meteor"`/`"frost"` 타입으로 바꾸고,
|
||||
대상이 elite인지에 따라 고정 피해와 비율 피해를 나눈다.
|
||||
- 공격력 계산은 `FIGHTER.ELITE.ATTACK_DAMAGE_*`, 공격속도와 이동속도 계산은
|
||||
`FIGHTER.ELITE.ATTACK_SPEED_*` 및 `FIGHTER.ELITE.MOVE_SPEED_*` 상수를 사용한다.
|
||||
- instant-spell 공격 이펙트 크기는 상수 기반으로 계산하고, elite magic 스킨이면
|
||||
`FIGHTER.ELITE.ATTACK_EFFECT_SCALE_MULTIPLIER`를 추가 적용한다.
|
||||
- 처치 흐름은 로그와 사망 처리는 유지하면서 `COMBAT.KILL_REWARD_ENABLED`가
|
||||
`false`일 때 `applyKillReward()`를 실행하지 않는다.
|
||||
- 기준 커밋에 존재하는 Sprite 전투 경로인 `applyHit()`,
|
||||
`applyWorldEffectDamage()`, `fighterAttackSpeedMultiplier()`만 수정했다.
|
||||
|
||||
### `src/game/combat/worldEffects.js`
|
||||
|
||||
- 메테오/냉기 낙하 처리에서 effect type을 `applyWorldEffectDamage()`로 전달한다.
|
||||
- 밀집 구역 계산은 `stackCount`를 가중치로 사용해 elite가 대표하는 인원을
|
||||
월드 이펙트 표적 선정에 반영한다.
|
||||
|
||||
### `src/game/arena/ArenaScene.js`
|
||||
|
||||
- 사망 통계 누적 값을 `+ 1` 대신 `+ (fighter.stackCount || 1)`로 바꿨다.
|
||||
- elite가 죽으면 압축된 인원 전체가 오늘의 사망 통계에 기록되어야 한다.
|
||||
|
||||
### `src/game/arena/arenaSpectatorCamera.js`
|
||||
|
||||
- 관전 진입 임계값, 열세 팀 비교, 평균 포커스 좌표는 `stackCount`를 가중해
|
||||
대규모 압축 팀이 시작 즉시 최종 교전으로 오판되지 않게 한다.
|
||||
|
||||
### `src/ui/arenaScoreboard.js`
|
||||
|
||||
- 살아 있는 elite 객체 수와 normal 객체 수를 각각 계산해
|
||||
`E : <elite> | N : <normal>` 형식으로 표시한다.
|
||||
- 예를 들어 `Alice*4000`의 평균 구성은 `E : 32 | N : 800` 부근으로 표시되어
|
||||
실제 렌더링되는 군세 구성을 바로 확인할 수 있다.
|
||||
|
||||
### `src/game/fighter/fighterModel.js`, `src/game/fighter/fighterAdapter.js`
|
||||
|
||||
- WIP 당시에는 `stackCount`와 `isElite`를 모델 브리지에도 추가했다.
|
||||
- 이 두 모듈은 `30d7be4` 이후 대규모 전투 최적화 커밋에서 추가된 구조이므로,
|
||||
이번 롤백 기준에서는 elite 재구현의 선행 조건이 아니다.
|
||||
|
||||
## 의도적으로 포함하지 않은 변경
|
||||
|
||||
- `fighterLodWorker.js`, `aggregateCombatWorker.js` 제거 또는 대체
|
||||
- 모델 전투/LOD/worker 경로 전면 단순화
|
||||
- 렌더 캔버스 크기, 카메라 줌, minimap throttle, HUD 파일 분리
|
||||
- `agent.md` 전체를 elite 전용 구조로 축약하는 변경
|
||||
|
||||
위 항목은 이전 WIP에 섞여 있었지만, elite 캐릭터 기능의 최소 구현과 독립적인
|
||||
리팩터링이므로 포함하지 않았다.
|
||||
|
||||
## 구현 흐름
|
||||
|
||||
1. `src/constants.js`의 `FIGHTER.ELITE`에 elite 타입, 스탯, 공격력/속도, 랜덤 압축 설정을 묶고, 치명타 비율/배수와 메테오/냉기 elite 비율 상수를 추가한다.
|
||||
2. `matchSetup.js`에서 소규모 입력은 100명 단위로 압축하고, 대규모 입력은
|
||||
각 100명 블록을 확률적으로 elite 한 개체 또는 normal 100개체로 생성한다.
|
||||
3. `fighterFactory.js`의 기존 Sprite 생성 경로에서 elite 외형, HP, 공격력,
|
||||
사거리를 계산한다.
|
||||
4. `fighterSelection.js`에서 elite plan에는 근거리 스킨만 할당한다.
|
||||
5. `combat.js`와 `worldEffects.js`에서 normal/elite 피해 판정을 나눈다.
|
||||
6. `COMBAT.KILL_REWARD_ENABLED = false`로 처치 회복/성장 보너스를 차단한다.
|
||||
7. `ArenaScene.js`의 사망 통계는 `stackCount` 합산을 유지하고,
|
||||
`arenaScoreboard.js` 팀 카드는 생존 elite/normal 객체 수를 분리 표시한다.
|
||||
8. `agent.md`, `context/core.md`, `context/combat.md`, `context/fighter.md`,
|
||||
`context/match-ui.md`, `context/arena.md`, `todo.md`에 구현 규칙을 기록한다.
|
||||
|
||||
## 검증 체크리스트
|
||||
|
||||
- `Alice*1`은 이전과 동일하게 normal 1개체만 생성된다.
|
||||
- `Alice*99`는 normal 99개체로 생성된다.
|
||||
- 현재 임계값 `100`에서는 `Alice*100` 이상의 완전한 블록이 `ELITE_BLOCK_PROBABILITY`에 따라 elite 또는 normal 100개체가 되는지 확인한다.
|
||||
- `Alice*4000` 표본 반복에서 elite 수가 평균 32개, normal 수가 평균 800개에 수렴하고,
|
||||
모든 plan의 `stackCount` 합계가 매번 4,000인지 확인한다.
|
||||
- 팀 카드가 같은 구성에 대해 `E : <elite 수> | N : <normal 수>` 형식으로 표시되는지 확인한다.
|
||||
- elite HP/공격력/공격속도/사거리/외형이 상수와 `stackCount` 계산식에 맞는다.
|
||||
- normal 치명타가 기존 즉사가 아닌 설정한 고정 배수 피해로 동작하는지 의도와 다시 대조한다.
|
||||
- elite 치명타, 메테오, 냉기 피해가 각각 최대 HP 10%, 40%, 20% 기준으로 계산된다.
|
||||
- elite 사망 시 사망 통계가 `stackCount`만큼 증가한다.
|
||||
- 어떤 fighter도 처치로 회복하거나 커지거나 공격/이동 속도 보너스를 얻지 않는다.
|
||||
- elite에는 Slime의 `spawnMultiplier` 및 `splitOnDeath`가 적용되지 않고,
|
||||
normal fighter에는 기존 trait 동작이 유지되는지 확인한다.
|
||||
- elite plan에 선택된 스킨 타입은 항상 `FIGHTER.ELITE.TYPE`과 일치하고 normal plan은 기존 전체 스킨 풀을 사용하는지 확인한다.
|
||||
- 밀집 구역 월드 이펙트 표적 산정은 elite를 `stackCount`만큼 가중한다.
|
||||
- `npm run build`를 통과시키고 실제 전투에서 normal/elite 양쪽 흐름을 수동 확인한다.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
221
src/constants.js
221
src/constants.js
|
|
@ -2,6 +2,8 @@
|
|||
const GRID_SIZE = 50;
|
||||
const TILE_SIZE = 64;
|
||||
const ARENA_SIZE = GRID_SIZE * TILE_SIZE;
|
||||
const VIEWPORT_SIZE = 1600;
|
||||
const CAMERA_ZOOM_SCALE = VIEWPORT_SIZE / ARENA_SIZE;
|
||||
|
||||
export const ARENA = {
|
||||
GRID_SIZE,
|
||||
|
|
@ -9,9 +11,15 @@ export const ARENA = {
|
|||
SIZE: ARENA_SIZE,
|
||||
};
|
||||
|
||||
export const RENDER = {
|
||||
VIEWPORT_SIZE,
|
||||
CAMERA_ZOOM_SCALE,
|
||||
};
|
||||
|
||||
// 2. FIGHTER 도메인
|
||||
export const FIGHTER = {
|
||||
SCALE: 3,
|
||||
ATTACK_EFFECT_SCALE_MULTIPLIER: 1,
|
||||
DEPTH: 2,
|
||||
DEAD_DEPTH: 1,
|
||||
DEAD_DESPAWN_ALPHA: 0,
|
||||
|
|
@ -45,7 +53,7 @@ export const FIGHTER = {
|
|||
attackCooldown: 840,
|
||||
damageMin: 14,
|
||||
damageMax: 24,
|
||||
criticalChance: 0.2,
|
||||
criticalChance: 0.05,
|
||||
windupDelay: 260,
|
||||
},
|
||||
ranged: {
|
||||
|
|
@ -71,10 +79,30 @@ export const FIGHTER = {
|
|||
effectHitDelay: 160,
|
||||
},
|
||||
},
|
||||
ELITE: {
|
||||
TYPE: ["melee", "magic"],
|
||||
STACK_SIZE: 100,
|
||||
VISUAL_SCALE_MULTIPLIER: 5,
|
||||
ATTACK_EFFECT_SCALE_MULTIPLIER: 2,
|
||||
HP_BONUS_RATIO: 2,
|
||||
ATTACK_RANGE_MULTIPLIER: 1.5,
|
||||
ATTACK_DAMAGE_BONUS_MULTIPLIER: 1.1,
|
||||
ATTACK_DAMAGE_STACK_EXPONENT: 1,
|
||||
ATTACK_SPEED_BONUS_MULTIPLIER: 1,
|
||||
ATTACK_SPEED_STACK_EXPONENT: 0.4,
|
||||
MOVE_SPEED_BONUS_MULTIPLIER: 1,
|
||||
MOVE_SPEED_STACK_EXPONENT: 0,
|
||||
RANDOMIZED_COMPRESSION: {
|
||||
MIN_TEAM_SIZE: 100,
|
||||
ELITE_BLOCK_PROBABILITY: 0.6,
|
||||
LARGE_BATTLE_ELITE_BLOCK_PROBABILITY: 0.8,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const PERFORMANCE = {
|
||||
LARGE_BATTLE_FIGHTER_THRESHOLD: 3000,
|
||||
LARGE_BATTLE_FIGHTER_THRESHOLD: 2000,
|
||||
LARGE_BATTLE_RENDERED_FIGHTER_LIMIT: 2000,
|
||||
LARGE_BATTLE_DEAD_DESPAWN_DELAY_MS: 0,
|
||||
TARGET_GRID_CELL_SIZE: TILE_SIZE * 4,
|
||||
FIGHTER_HUD_POOL_SIZE: 96,
|
||||
|
|
@ -94,9 +122,9 @@ export const SPAWN = {
|
|||
STARTING_ZONES: "starting-zones",
|
||||
},
|
||||
// Caps participant-assigned slots; traits such as slime spawning may add fighters.
|
||||
MAX_FIGHTER_COUNT: 8000,
|
||||
FIGHTERS_PER_STARTING_ZONE: 100,
|
||||
STARTING_ZONE_RADIUS: 2,
|
||||
MAX_FIGHTER_COUNT: 20000,
|
||||
FIGHTERS_PER_STARTING_ZONE: 500,
|
||||
STARTING_ZONE_RADIUS: 3,
|
||||
STARTING_ZONE_FILL_ALPHA: 0.07,
|
||||
STARTING_ZONE_BORDER_ALPHA: 0.14,
|
||||
STARTING_ZONE_VISIBLE_DURATION_MS: 2000,
|
||||
|
|
@ -106,18 +134,31 @@ export const SPAWN = {
|
|||
|
||||
// 4. COMBAT 도메인
|
||||
export const COMBAT = {
|
||||
KILL_REWARD_ENABLED: false,
|
||||
KILL_HEALTH_RECOVERY_RATIO: 0.3,
|
||||
KILL_HEAL_EFFECT_FRAMES: 4,
|
||||
KILL_HEAL_EFFECT_FRAME_RATE: 12,
|
||||
KILL_GROWTH_MULTIPLIER: 1.25,
|
||||
KILL_GROWTH_MAX_MULTIPLIER: 5,
|
||||
KILL_GROWTH_TWEEN_DURATION: 180,
|
||||
CRITICAL_DAMAGE_PERCENT: 0.1,
|
||||
NORMAL_CRITICAL_DAMAGE_MULTIPLIER: 2,
|
||||
ELITE_KILL_SPLASH_ENABLED: true,
|
||||
ELITE_KILL_SPLASH_DAMAGE_PERCENT: 0.1,
|
||||
ELITE_KILL_SPLASH_RADIUS: TILE_SIZE * 2,
|
||||
ELITE_KILL_SPLASH_CHAIN_ENABLED: false,
|
||||
// 최종교전 슬로우모션 설정
|
||||
FINAL_SLOW_MOTION_ENABLED: false,
|
||||
FINAL_SLOW_MOTION_ENTER_DURATION: 14000,
|
||||
FINAL_SLOW_MOTION_HOLD_DURATION: 14000,
|
||||
FINAL_SLOW_MOTION_EXIT_DURATION: 14000,
|
||||
FINAL_SLOW_MOTION_SCALE: 0.28,
|
||||
// 전투원 간 공간 분리 (spatial grid 기반 군중 밀착 방지)
|
||||
FIGHTER_SEPARATION_ENABLED: true,
|
||||
// 전투원 중심 간 최소 이격 거리(px). HITBOX_WIDTH=22, SCALE=3이므로 약 1.5배
|
||||
FIGHTER_SEPARATION_DISTANCE: 42 * 3,
|
||||
// 밀착 시 밀어내는 힘. moveSpeed(148~163)보다 낮아야 자연스러움
|
||||
FIGHTER_SEPARATION_FORCE: 148 / 2,
|
||||
};
|
||||
|
||||
// 5. PROJECTILE 도메인
|
||||
|
|
@ -130,20 +171,20 @@ export const PROJECTILE = {
|
|||
};
|
||||
|
||||
// 6. WORLD_EFFECT 도메인
|
||||
export const WORLD_EFFECT = {
|
||||
const WORLD_EFFECT_CONFIG = {
|
||||
// Delay from match start until the first barrage.
|
||||
INTERVAL: 8000,
|
||||
// Delay between barrages after the first one has fired.
|
||||
REPEAT_INTERVAL: 8000,
|
||||
REPEAT_INTERVAL: 20000,
|
||||
AREA_TILES: 40,
|
||||
// How long the large dense-area warning marker remains visible.
|
||||
WARNING_DURATION_MS: 2000,
|
||||
IMPACT_AREA_TILES: 10,
|
||||
IMPACT_COUNT_MIN: 15,
|
||||
IMPACT_COUNT_MAX: 25,
|
||||
IMPACT_COUNT_MIN: 5,
|
||||
IMPACT_COUNT_MAX: 10,
|
||||
IMPACT_STAGGER_MS: 140,
|
||||
IMPACT_VISUAL_SCALE: 10,
|
||||
SIZE_SCALE_VARIANCE: 0,
|
||||
IMPACT_VISUAL_SCALE: 15,
|
||||
SIZE_SCALE_VARIANCE: 1,
|
||||
FRAMES: 7,
|
||||
FRAME_RATE: 14,
|
||||
FALL_DURATION: 920,
|
||||
|
|
@ -151,7 +192,9 @@ export const WORLD_EFFECT = {
|
|||
METEOR_SHAKE_DURATION_MS: 150,
|
||||
METEOR_SHAKE_INTENSITY: 0.004,
|
||||
METEOR_DAMAGE: 90,
|
||||
METEOR_DAMAGE_PERCENT: 0.4,
|
||||
FROST_DAMAGE: 45,
|
||||
FROST_DAMAGE_PERCENT: 0.2,
|
||||
FROST_STUN_DURATION: 2000,
|
||||
FROST_STUN_TINT: 0x82e9ff,
|
||||
FROST_DURATION: 2000,
|
||||
|
|
@ -164,33 +207,161 @@ export const WORLD_EFFECT = {
|
|||
},
|
||||
};
|
||||
|
||||
export const SPECIAL_EFFECT = {
|
||||
ENABLED: true,
|
||||
FRAME_RATE_MULTIPLIER: 1.5,
|
||||
// A special effect is picked once per battle, no earlier than the first world-effect delay.
|
||||
TRIGGER_DELAY_MIN_MS: 10000,
|
||||
TRIGGER_DELAY_MAX_MS: 11000,
|
||||
RETRY_DELAY_MS: 2000,
|
||||
CASTER: {
|
||||
HURT_FRAME_INDEX: 1,
|
||||
HURT_HOLD_MS: 1800,
|
||||
ATTACK_LAUNCH_DELAY_MS: 360,
|
||||
ATTACK_TIME_SCALE: 0.9,
|
||||
POST_CAST_COOLDOWN_MS: 1200,
|
||||
BALANCE_NON_MAGIC_TYPES: false,
|
||||
INVULNERABLE_MS: 4500,
|
||||
},
|
||||
CASTER_SPARKLE: {
|
||||
ENABLED: true,
|
||||
key: "special-caster-eye-sparkle",
|
||||
path: "assets/effects/special/effect.png",
|
||||
frames: 12,
|
||||
frameWidth: 100,
|
||||
frameHeight: 100,
|
||||
frameRate: 12,
|
||||
frameSequence: [2, 3, 4],
|
||||
repeat: -1,
|
||||
scaleMultiplier: 1,
|
||||
anchorX: 50,
|
||||
anchorY: 40,
|
||||
effectAnchorX: 54,
|
||||
effectAnchorY: 50,
|
||||
depthOffset: 0.25,
|
||||
alpha: 1,
|
||||
},
|
||||
CAMERA: {
|
||||
ZOOM: 3 * CAMERA_ZOOM_SCALE,
|
||||
CENTER_ON_CASTER_AT_START: true,
|
||||
ZOOM_IN_MS: 720,
|
||||
HOLD_MS: 1100,
|
||||
ZOOM_OUT_MS: 1300,
|
||||
LERP: 0.045,
|
||||
PROJECTILE_VIEW_ZOOM: 1 * CAMERA_ZOOM_SCALE,
|
||||
PROJECTILE_ZOOM_OUT_MS: 300,
|
||||
},
|
||||
FOCUS_LAYER: {
|
||||
ENABLED: true,
|
||||
BLUR_DEPTH: 5.2,
|
||||
DIM_DEPTH: 5.3,
|
||||
CASTER_DEPTH: 8,
|
||||
BLUR_ALPHA: 0.78,
|
||||
DIM_ALPHA: 0.34,
|
||||
BLUR_QUALITY: 1,
|
||||
BLUR_OFFSET_X: 3,
|
||||
BLUR_OFFSET_Y: 3,
|
||||
BLUR_STRENGTH: 1.35,
|
||||
BLUR_STEPS: 6,
|
||||
BLUR_MAX_FIGHTERS: 800,
|
||||
FADE_IN_MS: 160,
|
||||
FADE_OUT_MS: 220,
|
||||
},
|
||||
MELEE: {
|
||||
SCALE: 15,
|
||||
FRAME_WIDTH: 100,
|
||||
FRAME_HEIGHT: 100,
|
||||
FRAME_RATE: 12,
|
||||
REPEAT: -1,
|
||||
DEPTH: 6,
|
||||
SPAWN_DISTANCE: TILE_SIZE * 1.2,
|
||||
ASSETS: [
|
||||
{
|
||||
key: "special-melee-effect-1",
|
||||
path: "assets/effects/special/melee/melee_Effect_1.png",
|
||||
frames: 11,
|
||||
// frameSequence: [10, 9, 8],
|
||||
},
|
||||
{
|
||||
key: "special-melee-effect-2",
|
||||
path: "assets/effects/special/melee/melee_Effect_2.png",
|
||||
frames: 8,
|
||||
// frameSequence: [2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5],
|
||||
},
|
||||
{
|
||||
key: "special-melee-effect-3",
|
||||
path: "assets/effects/special/melee/melee_Effect_3.png",
|
||||
frames: 11,
|
||||
// frameSequence: [4, 5, 6, 7, 8, 8, 8, 8, 8, 9, 10],
|
||||
},
|
||||
],
|
||||
},
|
||||
RANGE: {
|
||||
key: "special-projectile-effect-1",
|
||||
path: "assets/effects/special/projectile/projectile_Effect_1.png",
|
||||
frames: 12,
|
||||
frameWidth: 100,
|
||||
frameHeight: 100,
|
||||
frameRate: 20,
|
||||
repeat: -1,
|
||||
scale: 16,
|
||||
depth: 7,
|
||||
spawnDistance: TILE_SIZE * 2.8,
|
||||
},
|
||||
PROJECTILE: {
|
||||
speed: 1150,
|
||||
travelDurationMs: 620,
|
||||
movementEase: "Cubic.In",
|
||||
startHoldMs: 380,
|
||||
targetAreaTiles: 8,
|
||||
travelTiles: GRID_SIZE * 1.6,
|
||||
arenaEdgePadding: TILE_SIZE * 2,
|
||||
hitRadius: TILE_SIZE * 2.2,
|
||||
maxLifetimeMs: 5200,
|
||||
TRAIL: {
|
||||
ENABLED: true,
|
||||
INTERVAL_MS: 36,
|
||||
LIFETIME_MS: 280,
|
||||
ALPHA: 0.34,
|
||||
SCALE_MULTIPLIER: 0.96,
|
||||
DEPTH_OFFSET: -0.1,
|
||||
FADE_EASE: "Cubic.Out",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const WORLD_EFFECT = {
|
||||
...WORLD_EFFECT_CONFIG,
|
||||
SPECIAL: SPECIAL_EFFECT,
|
||||
};
|
||||
|
||||
// 7. CAMERA 도메인
|
||||
export const CAMERA = {
|
||||
MIN_ZOOM: 1,
|
||||
MAX_ZOOM: 3,
|
||||
ZOOM_STEP: 0.1,
|
||||
MIN_ZOOM: 1 * CAMERA_ZOOM_SCALE,
|
||||
MAX_ZOOM: 3 * CAMERA_ZOOM_SCALE,
|
||||
ZOOM_STEP: 0.1 * CAMERA_ZOOM_SCALE,
|
||||
// 자동 관전 진입 전 화염/냉기 메테오 낙하 위치를 임시로 확대 추적합니다.
|
||||
METEOR_FOCUS_ENABLED: false,
|
||||
METEOR_FOCUS_ZOOM: 2,
|
||||
SPECTATOR_LERP: 0.1,
|
||||
METEOR_FOCUS_ZOOM: 2 * CAMERA_ZOOM_SCALE,
|
||||
SPECTATOR_LERP: 0.01,
|
||||
// 메테오 착탄 후 카메라를 해당 위치에 유지하는 시간(ms)입니다.
|
||||
METEOR_FOCUS_HOLD_DURATION: 1200,
|
||||
SPECTATOR_FINAL_FIGHTER_THRESHOLD: 5,
|
||||
SPECTATOR_FINAL_FIGHT_ZOOM: 3,
|
||||
SPECTATOR_FINAL_FIGHT_ZOOM: 3 * CAMERA_ZOOM_SCALE,
|
||||
SPECTATOR_FINAL_TEAM_COUNT: 2,
|
||||
SPECTATOR_FINAL_TEAM_TOTAL_THRESHOLD: 8,
|
||||
SPECTATOR_RANDOM_FOCUS_INTERVAL: 10000,
|
||||
SPECTATOR_LATE_FIGHTER_THRESHOLD: 80,
|
||||
SPECTATOR_LATE_FIGHT_ZOOM: 2,
|
||||
SELECTED_FIGHTER_ZOOM: 2,
|
||||
SPECTATOR_LATE_FIGHTER_THRESHOLD: 500,
|
||||
SPECTATOR_LATE_FIGHT_ZOOM: 2 * CAMERA_ZOOM_SCALE,
|
||||
SELECTED_FIGHTER_ZOOM: 2 * CAMERA_ZOOM_SCALE,
|
||||
};
|
||||
|
||||
// 8. UI 도메인
|
||||
export const UI = {
|
||||
MINIMAP_ALPHA: 0.8,
|
||||
MINIMAP_MARGIN: Math.round(ARENA_SIZE * 0.016),
|
||||
MINIMAP_VIEWPORT_SIZE: Math.round(ARENA_SIZE * 0.22),
|
||||
MINIMAP_VIEW_FRAME_STROKE: 10,
|
||||
MINIMAP_MARGIN: Math.round(VIEWPORT_SIZE * 0.016),
|
||||
MINIMAP_VIEWPORT_SIZE: Math.round(VIEWPORT_SIZE * 0.22),
|
||||
MINIMAP_VIEW_FRAME_STROKE: Math.max(4, Math.round(VIEWPORT_SIZE * 0.003125)),
|
||||
SELECTED_FIGHTER_OUTLINE_GAP: 1,
|
||||
SELECTED_FIGHTER_OUTLINE_WIDTH: 1,
|
||||
SELECTED_FIGHTER_OUTLINE_RED: 255,
|
||||
|
|
@ -201,6 +372,10 @@ export const UI = {
|
|||
BATTLE_NOTICE_DELAY_MS: 5000,
|
||||
BATTLE_NOTICE_VISIBLE_MS: 2000,
|
||||
BATTLE_NOTICE_INTERVAL_MS: 10000,
|
||||
BATTLE_NOTICE_ROLL_GAP_PX: 48,
|
||||
BATTLE_NOTICE_ROLL_SPEED_PX_PER_SECOND: 58,
|
||||
BATTLE_NOTICE_ROLL_MIN_DURATION_MS: 7000,
|
||||
BATTLE_NOTICE_ROLL_MAX_DURATION_MS: 18000,
|
||||
};
|
||||
|
||||
// 9. TEAM 도메인
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {
|
|||
CAMERA,
|
||||
COMBAT,
|
||||
PERFORMANCE,
|
||||
SPECIAL_EFFECT,
|
||||
SPAWN,
|
||||
UI,
|
||||
} from "../../constants.js";
|
||||
|
|
@ -16,6 +17,12 @@ import {
|
|||
startWorldEffects,
|
||||
updateWorldEffectModifiers,
|
||||
} from "../combat/worldEffects.js";
|
||||
import {
|
||||
clearSpecialEffects,
|
||||
createSpecialEffectAnimations,
|
||||
preloadSpecialEffectAssets,
|
||||
startSpecialEffects,
|
||||
} from "../combat/specialEffects.js";
|
||||
import { createFighterAnimations, preloadFighterSheets } from "../fighter/fighterAssets.js";
|
||||
import {
|
||||
createFighter,
|
||||
|
|
@ -23,7 +30,7 @@ import {
|
|||
syncFighterHud,
|
||||
} from "../fighter/fighterFactory.js";
|
||||
import { fighterManifest } from "../fighter/fighterManifest.js";
|
||||
import { pickFighters } from "../fighter/fighterSelection.js";
|
||||
import { pickFightersForSetups } from "../fighter/fighterSelection.js";
|
||||
import {
|
||||
createMatchSetup,
|
||||
FighterCountLimitError,
|
||||
|
|
@ -114,11 +121,19 @@ export class ArenaScene extends Phaser.Scene {
|
|||
this.minimapHudCamera = null;
|
||||
this.worldEffectTimer = null;
|
||||
this.worldEffectZones = new Set();
|
||||
this.specialEffectTimer = null;
|
||||
this.specialEffectStartedAt = null;
|
||||
this.specialEffectUsed = false;
|
||||
this.specialEffectCastState = null;
|
||||
this.specialEffectFocusState = null;
|
||||
this.specialEffectFocusTween = null;
|
||||
this.specialEffectFocusClearTimer = null;
|
||||
}
|
||||
|
||||
preload() {
|
||||
preloadFighterSheets(this, fighterManifest);
|
||||
preloadWorldEffectAssets(this);
|
||||
preloadSpecialEffectAssets(this);
|
||||
}
|
||||
|
||||
create() {
|
||||
|
|
@ -129,6 +144,7 @@ export class ArenaScene extends Phaser.Scene {
|
|||
this.startingZoneGraphics = this.add.graphics().setDepth(0.5);
|
||||
createFighterAnimations(this, fighterManifest);
|
||||
createWorldEffectAnimations(this);
|
||||
createSpecialEffectAnimations(this);
|
||||
|
||||
// 미니맵 카메라 설정
|
||||
this.minimapGraphics = this.add.graphics().setDepth(10);
|
||||
|
|
@ -202,7 +218,7 @@ export class ArenaScene extends Phaser.Scene {
|
|||
throw error;
|
||||
}
|
||||
|
||||
const matchSkins = pickFighters(fighterManifest, matchSetup.fighters.length);
|
||||
const matchSkins = pickFightersForSetups(fighterManifest, matchSetup.fighters);
|
||||
const fighterPlans = createFighterPlans(matchSetup.fighters, matchSkins, {
|
||||
expandSpawnMultipliers: !silent,
|
||||
});
|
||||
|
|
@ -218,6 +234,7 @@ export class ArenaScene extends Phaser.Scene {
|
|||
this.setPaused(false, { silent: true });
|
||||
this.clearFinalCombatEffects();
|
||||
clearWorldEffects(this);
|
||||
clearSpecialEffects(this);
|
||||
this.presentationMode = silent;
|
||||
this.resetMatchDeathStats({ silent });
|
||||
this.observedCombat = [];
|
||||
|
|
@ -233,6 +250,7 @@ export class ArenaScene extends Phaser.Scene {
|
|||
this.showStartingZones(matchSetup.startingZones);
|
||||
this.fighters = fighterPlans.map((fighterPlan) => createFighter(this, fighterPlan));
|
||||
startWorldEffects(this);
|
||||
startSpecialEffects(this);
|
||||
|
||||
if (!silent) {
|
||||
trackMatchStart();
|
||||
|
|
@ -357,7 +375,8 @@ export class ArenaScene extends Phaser.Scene {
|
|||
}
|
||||
|
||||
const species = normalizeSpecies(fighter?.skin?.species);
|
||||
this.battleDeathCounts[species] = (this.battleDeathCounts[species] ?? 0) + 1;
|
||||
const deathCount = Math.max(1, Math.round(Number(fighter?.stackCount) || 1));
|
||||
this.battleDeathCounts[species] = (this.battleDeathCounts[species] ?? 0) + deathCount;
|
||||
}
|
||||
|
||||
showBattleDeathNotice() {
|
||||
|
|
@ -452,6 +471,11 @@ update(time) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.followSpecialEffectCameraFocus()) {
|
||||
this.updateMinimap();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.focusSelectedFighter()) {
|
||||
this.updateMinimap();
|
||||
return;
|
||||
|
|
@ -532,7 +556,7 @@ update(time) {
|
|||
return fighterCameraPoint(this.finalFocusTarget);
|
||||
}
|
||||
|
||||
moveCameraToward(target) {
|
||||
moveCameraToward(target, lerp = CAMERA.SPECTATOR_LERP) {
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -540,8 +564,197 @@ update(time) {
|
|||
const targetX = Math.round(target.x);
|
||||
const targetY = Math.round(target.y);
|
||||
|
||||
this.cameras.main.scrollX += (targetX - this.cameras.main.midPoint.x) * CAMERA.SPECTATOR_LERP;
|
||||
this.cameras.main.scrollY += (targetY - this.cameras.main.midPoint.y) * CAMERA.SPECTATOR_LERP;
|
||||
this.cameras.main.scrollX += (targetX - this.cameras.main.midPoint.x) * lerp;
|
||||
this.cameras.main.scrollY += (targetY - this.cameras.main.midPoint.y) * lerp;
|
||||
}
|
||||
|
||||
beginSpecialEffectCameraFocus(target) {
|
||||
if (this.presentationMode || this.matchOver) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.clearMeteorCameraFocus(null, { restoreCamera: false, immediate: true });
|
||||
this.specialEffectFocusClearTimer?.remove(false);
|
||||
this.specialEffectFocusClearTimer = null;
|
||||
this.specialEffectFocusTween?.remove();
|
||||
this.specialEffectFocusTween = null;
|
||||
|
||||
const previousFocus = this.specialEffectFocusState;
|
||||
const focusState = {
|
||||
restoreCenter: previousFocus?.restoreCenter ?? {
|
||||
x: this.cameras.main.midPoint.x,
|
||||
y: this.cameras.main.midPoint.y,
|
||||
},
|
||||
restoreZoom: previousFocus?.restoreZoom ?? this.cameras.main.zoom,
|
||||
returning: false,
|
||||
snapToTarget: Boolean(SPECIAL_EFFECT.CAMERA.CENTER_ON_CASTER_AT_START),
|
||||
target,
|
||||
zoom: this.cameras.main.zoom,
|
||||
};
|
||||
|
||||
this.specialEffectFocusState = focusState;
|
||||
|
||||
if (SPECIAL_EFFECT.CAMERA.CENTER_ON_CASTER_AT_START) {
|
||||
const focusTarget = this.resolveSpecialEffectCameraTarget(focusState);
|
||||
|
||||
if (focusTarget) {
|
||||
this.cameras.main.centerOn(
|
||||
Math.round(focusTarget.x),
|
||||
Math.round(focusTarget.y),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.specialEffectFocusTween = this.tweens.add({
|
||||
targets: focusState,
|
||||
zoom: SPECIAL_EFFECT.CAMERA.ZOOM,
|
||||
duration: SPECIAL_EFFECT.CAMERA.ZOOM_IN_MS,
|
||||
ease: "Cubic.Out",
|
||||
onComplete: () => {
|
||||
if (this.specialEffectFocusState === focusState) {
|
||||
this.specialEffectFocusTween = null;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
zoomOutSpecialEffectCameraFocus() {
|
||||
if (!this.specialEffectFocusState || this.specialEffectFocusState.returning) {
|
||||
return;
|
||||
}
|
||||
|
||||
const focusState = this.specialEffectFocusState;
|
||||
|
||||
this.specialEffectFocusClearTimer?.remove(false);
|
||||
this.specialEffectFocusClearTimer = null;
|
||||
this.specialEffectFocusTween?.remove();
|
||||
this.specialEffectFocusTween = null;
|
||||
|
||||
focusState.target = {
|
||||
x: this.cameras.main.midPoint.x,
|
||||
y: this.cameras.main.midPoint.y,
|
||||
};
|
||||
this.specialEffectFocusState.snapToTarget = false;
|
||||
this.specialEffectFocusTween = this.tweens.add({
|
||||
targets: focusState,
|
||||
zoom: SPECIAL_EFFECT.CAMERA.PROJECTILE_VIEW_ZOOM,
|
||||
duration: SPECIAL_EFFECT.CAMERA.PROJECTILE_ZOOM_OUT_MS,
|
||||
ease: "Cubic.Out",
|
||||
onComplete: () => {
|
||||
if (this.specialEffectFocusState === focusState) {
|
||||
this.specialEffectFocusTween = null;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
followSpecialEffectCameraFocus() {
|
||||
const focusState = this.specialEffectFocusState;
|
||||
|
||||
if (!focusState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.setMainCameraZoom(focusState.zoom ?? SPECIAL_EFFECT.CAMERA.ZOOM);
|
||||
const target = this.resolveSpecialEffectCameraTarget(focusState);
|
||||
|
||||
if (focusState.snapToTarget) {
|
||||
this.cameras.main.centerOn(Math.round(target.x), Math.round(target.y));
|
||||
} else {
|
||||
this.moveCameraToward(target, SPECIAL_EFFECT.CAMERA.LERP);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
resolveSpecialEffectCameraTarget(focusState) {
|
||||
const target = focusState.target;
|
||||
let focusTarget = focusState.restoreCenter;
|
||||
|
||||
if (target?.body?.center) {
|
||||
focusTarget = target.body.center;
|
||||
} else if (Number.isFinite(target?.x) && Number.isFinite(target?.y)) {
|
||||
focusTarget = target;
|
||||
}
|
||||
|
||||
return this.clampSpecialEffectCameraTarget(focusTarget);
|
||||
}
|
||||
|
||||
clampSpecialEffectCameraTarget(target) {
|
||||
if (!target) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const camera = this.cameras.main;
|
||||
const zoom = Math.max(CAMERA.MIN_ZOOM, Number(camera.zoom) || CAMERA.MIN_ZOOM);
|
||||
const viewWidth = (Number(camera.width) || ARENA.SIZE) / zoom;
|
||||
const viewHeight = (Number(camera.height) || ARENA.SIZE) / zoom;
|
||||
const halfWidth = Math.min(ARENA.SIZE / 2, viewWidth / 2);
|
||||
const halfHeight = Math.min(ARENA.SIZE / 2, viewHeight / 2);
|
||||
|
||||
return {
|
||||
x: Phaser.Math.Clamp(target.x, halfWidth, ARENA.SIZE - halfWidth),
|
||||
y: Phaser.Math.Clamp(target.y, halfHeight, ARENA.SIZE - halfHeight),
|
||||
};
|
||||
}
|
||||
|
||||
clearSpecialEffectCameraFocus({ restoreCamera = true, immediate = false } = {}) {
|
||||
if (!this.specialEffectFocusState) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.specialEffectFocusClearTimer?.remove(false);
|
||||
this.specialEffectFocusClearTimer = null;
|
||||
|
||||
if (immediate) {
|
||||
this.performClearSpecialEffectCameraFocus(restoreCamera, true);
|
||||
return;
|
||||
}
|
||||
|
||||
this.specialEffectFocusClearTimer = this.time.delayedCall(
|
||||
SPECIAL_EFFECT.CAMERA.HOLD_MS,
|
||||
() => this.performClearSpecialEffectCameraFocus(restoreCamera),
|
||||
);
|
||||
}
|
||||
|
||||
performClearSpecialEffectCameraFocus(restoreCamera, immediate = false) {
|
||||
const focusState = this.specialEffectFocusState;
|
||||
|
||||
this.specialEffectFocusClearTimer?.remove(false);
|
||||
this.specialEffectFocusClearTimer = null;
|
||||
this.specialEffectFocusTween?.remove();
|
||||
this.specialEffectFocusTween = null;
|
||||
|
||||
if (!focusState) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!restoreCamera || immediate || this.presentationMode || this.matchOver) {
|
||||
this.specialEffectFocusState = null;
|
||||
return;
|
||||
}
|
||||
|
||||
focusState.returning = true;
|
||||
focusState.target = focusState.restoreCenter;
|
||||
this.specialEffectFocusTween = this.tweens.add({
|
||||
targets: focusState,
|
||||
zoom: focusState.restoreZoom,
|
||||
duration: SPECIAL_EFFECT.CAMERA.ZOOM_OUT_MS,
|
||||
ease: "Cubic.InOut",
|
||||
onComplete: () => {
|
||||
if (this.specialEffectFocusState !== focusState) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.specialEffectFocusState = null;
|
||||
this.specialEffectFocusTween = null;
|
||||
this.setMainCameraZoom(focusState.restoreZoom);
|
||||
this.cameras.main.centerOn(
|
||||
Math.round(focusState.restoreCenter.x),
|
||||
Math.round(focusState.restoreCenter.y),
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
beginMeteorCameraFocus(zone) {
|
||||
|
|
@ -899,6 +1112,14 @@ update(time) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (isLivingFighter(this.selectedFighter) && this.selectedFighter.team.id === teamId) {
|
||||
this.clearSelectedFighter();
|
||||
this.setMainCameraZoom(CAMERA.MIN_ZOOM);
|
||||
this.setStatus(matchStatusText(this.teams));
|
||||
this.updateScoreboard();
|
||||
return;
|
||||
}
|
||||
|
||||
const candidates = this.fighters.filter(
|
||||
(fighter) => isLivingFighter(fighter) && fighter.team.id === teamId,
|
||||
);
|
||||
|
|
@ -1195,6 +1416,7 @@ update(time) {
|
|||
this.matchOver = true;
|
||||
this.clearFinalCombatEffects();
|
||||
clearWorldEffects(this);
|
||||
clearSpecialEffects(this);
|
||||
clearCombatObjects(this);
|
||||
this.fighters.forEach((fighter) => {
|
||||
if (fighter.body) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ import {
|
|||
} from "../../constants.js";
|
||||
|
||||
export function getSpectatorState(livingFighters) {
|
||||
const livingFighterCount = livingFighters.length;
|
||||
const livingFighterCount = livingFighters.reduce(
|
||||
(count, fighter) => count + representedFighterCount(fighter),
|
||||
0,
|
||||
);
|
||||
const teamSummaries = getLivingTeamSummaries(livingFighters);
|
||||
|
||||
if (livingFighterCount < CAMERA.SPECTATOR_FINAL_FIGHTER_THRESHOLD) {
|
||||
|
|
@ -48,7 +51,7 @@ export function getLivingTeamSummaries(livingFighters) {
|
|||
teamId,
|
||||
};
|
||||
|
||||
summary.count += 1;
|
||||
summary.count += representedFighterCount(fighter);
|
||||
summaries.set(teamId, summary);
|
||||
});
|
||||
|
||||
|
|
@ -70,22 +73,28 @@ export function averageFighterPosition(fighters) {
|
|||
return null;
|
||||
}
|
||||
|
||||
const total = fighters.reduce(
|
||||
const weighted = fighters.reduce(
|
||||
(position, fighter) => {
|
||||
const point = fighterCameraPoint(fighter);
|
||||
position.x += point.x;
|
||||
position.y += point.y;
|
||||
const weight = representedFighterCount(fighter);
|
||||
position.count += weight;
|
||||
position.x += point.x * weight;
|
||||
position.y += point.y * weight;
|
||||
return position;
|
||||
},
|
||||
{ x: 0, y: 0 },
|
||||
{ count: 0, x: 0, y: 0 },
|
||||
);
|
||||
|
||||
return {
|
||||
x: total.x / fighters.length,
|
||||
y: total.y / fighters.length,
|
||||
x: weighted.x / weighted.count,
|
||||
y: weighted.y / weighted.count,
|
||||
};
|
||||
}
|
||||
|
||||
function representedFighterCount(fighter) {
|
||||
return Math.max(1, Math.round(Number(fighter?.stackCount) || 1));
|
||||
}
|
||||
|
||||
export function fighterCameraPoint(fighter) {
|
||||
const target = fighter?.body?.center ?? fighter;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
COMBAT,
|
||||
PERFORMANCE,
|
||||
PROJECTILE,
|
||||
WORLD_EFFECT,
|
||||
} from "../../constants.js";
|
||||
import {
|
||||
getAttackSpeedMultiplier,
|
||||
|
|
@ -18,7 +19,11 @@ import {
|
|||
healEffectAnimationKey,
|
||||
healEffectKey,
|
||||
} from "../fighter/fighterAssets.js";
|
||||
import { getFighterStats } from "../fighter/fighterStats.js";
|
||||
import {
|
||||
FIGHTER_TYPES,
|
||||
getFighterStats,
|
||||
getFighterType,
|
||||
} from "../fighter/fighterStats.js";
|
||||
|
||||
const TARGET_SCAN_INTERVAL_MS = 180;
|
||||
const TARGET_SCAN_JITTER_MS = 90;
|
||||
|
|
@ -28,7 +33,17 @@ export function prepareCombatFrame(scene) {
|
|||
}
|
||||
|
||||
export function updateFighter(scene, fighter, time, onWinner) {
|
||||
if (!fighter.active || fighter.isDead || fighter.isFrostStunned || fighter.isLocked) {
|
||||
if (
|
||||
scene.specialEffectPreparationPaused
|
||||
|| !fighter.active
|
||||
|| fighter.isDead
|
||||
|| fighter.isFrostStunned
|
||||
) {
|
||||
fighter.body?.setVelocity(0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fighter.isLocked) {
|
||||
fighter.body?.setVelocity(0, 0);
|
||||
return;
|
||||
}
|
||||
|
|
@ -36,7 +51,7 @@ export function updateFighter(scene, fighter, time, onWinner) {
|
|||
const enemy = resolveTargetEnemy(scene, fighter, time);
|
||||
|
||||
if (!enemy) {
|
||||
fighter.body?.setVelocity(0, 0);
|
||||
applySeparationVelocity(scene, fighter);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -52,11 +67,12 @@ export function updateFighter(scene, fighter, time, onWinner) {
|
|||
enemy,
|
||||
combatStatsFor(fighter).moveSpeed * fighterMovementSpeedMultiplier(fighter),
|
||||
);
|
||||
applySeparationVelocity(scene, fighter, { blend: true });
|
||||
playIfNeeded(fighter, "walk");
|
||||
return;
|
||||
}
|
||||
|
||||
fighter.body.setVelocity(0, 0);
|
||||
applySeparationVelocity(scene, fighter);
|
||||
|
||||
if (time >= fighter.nextAttackAt) {
|
||||
beginAttack(scene, fighter, enemy, time, onWinner);
|
||||
|
|
@ -66,6 +82,68 @@ export function updateFighter(scene, fighter, time, onWinner) {
|
|||
playIfNeeded(fighter, "idle");
|
||||
}
|
||||
|
||||
function applySeparationVelocity(scene, fighter, { blend = false } = {}) {
|
||||
if (!COMBAT.FIGHTER_SEPARATION_ENABLED) {
|
||||
if (!blend) {
|
||||
fighter.body?.setVelocity(0, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const targetIndex = scene.combatTargetIndex;
|
||||
|
||||
if (!targetIndex) {
|
||||
fighter.body?.setVelocity(0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
const cellX = clampCell(fighter.x, targetIndex.cellSize, targetIndex.maxCellX);
|
||||
const cellY = clampCell(fighter.y, targetIndex.cellSize, targetIndex.maxCellY);
|
||||
const sepDist = COMBAT.FIGHTER_SEPARATION_DISTANCE;
|
||||
const sepDistSq = sepDist * sepDist;
|
||||
const maxForce = COMBAT.FIGHTER_SEPARATION_FORCE;
|
||||
let forceX = 0;
|
||||
let forceY = 0;
|
||||
|
||||
for (let dx = -1; dx <= 1; dx += 1) {
|
||||
for (let dy = -1; dy <= 1; dy += 1) {
|
||||
const cell = targetIndex.cells.get(targetCellKey(cellX + dx, cellY + dy));
|
||||
|
||||
if (!cell) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cell.forEach((candidate) => {
|
||||
if (candidate === fighter || !candidate.active || candidate.isDead) {
|
||||
return;
|
||||
}
|
||||
|
||||
const deltaX = fighter.x - candidate.x;
|
||||
const deltaY = fighter.y - candidate.y;
|
||||
const distSq = deltaX * deltaX + deltaY * deltaY;
|
||||
|
||||
if (distSq >= sepDistSq || distSq < 0.001) {
|
||||
return;
|
||||
}
|
||||
|
||||
const dist = Math.sqrt(distSq);
|
||||
const strength = (1 - dist / sepDist) * maxForce;
|
||||
|
||||
forceX += (deltaX / dist) * strength;
|
||||
forceY += (deltaY / dist) * strength;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (blend) {
|
||||
fighter.body.velocity.x += forceX;
|
||||
fighter.body.velocity.y += forceY;
|
||||
return;
|
||||
}
|
||||
|
||||
fighter.body.setVelocity(forceX, forceY);
|
||||
}
|
||||
|
||||
export function clearCombatObjects(scene) {
|
||||
scene.combatObjects?.forEach((object) => {
|
||||
object.cleanup?.();
|
||||
|
|
@ -226,7 +304,7 @@ function spawnSpellEffect(scene, attacker, defender, onWinner, matchId, attack)
|
|||
if (shouldRenderCombatEffects(scene)) {
|
||||
const effect = scene.add.sprite(defender.x, defender.y, fighterAttackEffectKey(attacker.skin));
|
||||
effect.setDepth(3);
|
||||
effect.setScale(FIGHTER.SCALE);
|
||||
effect.setScale(attackEffectScaleFor(attacker));
|
||||
effect.play(fighterAttackEffectAnimationKey(attacker.skin));
|
||||
trackCombatObject(scene, effect);
|
||||
|
||||
|
|
@ -250,17 +328,21 @@ function applyHit(scene, attacker, defender, onWinner, matchId, { isCritical = f
|
|||
return;
|
||||
}
|
||||
|
||||
if (isFighterSpecialInvulnerable(defender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCritical && shouldRenderCombatEffects(scene)) {
|
||||
spawnCriticalHitLabel(scene, defender);
|
||||
}
|
||||
|
||||
const attackerStats = combatStatsFor(attacker);
|
||||
defender.hp = isCritical
|
||||
? 0
|
||||
: Math.max(
|
||||
0,
|
||||
defender.hp - Phaser.Math.Between(attackerStats.damageMin, attackerStats.damageMax),
|
||||
);
|
||||
const normalDamage = Phaser.Math.Between(attackerStats.damageMin, attackerStats.damageMax);
|
||||
const damage = isCritical
|
||||
? criticalDamageFor(defender, normalDamage)
|
||||
: normalDamage;
|
||||
|
||||
defender.hp = Math.max(0, defender.hp - damage);
|
||||
defender.body.setVelocity(0, 0);
|
||||
|
||||
if (defender.hp === 0) {
|
||||
|
|
@ -272,12 +354,17 @@ function applyHit(scene, attacker, defender, onWinner, matchId, { isCritical = f
|
|||
playAnimation(defender, "hurt");
|
||||
}
|
||||
|
||||
export function applyWorldEffectDamage(scene, defender, damage) {
|
||||
if (scene.matchOver || !defender?.active || defender.isDead) {
|
||||
export function applyWorldEffectDamage(scene, defender, effectType) {
|
||||
if (
|
||||
scene.matchOver
|
||||
|| !defender?.active
|
||||
|| defender.isDead
|
||||
|| isFighterSpecialInvulnerable(defender)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const resolvedDamage = Math.max(0, Math.round(Number(damage) || 0));
|
||||
const resolvedDamage = worldEffectDamageFor(defender, effectType);
|
||||
|
||||
if (resolvedDamage === 0) {
|
||||
return false;
|
||||
|
|
@ -296,6 +383,86 @@ export function applyWorldEffectDamage(scene, defender, damage) {
|
|||
return false;
|
||||
}
|
||||
|
||||
export function applySpecialEffectInstantKill(scene, defender, attacker) {
|
||||
if (
|
||||
scene.matchOver
|
||||
|| !defender?.active
|
||||
|| defender.isDead
|
||||
|| isFighterSpecialInvulnerable(defender)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
defender.hp = 0;
|
||||
defender.body?.setVelocity(0, 0);
|
||||
|
||||
const winner =
|
||||
attacker?.active && !attacker.isDead && attacker !== defender
|
||||
? attacker
|
||||
: undefined;
|
||||
|
||||
killFighter(defender, winner);
|
||||
return true;
|
||||
}
|
||||
|
||||
function criticalDamageFor(defender, normalDamage) {
|
||||
if (!defender.isElite) {
|
||||
return normalDamage * COMBAT.NORMAL_CRITICAL_DAMAGE_MULTIPLIER;
|
||||
}
|
||||
|
||||
const percentageDamage = Math.ceil(
|
||||
(defender.maxHp ?? 1) * COMBAT.CRITICAL_DAMAGE_PERCENT,
|
||||
);
|
||||
|
||||
return Math.max(normalDamage, percentageDamage);
|
||||
}
|
||||
|
||||
function worldEffectDamageFor(defender, effectType) {
|
||||
const fixedDamage = effectType === "meteor"
|
||||
? WORLD_EFFECT.METEOR_DAMAGE
|
||||
: effectType === "frost"
|
||||
? WORLD_EFFECT.FROST_DAMAGE
|
||||
: 0;
|
||||
|
||||
if (!defender.isElite) {
|
||||
return Math.max(0, Math.round(Number(fixedDamage) || 0));
|
||||
}
|
||||
|
||||
const percentage = effectType === "meteor"
|
||||
? WORLD_EFFECT.METEOR_DAMAGE_PERCENT
|
||||
: effectType === "frost"
|
||||
? WORLD_EFFECT.FROST_DAMAGE_PERCENT
|
||||
: 0;
|
||||
|
||||
return Math.max(0, Math.ceil((defender.maxHp ?? 1) * percentage));
|
||||
}
|
||||
|
||||
export function isFighterSpecialInvulnerable(fighter) {
|
||||
if (!fighter?.isSpecialInvulnerable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const invulnerableUntil = Number(fighter.specialInvulnerableUntil) || 0;
|
||||
|
||||
if (invulnerableUntil > resolveRealtimeNow()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fighter.isSpecialInvulnerable = false;
|
||||
fighter.specialInvulnerableUntil = 0;
|
||||
|
||||
if (fighter.specialInvulnerabilityTimer) {
|
||||
globalThis.clearTimeout(fighter.specialInvulnerabilityTimer);
|
||||
fighter.specialInvulnerabilityTimer = null;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function resolveRealtimeNow() {
|
||||
return globalThis.performance?.now?.() ?? Date.now();
|
||||
}
|
||||
|
||||
function spawnCriticalHitLabel(scene, defender) {
|
||||
const scaleRatio = Math.max(1, Math.abs(defender.scaleY) / FIGHTER.SCALE);
|
||||
const label = scene.add
|
||||
|
|
@ -335,6 +502,20 @@ function getCombatType(fighter) {
|
|||
return fighter.skin.combat?.type ?? "melee";
|
||||
}
|
||||
|
||||
function attackEffectScaleFor(attacker) {
|
||||
const baseScale =
|
||||
FIGHTER.SCALE * FIGHTER.ATTACK_EFFECT_SCALE_MULTIPLIER;
|
||||
|
||||
if (
|
||||
!attacker.isElite ||
|
||||
getFighterType(attacker.skin) !== FIGHTER_TYPES.MAGIC
|
||||
) {
|
||||
return baseScale;
|
||||
}
|
||||
|
||||
return baseScale * FIGHTER.ELITE.ATTACK_EFFECT_SCALE_MULTIPLIER;
|
||||
}
|
||||
|
||||
function createAttackProfile(attacker) {
|
||||
const isCritical = Math.random() < getCriticalChance(attacker);
|
||||
|
||||
|
|
@ -410,7 +591,12 @@ function projectilePathHitsDefender(projectile, defender) {
|
|||
);
|
||||
}
|
||||
|
||||
function killFighter(defender, winner, onWinner) {
|
||||
function killFighter(
|
||||
defender,
|
||||
winner,
|
||||
onWinner,
|
||||
{ triggerEliteKillSplash = true } = {},
|
||||
) {
|
||||
defender.isDead = true;
|
||||
defender.isLocked = true;
|
||||
defender.body.setVelocity(0, 0);
|
||||
|
|
@ -425,7 +611,14 @@ function killFighter(defender, winner, onWinner) {
|
|||
winner.body.setVelocity(0, 0);
|
||||
playAnimation(winner, "idle");
|
||||
winner.scene.recordKill?.(winner, defender);
|
||||
applyKillReward(winner);
|
||||
|
||||
if (COMBAT.KILL_REWARD_ENABLED) {
|
||||
applyKillReward(winner);
|
||||
}
|
||||
|
||||
if (triggerEliteKillSplash) {
|
||||
applyEliteKillSplash(defender, winner);
|
||||
}
|
||||
} else {
|
||||
defender.scene.recordDeath?.(defender);
|
||||
}
|
||||
|
|
@ -435,6 +628,137 @@ function killFighter(defender, winner, onWinner) {
|
|||
scheduleDeadFighterDespawn(defender);
|
||||
}
|
||||
|
||||
function applyEliteKillSplash(defender, winner) {
|
||||
if (
|
||||
!COMBAT.ELITE_KILL_SPLASH_ENABLED
|
||||
|| !winner?.isElite
|
||||
|| !winner.active
|
||||
|| winner.isDead
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const scene = winner.scene ?? defender.scene;
|
||||
const radius = Math.max(0, Number(COMBAT.ELITE_KILL_SPLASH_RADIUS) || 0);
|
||||
const damage = eliteKillSplashDamageFor(defender);
|
||||
|
||||
if (!scene || scene.matchOver || radius <= 0 || damage <= 0 || !Array.isArray(scene.fighters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const center = fighterHitPoint(defender);
|
||||
const radiusSq = radius * radius;
|
||||
|
||||
if (shouldRenderCombatEffects(scene)) {
|
||||
spawnEliteKillSplashEffect(scene, center, radius, winner.team?.color);
|
||||
}
|
||||
|
||||
scene.fighters.forEach((fighter) => {
|
||||
if (
|
||||
scene.matchOver
|
||||
|| fighter === defender
|
||||
|| fighter === winner
|
||||
|| !fighter?.active
|
||||
|| fighter.isDead
|
||||
|| fighter.team?.id === winner.team?.id
|
||||
|| isFighterSpecialInvulnerable(fighter)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const target = fighterHitPoint(fighter);
|
||||
const deltaX = target.x - center.x;
|
||||
const deltaY = target.y - center.y;
|
||||
|
||||
if (deltaX * deltaX + deltaY * deltaY > radiusSq) {
|
||||
return;
|
||||
}
|
||||
|
||||
fighter.hp = Math.max(0, fighter.hp - damage);
|
||||
fighter.body?.setVelocity(0, 0);
|
||||
|
||||
if (fighter.hp === 0) {
|
||||
killFighter(fighter, winner, undefined, {
|
||||
triggerEliteKillSplash: Boolean(COMBAT.ELITE_KILL_SPLASH_CHAIN_ENABLED),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
fighter.isLocked = true;
|
||||
playAnimation(fighter, "hurt");
|
||||
});
|
||||
}
|
||||
|
||||
function eliteKillSplashDamageFor(defender) {
|
||||
const percentage = Math.max(0, Number(COMBAT.ELITE_KILL_SPLASH_DAMAGE_PERCENT) || 0);
|
||||
const maxHp = Math.max(1, Number(defender.maxHp ?? combatStatsFor(defender).maxHp) || 1);
|
||||
|
||||
return Math.ceil(maxHp * percentage);
|
||||
}
|
||||
|
||||
function spawnEliteKillSplashEffect(scene, center, radius, color) {
|
||||
const parsedColor = Number.parseInt(String(color ?? "#f6d365").replace(/^#/, ""), 16);
|
||||
const effectColor = Number.isFinite(parsedColor) ? parsedColor : 0xf6d365;
|
||||
const splash = scene.add
|
||||
.graphics()
|
||||
.setPosition(Math.round(center.x), Math.round(center.y))
|
||||
.setDepth(5);
|
||||
|
||||
drawEliteKillSplashPixels(splash, radius, effectColor);
|
||||
splash.cleanup = () => {
|
||||
scene.tweens.killTweensOf(splash);
|
||||
};
|
||||
|
||||
trackCombatObject(scene, splash);
|
||||
scene.tweens.add({
|
||||
targets: splash,
|
||||
alpha: 0,
|
||||
duration: 260,
|
||||
ease: "Cubic.Out",
|
||||
onComplete: () => disposeCombatObject(scene, splash),
|
||||
});
|
||||
}
|
||||
|
||||
function drawEliteKillSplashPixels(graphics, radius, color) {
|
||||
const dotSize = 8;
|
||||
const step = 12;
|
||||
const halfDot = dotSize / 2;
|
||||
const radiusSq = radius * radius;
|
||||
const edgeThickness = Math.max(step * 2, radius * 0.18);
|
||||
const innerRadius = Math.max(0, radius - edgeThickness);
|
||||
const innerRadiusSq = innerRadius * innerRadius;
|
||||
const coreRadiusSq = (radius * 0.42) ** 2;
|
||||
|
||||
for (let y = -radius; y <= radius; y += step) {
|
||||
for (let x = -radius; x <= radius; x += step) {
|
||||
const distanceSq = x * x + y * y;
|
||||
|
||||
if (distanceSq > radiusSq) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const gridX = Math.round((x + radius) / step);
|
||||
const gridY = Math.round((y + radius) / step);
|
||||
const isEdgeDot = distanceSq >= innerRadiusSq;
|
||||
const isInteriorDot =
|
||||
distanceSq > coreRadiusSq &&
|
||||
((gridX * 3 + gridY * 5) % 7 === 0 || (gridX + gridY) % 11 === 0);
|
||||
|
||||
if (!isEdgeDot && !isInteriorDot) {
|
||||
continue;
|
||||
}
|
||||
|
||||
graphics.fillStyle(color, isEdgeDot ? 0.72 : 0.28);
|
||||
graphics.fillRect(
|
||||
Math.round(x - halfDot),
|
||||
Math.round(y - halfDot),
|
||||
dotSize,
|
||||
dotSize,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleDeadFighterDespawn(fighter) {
|
||||
const scene = fighter.scene;
|
||||
const delay = resolveDeadDespawnDelay(scene);
|
||||
|
|
@ -838,6 +1162,11 @@ function fighterAttackSpeedMultiplier(fighter) {
|
|||
getAttackSpeedMultiplier()
|
||||
* (fighter.killRewardMultiplier ?? 1)
|
||||
* (fighter.worldEffectSpeedMultiplier ?? 1)
|
||||
* eliteSpeedMultiplier(
|
||||
fighter,
|
||||
FIGHTER.ELITE.ATTACK_SPEED_BONUS_MULTIPLIER,
|
||||
FIGHTER.ELITE.ATTACK_SPEED_STACK_EXPONENT,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -846,9 +1175,24 @@ function fighterMovementSpeedMultiplier(fighter) {
|
|||
getMovementSpeedMultiplier()
|
||||
* (fighter.killRewardMultiplier ?? 1)
|
||||
* (fighter.worldEffectSpeedMultiplier ?? 1)
|
||||
* eliteSpeedMultiplier(
|
||||
fighter,
|
||||
FIGHTER.ELITE.MOVE_SPEED_BONUS_MULTIPLIER,
|
||||
FIGHTER.ELITE.MOVE_SPEED_STACK_EXPONENT,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function eliteSpeedMultiplier(fighter, bonusMultiplier, stackExponent) {
|
||||
if (!fighter.isElite) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const stackCount = Math.max(1, Number(fighter.stackCount) || 1);
|
||||
const stackedMultiplier = Math.pow(stackCount, stackExponent);
|
||||
return 1 + bonusMultiplier * (stackedMultiplier - 1);
|
||||
}
|
||||
|
||||
function combatStatsFor(fighter) {
|
||||
return fighter.combatStats ?? getFighterStats(fighter.skin);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -6,6 +6,7 @@ import {
|
|||
import {
|
||||
applyWorldEffectDamage,
|
||||
disposeCombatObject,
|
||||
isFighterSpecialInvulnerable,
|
||||
trackCombatObject,
|
||||
} from "./combat.js";
|
||||
|
||||
|
|
@ -156,7 +157,7 @@ export function findDensestWorldEffectZone(livingFighters) {
|
|||
const column = Phaser.Math.Clamp(Math.floor(x / ARENA.TILE_SIZE), 0, ARENA.GRID_SIZE - 1);
|
||||
const row = Phaser.Math.Clamp(Math.floor(y / ARENA.TILE_SIZE), 0, ARENA.GRID_SIZE - 1);
|
||||
|
||||
tileCounts[row][column] += 1;
|
||||
tileCounts[row][column] += representedFighterCount(fighter);
|
||||
});
|
||||
|
||||
// Summed-area lookup keeps dense-zone selection cheap even with thousands of fighters.
|
||||
|
|
@ -195,7 +196,7 @@ function randomEntry(entries) {
|
|||
function spawnMeteor(scene, zone) {
|
||||
spawnWorldEffectBarrage(scene, zone, {
|
||||
color: METEOR_ZONE_COLOR,
|
||||
damage: WORLD_EFFECT.METEOR_DAMAGE,
|
||||
effectType: "meteor",
|
||||
effectKey: METEOR_EFFECT_KEY,
|
||||
});
|
||||
}
|
||||
|
|
@ -203,7 +204,7 @@ function spawnMeteor(scene, zone) {
|
|||
function spawnFrostZone(scene, zone) {
|
||||
spawnWorldEffectBarrage(scene, zone, {
|
||||
color: FROST_ZONE_COLOR,
|
||||
damage: WORLD_EFFECT.FROST_DAMAGE,
|
||||
effectType: "frost",
|
||||
effectKey: FROST_EFFECT_KEY,
|
||||
isFrost: true,
|
||||
});
|
||||
|
|
@ -212,7 +213,7 @@ function spawnFrostZone(scene, zone) {
|
|||
function spawnWorldEffectBarrage(
|
||||
scene,
|
||||
targetZone,
|
||||
{ color, damage, effectKey, isFrost = false },
|
||||
{ color, effectType, effectKey, isFrost = false },
|
||||
) {
|
||||
const matchId = scene.matchId;
|
||||
const targetMarker = createZoneMarker(scene, targetZone, color);
|
||||
|
|
@ -265,7 +266,7 @@ function spawnWorldEffectBarrage(
|
|||
resolveImpactDamage(
|
||||
scene,
|
||||
impactZone,
|
||||
damage,
|
||||
effectType,
|
||||
isFrost ? (fighter) => applyFrostStun(scene, fighter) : undefined,
|
||||
);
|
||||
|
||||
|
|
@ -525,13 +526,18 @@ function createZoneMarker(scene, zone, color) {
|
|||
return marker;
|
||||
}
|
||||
|
||||
function resolveImpactDamage(scene, zone, damage, onSurvivor) {
|
||||
function resolveImpactDamage(scene, zone, effectType, onSurvivor) {
|
||||
let deathCount = 0;
|
||||
|
||||
scene.fighters
|
||||
.filter((fighter) => fighter.active && !fighter.isDead && containsFighter(zone, fighter))
|
||||
.filter((fighter) =>
|
||||
fighter.active
|
||||
&& !fighter.isDead
|
||||
&& !isFighterSpecialInvulnerable(fighter)
|
||||
&& containsFighter(zone, fighter),
|
||||
)
|
||||
.forEach((fighter) => {
|
||||
if (applyWorldEffectDamage(scene, fighter, damage)) {
|
||||
if (applyWorldEffectDamage(scene, fighter, effectType)) {
|
||||
deathCount += 1;
|
||||
return;
|
||||
}
|
||||
|
|
@ -606,6 +612,10 @@ function containsFighter(zone, fighter) {
|
|||
return Phaser.Geom.Rectangle.Contains(zone.bounds, x, y);
|
||||
}
|
||||
|
||||
function representedFighterCount(fighter) {
|
||||
return Math.max(1, Math.round(Number(fighter?.stackCount) || 1));
|
||||
}
|
||||
|
||||
function isLiveMatch(scene, matchId = scene.matchId) {
|
||||
return !scene.matchOver && !scene.presentationMode && scene.matchId === matchId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,24 @@ import {
|
|||
} from "./fighterAssets.js";
|
||||
import { getFighterStats } from "./fighterStats.js";
|
||||
|
||||
const NAME_LABEL_BOTTOM_GAP = 14;
|
||||
const HUD_DETAIL_SYNC_INTERVAL_MS = 100;
|
||||
|
||||
export function createFighter(
|
||||
scene,
|
||||
{ canSplitOnDeath = true, faceLeft, hp, maxHp, name, skin, team, teamIndex, x, y },
|
||||
{
|
||||
canSplitOnDeath = true,
|
||||
faceLeft,
|
||||
hp,
|
||||
isElite = false,
|
||||
maxHp,
|
||||
name,
|
||||
skin,
|
||||
stackCount = 1,
|
||||
team,
|
||||
teamIndex,
|
||||
x,
|
||||
y,
|
||||
},
|
||||
) {
|
||||
ensureFighterTeamAnimations(scene, skin, team.color, ["idle"]);
|
||||
|
||||
|
|
@ -25,14 +37,40 @@ export function createFighter(
|
|||
: fighterSheetKey(skin, "idle");
|
||||
const fighter = scene.physics.add.sprite(x, y, idleSheetKey, 0);
|
||||
const displayName = name || team.label;
|
||||
const combatStats = getFighterStats(skin);
|
||||
const resolvedMaxHp = Math.max(1, Math.round(maxHp ?? combatStats.maxHp));
|
||||
const baseCombatStats = getFighterStats(skin);
|
||||
const resolvedStackCount = Math.max(1, Math.round(Number(stackCount) || 1));
|
||||
const resolvedIsElite = Boolean(isElite);
|
||||
const attackDamageMultiplier = resolvedIsElite
|
||||
? eliteBonusMultiplier(
|
||||
resolvedStackCount,
|
||||
FIGHTER.ELITE.ATTACK_DAMAGE_BONUS_MULTIPLIER,
|
||||
FIGHTER.ELITE.ATTACK_DAMAGE_STACK_EXPONENT,
|
||||
)
|
||||
: 1;
|
||||
const visualScale = resolvedIsElite
|
||||
? FIGHTER.SCALE * FIGHTER.ELITE.VISUAL_SCALE_MULTIPLIER
|
||||
: FIGHTER.SCALE;
|
||||
const rangeBonus = resolvedIsElite
|
||||
? (visualScale - FIGHTER.SCALE) * (FIGHTER.HITBOX_WIDTH / 2)
|
||||
: 0;
|
||||
const combatStats = {
|
||||
...baseCombatStats,
|
||||
attackRange: resolvedIsElite
|
||||
? baseCombatStats.attackRange * FIGHTER.ELITE.ATTACK_RANGE_MULTIPLIER + rangeBonus
|
||||
: baseCombatStats.attackRange,
|
||||
damageMax: baseCombatStats.damageMax * attackDamageMultiplier,
|
||||
damageMin: baseCombatStats.damageMin * attackDamageMultiplier,
|
||||
};
|
||||
const hpMultiplier = resolvedIsElite
|
||||
? resolvedStackCount * FIGHTER.ELITE.HP_BONUS_RATIO
|
||||
: resolvedStackCount;
|
||||
const resolvedMaxHp = Math.max(1, Math.round((maxHp ?? baseCombatStats.maxHp) * hpMultiplier));
|
||||
const resolvedHp = Math.min(
|
||||
resolvedMaxHp,
|
||||
Math.max(1, Math.round(hp ?? resolvedMaxHp)),
|
||||
);
|
||||
|
||||
fighter.setScale(FIGHTER.SCALE);
|
||||
fighter.setScale(visualScale);
|
||||
fighter.setName(displayName);
|
||||
fighter.setDepth(FIGHTER.DEPTH);
|
||||
fighter.setAlpha(1);
|
||||
|
|
@ -54,11 +92,13 @@ export function createFighter(
|
|||
fighter.skin = skin;
|
||||
fighter.combatStats = combatStats;
|
||||
fighter.fighterName = displayName;
|
||||
fighter.isElite = resolvedIsElite;
|
||||
fighter.stackCount = resolvedStackCount;
|
||||
fighter.team = team;
|
||||
fighter.teamIndex = teamIndex;
|
||||
fighter.baseScaleX = FIGHTER.SCALE;
|
||||
fighter.baseScaleY = FIGHTER.SCALE;
|
||||
fighter.canSplitOnDeath = canSplitOnDeath;
|
||||
fighter.baseScaleX = visualScale;
|
||||
fighter.baseScaleY = visualScale;
|
||||
fighter.canSplitOnDeath = canSplitOnDeath && !resolvedIsElite;
|
||||
fighter.isSelected = false;
|
||||
fighter.killCount = 0;
|
||||
fighter.killRewardMultiplier = 1;
|
||||
|
|
@ -93,6 +133,11 @@ export function createFighter(
|
|||
return fighter;
|
||||
}
|
||||
|
||||
function eliteBonusMultiplier(stackCount, bonusMultiplier, stackExponent) {
|
||||
const stackedMultiplier = Math.pow(stackCount, stackExponent);
|
||||
return 1 + bonusMultiplier * (stackedMultiplier - 1);
|
||||
}
|
||||
|
||||
export function syncFighterHud(
|
||||
fighter,
|
||||
{ force = false, showDetails = true, time = fighter.scene?.time?.now ?? 0 } = {},
|
||||
|
|
@ -129,11 +174,7 @@ export function syncFighterHud(
|
|||
|
||||
const scaleRatio = Math.max(1, Math.abs(fighter.scaleY) / FIGHTER.SCALE);
|
||||
const healthOffset = 44 * scaleRatio;
|
||||
const hitbox = fighter.body;
|
||||
const nameX = hitbox.x + hitbox.width / 2;
|
||||
const nameY = hitbox.y + hitbox.height + NAME_LABEL_BOTTOM_GAP;
|
||||
|
||||
hudSlot.nameLabel.setPosition(nameX, nameY);
|
||||
hudSlot.healthBack.setPosition(fighter.x, fighter.y - healthOffset);
|
||||
hudSlot.healthBar.setPosition(fighter.x - 34, fighter.y - healthOffset);
|
||||
hudSlot.healthBar.width = Math.max(0, 68 * (fighter.hp / (fighter.maxHp ?? 1)));
|
||||
|
|
@ -186,7 +227,6 @@ function setVisibleIfChanged(gameObject, visible) {
|
|||
}
|
||||
|
||||
function setHudSlotVisible(hudSlot, visible) {
|
||||
setVisibleIfChanged(hudSlot.nameLabel, visible);
|
||||
setVisibleIfChanged(hudSlot.healthBack, visible);
|
||||
setVisibleIfChanged(hudSlot.healthBar, visible);
|
||||
}
|
||||
|
|
@ -205,7 +245,7 @@ function acquireFighterHudSlot(fighter) {
|
|||
|
||||
hudSlot.fighter = fighter;
|
||||
fighter._hudSlot = hudSlot;
|
||||
configureHudSlot(hudSlot, fighter);
|
||||
configureHudSlot(hudSlot);
|
||||
return hudSlot;
|
||||
}
|
||||
|
||||
|
|
@ -220,18 +260,6 @@ function ensureFighterHudPool(scene) {
|
|||
}
|
||||
|
||||
function createHudSlot(scene) {
|
||||
const nameLabel = scene.add
|
||||
.text(0, 0, "", {
|
||||
color: "#fff2c2",
|
||||
fontFamily: "Inter, Pretendard, sans-serif",
|
||||
fontSize: "18px",
|
||||
fontStyle: "700",
|
||||
stroke: "#17180e",
|
||||
strokeThickness: 4,
|
||||
})
|
||||
.setOrigin(0.5, 0)
|
||||
.setDepth(4)
|
||||
.setVisible(false);
|
||||
const healthBack = scene.add
|
||||
.rectangle(0, 0, 72, 8, 0x17180e, 0.92)
|
||||
.setDepth(4)
|
||||
|
|
@ -246,14 +274,10 @@ function createHudSlot(scene) {
|
|||
fighter: null,
|
||||
healthBack,
|
||||
healthBar,
|
||||
nameLabel,
|
||||
};
|
||||
}
|
||||
|
||||
function configureHudSlot(hudSlot, fighter) {
|
||||
hudSlot.nameLabel.setText(fighter.fighterName ?? fighter.name ?? "");
|
||||
hudSlot.nameLabel.setStroke(fighter.team?.color ?? "#17180e", 4);
|
||||
hudSlot.nameLabel.setDepth(4);
|
||||
function configureHudSlot(hudSlot) {
|
||||
hudSlot.healthBack.setDepth(4);
|
||||
hudSlot.healthBar.setDepth(5);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export const fighterManifest = [
|
|||
walk: animation("Knight-Walk.png", 8),
|
||||
attack: animation("Knight-Attack01.png", 7),
|
||||
attack02: animation("Knight-Attack02.png", 10),
|
||||
attack03: animation("Knight-Attack03.png", 11),
|
||||
// attack03: animation("Knight-Attack03.png", 11),
|
||||
block: animation("Knight-Block.png", 4),
|
||||
hurt: animation("Knight-Hurt.png", 4),
|
||||
death: animation("Knight-Death.png", 4),
|
||||
|
|
@ -154,7 +154,7 @@ export const fighterManifest = [
|
|||
walk02: animation("Lancer-Walk02.png", 8),
|
||||
attack: animation("Lancer-Attack01.png", 6),
|
||||
attack02: animation("Lancer-Attack02.png", 9),
|
||||
attack03: animation("Lancer-Attack03.png", 8),
|
||||
// attack03: animation("Lancer-Attack03.png", 8),
|
||||
hurt: animation("Lancer-Hurt.png", 4),
|
||||
death: animation("Lancer-Death.png", 4),
|
||||
},
|
||||
|
|
@ -190,7 +190,7 @@ export const fighterManifest = [
|
|||
animations: {
|
||||
idle: animation("Priest-Idle.png", 6),
|
||||
walk: animation("Priest-Walk.png", 8),
|
||||
attack: animation("Priest-Attack.png", 9),
|
||||
attack: animation("Priest-Heal.png", 6),
|
||||
heal: animation("Priest-Heal.png", 6),
|
||||
hurt: animation("Priest-Hurt.png", 4),
|
||||
death: animation("Priest-Death.png", 4),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
import { FIGHTER } from "../../constants.js";
|
||||
import { getFighterType } from "./fighterStats.js";
|
||||
|
||||
export function pickUniqueFighters(fighters, count) {
|
||||
if (count > fighters.length) {
|
||||
throw new Error(`Cannot pick ${count} fighters from ${fighters.length} entries.`);
|
||||
throw new Error(
|
||||
`Cannot pick ${count} fighters from ${fighters.length} entries.`,
|
||||
);
|
||||
}
|
||||
|
||||
return shuffleFighters(fighters).slice(0, count);
|
||||
|
|
@ -20,6 +25,34 @@ export function pickFighters(fighters, count) {
|
|||
return picks;
|
||||
}
|
||||
|
||||
export function pickFightersForSetups(fighters, fighterSetups) {
|
||||
const eliteCount = fighterSetups.filter(
|
||||
(fighterSetup) => fighterSetup.isElite,
|
||||
).length;
|
||||
const normalCount = fighterSetups.length - eliteCount;
|
||||
|
||||
const eligibleEliteFighters = fighters.filter((fighter) =>
|
||||
FIGHTER.ELITE.TYPE.includes(getFighterType(fighter)),
|
||||
);
|
||||
|
||||
if (eliteCount > 0 && eligibleEliteFighters.length === 0) {
|
||||
throw new Error(
|
||||
`Cannot create elite fighters without ${FIGHTER.ELITE.TYPE} fighter skins.`,
|
||||
);
|
||||
}
|
||||
|
||||
const elitePicks = pickFighters(eligibleEliteFighters, eliteCount);
|
||||
const normalPicks = pickFighters(fighters, normalCount);
|
||||
let eliteIndex = 0;
|
||||
let normalIndex = 0;
|
||||
|
||||
return fighterSetups.map((fighterSetup) =>
|
||||
fighterSetup.isElite
|
||||
? elitePicks[eliteIndex++]
|
||||
: normalPicks[normalIndex++],
|
||||
);
|
||||
}
|
||||
|
||||
function shuffleFighters(fighters) {
|
||||
const pool = [...fighters];
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
|
|||
export function createFighterPlans(fighterSetups, skins, { expandSpawnMultipliers = true } = {}) {
|
||||
return fighterSetups.flatMap((fighterSetup, index) => {
|
||||
const skin = skins[index];
|
||||
const spawnMultiplier = expandSpawnMultipliers
|
||||
const spawnMultiplier = expandSpawnMultipliers && !fighterSetup.isElite
|
||||
? Math.max(1, Math.round(skin.traits?.spawnMultiplier ?? 1))
|
||||
: 1;
|
||||
|
||||
|
|
@ -49,6 +49,12 @@ export function clampInsideArena(value) {
|
|||
|
||||
export function syncTeamSizes(teams, fighterPlans) {
|
||||
teams.forEach((team) => {
|
||||
team.size = fighterPlans.filter((fighterPlan) => fighterPlan.team.id === team.id).length;
|
||||
team.size = fighterPlans
|
||||
.filter((fighterPlan) => fighterPlan.team.id === team.id)
|
||||
.reduce((sum, fighterPlan) => sum + representedFighterCount(fighterPlan), 0);
|
||||
});
|
||||
}
|
||||
|
||||
function representedFighterCount(fighter) {
|
||||
return Math.max(1, Math.round(Number(fighter?.stackCount) || 1));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ARENA, SPAWN, TEAM } from "../../constants.js";
|
||||
import { ARENA, FIGHTER, PERFORMANCE, SPAWN, TEAM } from "../../constants.js";
|
||||
|
||||
const NAME_MULTIPLIER_REGEX = /\*(\d+)$/;
|
||||
|
||||
|
|
@ -37,23 +37,229 @@ export function createMatchSetup(
|
|||
startingZones,
|
||||
);
|
||||
|
||||
const fighters = [];
|
||||
const teamRosters = [];
|
||||
let spawnOffset = 0;
|
||||
|
||||
teams.forEach((team) => {
|
||||
for (let i = 0; i < team.size; i++) {
|
||||
const globalIndex = fighters.length;
|
||||
fighters.push({
|
||||
...spawns[globalIndex],
|
||||
name: team.label,
|
||||
team: team,
|
||||
teamIndex: i,
|
||||
});
|
||||
const teamRoster = usesRandomizedEliteCompression(team)
|
||||
? createRandomizedEliteRoster(team, spawns, spawnOffset, totalFighters)
|
||||
: createFixedEliteRoster(team, spawns, spawnOffset);
|
||||
|
||||
teamRosters.push(teamRoster);
|
||||
|
||||
spawnOffset += team.size;
|
||||
});
|
||||
|
||||
enforceRenderedFighterLimit(teamRosters, totalFighters);
|
||||
|
||||
return {
|
||||
fighters: teamRosters.flatMap(materializeEliteRoster),
|
||||
startingZones,
|
||||
teams,
|
||||
};
|
||||
}
|
||||
|
||||
function usesRandomizedEliteCompression(team) {
|
||||
return team.size >= FIGHTER.ELITE.RANDOMIZED_COMPRESSION.MIN_TEAM_SIZE;
|
||||
}
|
||||
|
||||
function createFixedEliteRoster(team, spawns, spawnOffset) {
|
||||
const eliteCount = Math.floor(team.size / FIGHTER.ELITE.STACK_SIZE);
|
||||
|
||||
return {
|
||||
blocks: Array.from({ length: eliteCount }, (_, index) => ({
|
||||
isElite: true,
|
||||
startIndex: index * FIGHTER.ELITE.STACK_SIZE,
|
||||
stackCount: FIGHTER.ELITE.STACK_SIZE,
|
||||
})),
|
||||
normalRemainderCount: team.size % FIGHTER.ELITE.STACK_SIZE,
|
||||
remainderIsElite: false,
|
||||
spawnOffset,
|
||||
spawns,
|
||||
team,
|
||||
};
|
||||
}
|
||||
|
||||
function createRandomizedEliteRoster(team, spawns, spawnOffset, totalFighters) {
|
||||
const eliteBlockProbability = resolveEliteBlockProbability(totalFighters);
|
||||
const stackSize = FIGHTER.ELITE.STACK_SIZE;
|
||||
const blockCount = Math.floor(team.size / stackSize);
|
||||
|
||||
return {
|
||||
blocks: Array.from({ length: blockCount }, (_, blockIndex) => ({
|
||||
canPromote: true,
|
||||
isElite: Math.random() < eliteBlockProbability,
|
||||
startIndex: blockIndex * stackSize,
|
||||
stackCount: stackSize,
|
||||
})),
|
||||
normalRemainderCount: team.size % stackSize,
|
||||
remainderIsElite: false,
|
||||
spawnOffset,
|
||||
spawns,
|
||||
team,
|
||||
};
|
||||
}
|
||||
|
||||
function enforceRenderedFighterLimit(rosters, totalFighters) {
|
||||
if (totalFighters <= PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD) {
|
||||
return;
|
||||
}
|
||||
|
||||
const renderLimit = Math.max(
|
||||
1,
|
||||
Math.round(Number(PERFORMANCE.LARGE_BATTLE_RENDERED_FIGHTER_LIMIT) || 1),
|
||||
);
|
||||
let overflow = renderedFighterCount(rosters) - renderLimit;
|
||||
|
||||
if (overflow <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const promotableGroups = shuffle(
|
||||
rosters.flatMap((roster) =>
|
||||
[
|
||||
...roster.blocks
|
||||
.filter((block) => block.canPromote && !block.isElite)
|
||||
.map((block) => ({
|
||||
promote: () => {
|
||||
block.isElite = true;
|
||||
},
|
||||
stackCount: block.stackCount,
|
||||
})),
|
||||
...(roster.normalRemainderCount > 1 && !roster.remainderIsElite
|
||||
? [{
|
||||
promote: () => {
|
||||
roster.remainderIsElite = true;
|
||||
},
|
||||
stackCount: roster.normalRemainderCount,
|
||||
}]
|
||||
: []),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
for (const group of promotableGroups) {
|
||||
if (overflow <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
group.promote();
|
||||
overflow -= group.stackCount - 1;
|
||||
}
|
||||
}
|
||||
|
||||
function renderedFighterCount(rosters) {
|
||||
return rosters.reduce(
|
||||
(sum, roster) =>
|
||||
sum
|
||||
+ (roster.remainderIsElite ? 1 : roster.normalRemainderCount)
|
||||
+ roster.blocks.reduce(
|
||||
(blockSum, block) => blockSum + (block.isElite ? 1 : block.stackCount),
|
||||
0,
|
||||
),
|
||||
0,
|
||||
);
|
||||
}
|
||||
|
||||
function materializeEliteRoster(roster) {
|
||||
const {
|
||||
blocks,
|
||||
normalRemainderCount,
|
||||
remainderIsElite,
|
||||
spawnOffset,
|
||||
spawns,
|
||||
team,
|
||||
} = roster;
|
||||
const eliteCount =
|
||||
blocks.filter((block) => block.isElite).length + (remainderIsElite ? 1 : 0);
|
||||
const fighters = [];
|
||||
let eliteIndex = 0;
|
||||
|
||||
blocks.forEach((block) => {
|
||||
if (block.isElite) {
|
||||
fighters.push(createElitePlan({
|
||||
eliteCount,
|
||||
eliteIndex,
|
||||
spawn: spawns[spawnOffset + block.startIndex],
|
||||
stackCount: block.stackCount,
|
||||
team,
|
||||
teamIndex: block.startIndex,
|
||||
}));
|
||||
eliteIndex += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
for (let index = 0; index < block.stackCount; index += 1) {
|
||||
const teamIndex = block.startIndex + index;
|
||||
fighters.push(createNormalPlan(team, spawns[spawnOffset + teamIndex], teamIndex));
|
||||
}
|
||||
});
|
||||
|
||||
const remainderStartIndex = blocks.length * FIGHTER.ELITE.STACK_SIZE;
|
||||
|
||||
if (remainderIsElite) {
|
||||
fighters.push(createElitePlan({
|
||||
eliteCount,
|
||||
eliteIndex,
|
||||
spawn: spawns[spawnOffset + remainderStartIndex],
|
||||
stackCount: normalRemainderCount,
|
||||
team,
|
||||
teamIndex: remainderStartIndex,
|
||||
}));
|
||||
return fighters;
|
||||
}
|
||||
|
||||
for (let index = 0; index < normalRemainderCount; index += 1) {
|
||||
const teamIndex = remainderStartIndex + index;
|
||||
fighters.push(createNormalPlan(team, spawns[spawnOffset + teamIndex], teamIndex));
|
||||
}
|
||||
|
||||
return fighters;
|
||||
}
|
||||
|
||||
function resolveEliteBlockProbability(totalFighters) {
|
||||
const {
|
||||
ELITE_BLOCK_PROBABILITY,
|
||||
LARGE_BATTLE_ELITE_BLOCK_PROBABILITY,
|
||||
} = FIGHTER.ELITE.RANDOMIZED_COMPRESSION;
|
||||
|
||||
const baseProbability = clampProbability(ELITE_BLOCK_PROBABILITY);
|
||||
|
||||
if (totalFighters <= PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD) {
|
||||
return baseProbability;
|
||||
}
|
||||
|
||||
return Math.max(
|
||||
baseProbability,
|
||||
clampProbability(LARGE_BATTLE_ELITE_BLOCK_PROBABILITY),
|
||||
);
|
||||
}
|
||||
|
||||
function clampProbability(value) {
|
||||
return Math.min(1, Math.max(0, Number(value) || 0));
|
||||
}
|
||||
|
||||
function createElitePlan({ eliteCount, eliteIndex, spawn, stackCount, team, teamIndex }) {
|
||||
return {
|
||||
fighters,
|
||||
startingZones,
|
||||
teams,
|
||||
...spawn,
|
||||
isElite: true,
|
||||
name: eliteCount > 1
|
||||
? `${team.label} (Elite ${eliteIndex + 1})`
|
||||
: `${team.label} (Elite)`,
|
||||
stackCount,
|
||||
team,
|
||||
teamIndex,
|
||||
};
|
||||
}
|
||||
|
||||
function createNormalPlan(team, spawn, teamIndex) {
|
||||
return {
|
||||
...spawn,
|
||||
isElite: false,
|
||||
name: team.label,
|
||||
stackCount: 1,
|
||||
team,
|
||||
teamIndex,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
11
src/main.js
11
src/main.js
|
|
@ -1,7 +1,7 @@
|
|||
import Phaser from "phaser";
|
||||
import { ArenaScene } from "./game/arena/ArenaScene.js";
|
||||
import {
|
||||
ARENA,
|
||||
RENDER,
|
||||
SPAWN,
|
||||
} from "./constants.js";
|
||||
import { createMatchForm } from "./ui/matchForm.js";
|
||||
|
|
@ -181,10 +181,15 @@ const arenaScene = new ArenaScene({
|
|||
const game = new Phaser.Game({
|
||||
type: Phaser.AUTO,
|
||||
parent: "game",
|
||||
width: ARENA.SIZE,
|
||||
height: ARENA.SIZE,
|
||||
width: RENDER.VIEWPORT_SIZE,
|
||||
height: RENDER.VIEWPORT_SIZE,
|
||||
pixelArt: true,
|
||||
backgroundColor: "#282819",
|
||||
render: {
|
||||
antialias: false,
|
||||
pixelArt: true,
|
||||
roundPixels: true,
|
||||
},
|
||||
physics: {
|
||||
default: "arcade",
|
||||
arcade: {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
@keyframes battle-notice-roll {
|
||||
from {
|
||||
transform: translateX(0);
|
||||
}
|
||||
to {
|
||||
transform: translateX(calc(-1 * (var(--battle-notice-message-width) + var(--battle-notice-roll-gap))));
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes kill-log-entry {
|
||||
from {
|
||||
opacity: 0;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
scrollbar-width: thin;
|
||||
scrollbar-color: rgb(238 185 73 / 0.3) transparent;
|
||||
padding: 8px;
|
||||
border: 1px solid rgb(238 185 73 / 0.18);
|
||||
border: 1px solid rgb(238 185 73 / 0.12);
|
||||
border-radius: 8px;
|
||||
background: rgb(4 6 4 / 0.5);
|
||||
background: rgb(4 6 4 / 0.46);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transform: translateY(-18px);
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
.score-side {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 114px);
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -56,33 +56,54 @@
|
|||
}
|
||||
|
||||
.team-score {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-rows: 1fr 1px auto;
|
||||
gap: 6px;
|
||||
width: 114px;
|
||||
width: 100%;
|
||||
min-height: 72px;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgb(255 244 209 / 0.08);
|
||||
border-radius: 6px;
|
||||
padding: 8px 9px;
|
||||
padding: 8px 7px;
|
||||
background: rgb(8 10 7 / 0.58);
|
||||
color: #fff;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 900;
|
||||
text-align: left;
|
||||
text-shadow: 1px 1px 2px #000;
|
||||
text-shadow: 0 1px 1px rgb(0 0 0 / 0.78);
|
||||
transition:
|
||||
filter 160ms ease,
|
||||
transform 160ms ease;
|
||||
background-color 160ms ease,
|
||||
border-color 160ms ease,
|
||||
filter 160ms ease;
|
||||
}
|
||||
|
||||
.team-score::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 9px;
|
||||
left: 8px;
|
||||
width: 10px;
|
||||
height: 7px;
|
||||
border-radius: 1px;
|
||||
background: var(--team-color);
|
||||
box-shadow:
|
||||
0 0 0 1px rgb(0 0 0 / 0.72),
|
||||
inset 0 -1px 0 rgb(0 0 0 / 0.28);
|
||||
opacity: 0.9;
|
||||
transform: skewX(-14deg);
|
||||
}
|
||||
|
||||
.team-score:hover {
|
||||
filter: brightness(1.16);
|
||||
transform: translateY(-1px);
|
||||
border-color: rgb(255 244 209 / 0.16);
|
||||
background: rgb(12 14 10 / 0.68);
|
||||
filter: brightness(1.06);
|
||||
}
|
||||
|
||||
.team-score.is-focused {
|
||||
box-shadow:
|
||||
inset 0 0 0 2px rgb(255 244 209 / 0.92),
|
||||
0 0 18px rgb(227 178 79 / 0.26);
|
||||
inset 0 0 0 1px rgb(255 244 209 / 0.72),
|
||||
inset 0 0 0 999px rgb(255 244 209 / 0.035);
|
||||
}
|
||||
|
||||
.team-score:disabled {
|
||||
|
|
@ -91,7 +112,7 @@
|
|||
}
|
||||
|
||||
.team-score:disabled:hover {
|
||||
transform: none;
|
||||
background: rgb(8 10 7 / 0.58);
|
||||
}
|
||||
|
||||
.team-score-name {
|
||||
|
|
@ -99,6 +120,7 @@
|
|||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
padding-left: 16px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: normal;
|
||||
line-height: 1.15;
|
||||
|
|
@ -106,14 +128,19 @@
|
|||
|
||||
.team-score-rule {
|
||||
width: 100%;
|
||||
background: var(--team-color);
|
||||
opacity: 0.9;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
var(--team-color) 0 34%,
|
||||
rgb(255 244 209 / 0.1) 34% 100%
|
||||
);
|
||||
opacity: 0.68;
|
||||
}
|
||||
|
||||
.team-score-count {
|
||||
justify-self: end;
|
||||
color: #fff2c8;
|
||||
font-size: 0.86rem;
|
||||
color: #ead9b3;
|
||||
font-size: 0.68rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.battle-notice {
|
||||
|
|
@ -138,13 +165,51 @@
|
|||
text-align: center;
|
||||
text-shadow: 1px 1px 2px #000;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transform: translate(-50%, -10px);
|
||||
transition:
|
||||
opacity 260ms ease,
|
||||
transform 260ms ease;
|
||||
backdrop-filter: blur(10px);
|
||||
backdrop-filter: blur(7px);
|
||||
}
|
||||
|
||||
.battle-notice-message {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.battle-notice.is-rolling {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.battle-notice-track {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
gap: var(--battle-notice-roll-gap, 48px);
|
||||
width: max-content;
|
||||
max-width: none;
|
||||
animation: battle-notice-roll var(--battle-notice-roll-duration, 12s) linear infinite;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.battle-notice.is-rolling .battle-notice-message {
|
||||
flex: 0 0 auto;
|
||||
max-width: none;
|
||||
overflow: visible;
|
||||
text-overflow: clip;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.battle-notice-track {
|
||||
animation: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
#app.match-live .battle-notice.is-visible {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
--mobile-kill-log-top: calc(var(--score-band-height) + var(--mobile-game-size) + 10px);
|
||||
--mobile-options-button-width: 54px;
|
||||
--mobile-options-gap: 8px;
|
||||
--mobile-team-card-width: clamp(56px, calc((100vw - 120px) / 4), 72px);
|
||||
--mobile-team-card-width: clamp(108px, calc((100vw - 38px) / 3), 124px);
|
||||
--mobile-visitor-space: calc(104px + env(safe-area-inset-bottom));
|
||||
--score-band-height: 132px;
|
||||
--score-panel-left: 10px;
|
||||
|
|
@ -204,12 +204,25 @@
|
|||
align-content: center;
|
||||
}
|
||||
|
||||
.team-score::before {
|
||||
top: 6px;
|
||||
left: 6px;
|
||||
width: 8px;
|
||||
height: 6px;
|
||||
}
|
||||
|
||||
.team-score-name {
|
||||
padding-left: 13px;
|
||||
}
|
||||
|
||||
.team-score-count {
|
||||
font-size: 0.74rem;
|
||||
font-size: 0.64rem;
|
||||
}
|
||||
|
||||
.team-score.is-focused {
|
||||
box-shadow: inset 0 0 0 2px rgb(255 244 209 / 0.92);
|
||||
box-shadow:
|
||||
inset 0 0 0 1px rgb(255 244 209 / 0.72),
|
||||
inset 0 0 0 999px rgb(255 244 209 / 0.035);
|
||||
}
|
||||
|
||||
.battle-notice {
|
||||
|
|
|
|||
|
|
@ -24,22 +24,24 @@ export function updateScoreboard(
|
|||
|
||||
teams.forEach((team, index) => {
|
||||
const teamEl = containerLeft.children[index];
|
||||
const aliveCount = fighters.filter(
|
||||
const livingFighters = fighters.filter(
|
||||
(fighter) => fighter.team.id === team.id && !fighter.isDead,
|
||||
).length;
|
||||
);
|
||||
const eliteCount = livingFighters.filter((fighter) => fighter.isElite).length;
|
||||
const normalCount = livingFighters.length - eliteCount;
|
||||
|
||||
teamEl.disabled = aliveCount === 0;
|
||||
teamEl.disabled = livingFighters.length === 0;
|
||||
teamEl.setAttribute("aria-label", `${team.label} 생존 캐릭터 무작위 시점 고정`);
|
||||
teamEl.style.setProperty("--team-color", team.color);
|
||||
teamEl.style.backgroundColor = `${team.color}33`;
|
||||
teamEl.style.borderLeft = `4px solid ${team.color}`;
|
||||
teamEl.style.removeProperty("background-color");
|
||||
teamEl.style.removeProperty("border-left");
|
||||
teamEl.classList.toggle("is-focused", selectedFighterTeamId === team.id);
|
||||
|
||||
const labelEl = teamEl.querySelector(".team-score-name");
|
||||
labelEl.textContent = team.label;
|
||||
|
||||
const countEl = teamEl.querySelector(".team-score-count");
|
||||
countEl.textContent = `${aliveCount}명`;
|
||||
countEl.textContent = `E : ${eliteCount} | N : ${normalCount}`;
|
||||
|
||||
teamEl.onclick = () => {
|
||||
onTeamClick(team.id);
|
||||
|
|
|
|||
|
|
@ -27,10 +27,13 @@ const DEATH_NOTICE_TEMPLATES = [
|
|||
const SYSTEM_TIP_TEMPLATES = [
|
||||
"경보: 화염 메테오는 낙하 지점 5x5 영역에 강력한 폭발 피해를 입힙니다!",
|
||||
"주의: 냉기 메테오는 피해와 함께 2초간 동결 및 냉각을 유발합니다.",
|
||||
"팁: 근접 캐릭터는 20% 확률로 치명타를 터뜨려 적을 즉사시킵니다.",
|
||||
"성장: 적 처치 시 체력을 30% 회복하며, 크기와 속도가 최대 5배까지 커집니다.",
|
||||
"팁: 근접 치명타는 일반 대상에 2배 피해, 엘리트 대상에 최대 체력 비례 피해를 줍니다.",
|
||||
"엘리트 전투: 처치 보너스는 비활성화되어 전투 중 체력 회복이나 성장 효과가 없습니다.",
|
||||
];
|
||||
|
||||
const NOTICE_MESSAGE_CLASS = "battle-notice-message";
|
||||
const NOTICE_TRACK_CLASS = "battle-notice-track";
|
||||
|
||||
export function createDeathCounts() {
|
||||
return SPECIES_KEYS.reduce((counts, species) => {
|
||||
counts[species] = 0;
|
||||
|
|
@ -90,9 +93,21 @@ export function showBattleDeathNotice(noticeNode, message) {
|
|||
return;
|
||||
}
|
||||
|
||||
noticeNode.textContent = message;
|
||||
cancelBattleNoticeMeasure(noticeNode);
|
||||
|
||||
const text = String(message ?? "");
|
||||
const messageNode = createBattleNoticeMessage(text);
|
||||
|
||||
noticeNode.classList.remove("is-rolling");
|
||||
noticeNode.removeAttribute("aria-label");
|
||||
clearBattleNoticeRollStyles(noticeNode);
|
||||
noticeNode.replaceChildren(messageNode);
|
||||
noticeNode.classList.add("is-visible");
|
||||
noticeNode.setAttribute("aria-hidden", "false");
|
||||
noticeNode.battleNoticeMeasureFrame = requestAnimationFrame(() => {
|
||||
noticeNode.battleNoticeMeasureFrame = null;
|
||||
applyBattleNoticeRollingIfNeeded(noticeNode, text, messageNode);
|
||||
});
|
||||
}
|
||||
|
||||
export function clearBattleNotice(noticeNode) {
|
||||
|
|
@ -100,6 +115,94 @@ export function clearBattleNotice(noticeNode) {
|
|||
return;
|
||||
}
|
||||
|
||||
cancelBattleNoticeMeasure(noticeNode);
|
||||
noticeNode.classList.remove("is-visible");
|
||||
noticeNode.setAttribute("aria-hidden", "true");
|
||||
}
|
||||
|
||||
function createBattleNoticeMessage(message) {
|
||||
const messageNode = document.createElement("span");
|
||||
|
||||
messageNode.className = NOTICE_MESSAGE_CLASS;
|
||||
messageNode.textContent = message;
|
||||
|
||||
return messageNode;
|
||||
}
|
||||
|
||||
function applyBattleNoticeRollingIfNeeded(noticeNode, message, messageNode) {
|
||||
if (
|
||||
!noticeNode.isConnected ||
|
||||
!noticeNode.classList.contains("is-visible") ||
|
||||
!messageNode.isConnected
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const availableWidth = resolveBattleNoticeContentWidth(noticeNode);
|
||||
const messageWidth = Math.ceil(messageNode.scrollWidth);
|
||||
|
||||
if (availableWidth <= 0 || messageWidth <= availableWidth + 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const gap = resolveBattleNoticeRollGap();
|
||||
const durationMs = resolveBattleNoticeRollDuration(
|
||||
messageWidth + gap + availableWidth,
|
||||
);
|
||||
const track = document.createElement("span");
|
||||
|
||||
track.className = NOTICE_TRACK_CLASS;
|
||||
track.setAttribute("aria-hidden", "true");
|
||||
track.append(createBattleNoticeMessage(message), createBattleNoticeMessage(message));
|
||||
|
||||
noticeNode.classList.add("is-rolling");
|
||||
noticeNode.setAttribute("aria-label", message);
|
||||
noticeNode.style.setProperty("--battle-notice-message-width", `${messageWidth}px`);
|
||||
noticeNode.style.setProperty("--battle-notice-roll-gap", `${gap}px`);
|
||||
noticeNode.style.setProperty("--battle-notice-roll-duration", `${durationMs}ms`);
|
||||
noticeNode.replaceChildren(track);
|
||||
}
|
||||
|
||||
function resolveBattleNoticeContentWidth(noticeNode) {
|
||||
const style = getComputedStyle(noticeNode);
|
||||
const paddingX =
|
||||
(Number.parseFloat(style.paddingLeft) || 0) +
|
||||
(Number.parseFloat(style.paddingRight) || 0);
|
||||
|
||||
return Math.max(0, noticeNode.clientWidth - paddingX);
|
||||
}
|
||||
|
||||
function resolveBattleNoticeRollGap() {
|
||||
return Math.max(0, Math.round(Number(UI.BATTLE_NOTICE_ROLL_GAP_PX) || 48));
|
||||
}
|
||||
|
||||
function resolveBattleNoticeRollDuration(distancePx) {
|
||||
const speed = Math.max(
|
||||
1,
|
||||
Number(UI.BATTLE_NOTICE_ROLL_SPEED_PX_PER_SECOND) || 58,
|
||||
);
|
||||
const duration = Math.round((Math.max(1, distancePx) / speed) * 1000);
|
||||
const minimum = Math.max(
|
||||
1,
|
||||
Number(UI.BATTLE_NOTICE_ROLL_MIN_DURATION_MS) || 7000,
|
||||
);
|
||||
const maximum = Math.max(
|
||||
minimum,
|
||||
Number(UI.BATTLE_NOTICE_ROLL_MAX_DURATION_MS) || 18000,
|
||||
);
|
||||
|
||||
return Math.min(maximum, Math.max(minimum, duration));
|
||||
}
|
||||
|
||||
function clearBattleNoticeRollStyles(noticeNode) {
|
||||
noticeNode.style.removeProperty("--battle-notice-message-width");
|
||||
noticeNode.style.removeProperty("--battle-notice-roll-gap");
|
||||
noticeNode.style.removeProperty("--battle-notice-roll-duration");
|
||||
}
|
||||
|
||||
function cancelBattleNoticeMeasure(noticeNode) {
|
||||
if (noticeNode.battleNoticeMeasureFrame) {
|
||||
cancelAnimationFrame(noticeNode.battleNoticeMeasureFrame);
|
||||
noticeNode.battleNoticeMeasureFrame = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
41
todo.md
41
todo.md
|
|
@ -311,3 +311,44 @@
|
|||
52. Configurable barrage warning duration (completed)
|
||||
- Added `WORLD_EFFECT.WARNING_DURATION_MS` to control the visible lifetime of the large dense-area warning marker.
|
||||
- Kept scheduled small impacts and meteor camera focus running after the warning marker hides.
|
||||
53. Elite stacked-fighter compression and damage model (completed)
|
||||
- Compressed each complete 100-member block in a smaller `nickname*N` team into one elite (`stackCount = 100`) and preserved the remaining members as individual normal fighters (`*101 = 1 elite + 1 normal`, `*199 = 1 elite + 99 normal`, `*200 = 2 elite`).
|
||||
- Added centralized elite scale/HP/range and critical/meteor/frost percentage-damage constants; elite damage and attack speed now scale with `sqrt(stackCount)`.
|
||||
- Weighted spectator thresholds, focus centers, and dense-area world-effect targeting by `stackCount` so compressed armies continue to influence viewing and hazard selection by their represented size.
|
||||
- Kept elite movement speed unchanged and disabled Slime spawn/split reproduction on elite representatives to avoid multiplying an entire compressed army from a per-unit trait.
|
||||
- Verified production build with `npm run build`.
|
||||
54. Disable kill rewards for elite-compressed combat (completed)
|
||||
- Added `COMBAT.KILL_REWARD_ENABLED = false` and skipped the heal/growth reward path after kills while retaining kill logs, death statistics, and match resolution.
|
||||
- Updated the battle-tip message and documentation so the UI no longer advertises inactive heal or growth behavior.
|
||||
- Preserved the legacy reward function behind the explicit toggle for a future non-compressed mode.
|
||||
55. Fighter-domain elite configuration and melee-only elite spawns (completed)
|
||||
- Nested elite stack, appearance, HP, and range tuning under `FIGHTER.ELITE` so fighter-specific settings are keyed within the fighter domain.
|
||||
- Added setup-aware skin selection so elite plans use only melee fighter profiles while normal plans continue to use the complete manifest.
|
||||
- Preserved the current elite HP ratio setting while moving the configuration.
|
||||
56. Configurable elite speed and randomized large-team compression (completed)
|
||||
- Added `FIGHTER.ELITE.TYPE`, attack/movement speed constants, and randomized compression tuning under the fighter domain.
|
||||
- Kept fixed compression below the configured threshold, while eligible teams roll each 100-member block against a configured 60% elite probability.
|
||||
- Preserved represented population by leaving failed elite blocks as normal fighters; before large-battle probability tuning, a `*4000` team targeted an average of `24 elite` representing 2,400 fighters plus `1,600 normal` fighters.
|
||||
57. Elite and normal composition in team cards (completed)
|
||||
- Replaced the represented-population total in each team card with living physical composition in `E : <elite> | N : <normal>` format.
|
||||
- Kept `stackCount` population weighting for combat-side statistics and targeting while exposing the actual rendered mix in the HUD.
|
||||
- Adjusted desktop and mobile team card sizing so large normal counts remain readable.
|
||||
58. Configurable elite attack-damage bonus (completed)
|
||||
- Added elite attack-damage bonus multiplier and stack-exponent settings beside existing elite speed settings.
|
||||
- Changed elite bonus multiplier semantics so `0` disables an added stack bonus and `1` applies the configured stack curve, consistently for damage and speeds.
|
||||
59. Configurable elite magic attack-effect scale (completed)
|
||||
- Added `FIGHTER.ATTACK_EFFECT_SCALE_MULTIPLIER` and `FIGHTER.ELITE.ATTACK_EFFECT_SCALE_MULTIPLIER`.
|
||||
- Updated instant-spell attack effects so normal magic effects use the base multiplier and elite magic effects apply the elite multiplier on top.
|
||||
- Updated elite/combat/context documentation for magic-enabled elite skin selection and effect-scale tuning.
|
||||
60. Large-battle elite block probability (completed)
|
||||
- Added `FIGHTER.ELITE.RANDOMIZED_COMPRESSION.LARGE_BATTLE_ELITE_BLOCK_PROBABILITY = 0.8`.
|
||||
- Updated match setup so randomized elite compression uses the large-battle probability when the user-entered total fighter count is greater than `PERFORMANCE.LARGE_BATTLE_FIGHTER_THRESHOLD`.
|
||||
- Kept the probability under `FIGHTER.ELITE` while reusing the existing performance threshold constant.
|
||||
61. Remove zoom-visible battlefield name labels (completed)
|
||||
- Removed pooled Phaser text labels from fighter HUD slots.
|
||||
- Kept pooled health bars for selected and zoom-visible fighters while relying on team-colored shadows for identity.
|
||||
- Updated HUD documentation to describe health-bar-only field HUDs.
|
||||
62. Large-battle rendered fighter budget (completed)
|
||||
- Added `PERFORMANCE.LARGE_BATTLE_RENDERED_FIGHTER_LIMIT = 1200`.
|
||||
- Changed match setup to build randomized elite rosters first, then promote failed normal 100-member blocks or normal remainder groups until physical fighter plans fit within the large-battle render budget.
|
||||
- Preserved represented `stackCount` totals so statistics, spectator weighting, and world-effect density still reflect the full requested population.
|
||||
|
|
|
|||
Loading…
Reference in New Issue