Add more stats, crit/block/accuracy/dodge/lifesteal
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Phaser from "phaser";
|
||||
import { type World, type EntityId, type Stats } from "../core/types";
|
||||
import { type World, type EntityId, type Stats, type CombatantActor } from "../core/types";
|
||||
import { GAME_CONFIG } from "../core/config/GameConfig";
|
||||
|
||||
export default class GameUI extends Phaser.Scene {
|
||||
@@ -555,8 +555,8 @@ export default class GameUI extends Phaser.Scene {
|
||||
}
|
||||
|
||||
private updateCharacterUI(world: World, playerId: EntityId) {
|
||||
const p = world.actors.get(playerId);
|
||||
if (!p || !p.stats) return;
|
||||
const p = world.actors.get(playerId) as CombatantActor;
|
||||
if (!p || p.category !== "combatant" || !p.stats) return;
|
||||
|
||||
const s = p.stats;
|
||||
this.attrText.setText(`STR: ${s.strength}\nDEX: ${s.dexterity}\nINT: ${s.intelligence}`);
|
||||
@@ -571,14 +571,22 @@ export default class GameUI extends Phaser.Scene {
|
||||
`Defense: ${s.defense}`,
|
||||
`Speed: ${p.speed}`,
|
||||
"",
|
||||
`Accuracy: ${s.accuracy}%`,
|
||||
`Crit Chance: ${s.critChance}%`,
|
||||
`Crit Mult: ${s.critMultiplier}%`,
|
||||
`Evasion: ${s.evasion}%`,
|
||||
`Block: ${s.blockChance}%`,
|
||||
`Lifesteal: ${s.lifesteal}%`,
|
||||
`Luck: ${s.luck}`,
|
||||
"",
|
||||
`Passive Nodes: ${s.passiveNodes.length > 0 ? s.passiveNodes.join(", ") : "(none)"}`
|
||||
];
|
||||
this.charStatsText.setText(statsLines.join("\n"));
|
||||
}
|
||||
|
||||
private updateInventoryUI(world: World, playerId: EntityId) {
|
||||
const p = world.actors.get(playerId);
|
||||
if (!p) return;
|
||||
const p = world.actors.get(playerId) as CombatantActor;
|
||||
if (!p || p.category !== "combatant") return;
|
||||
|
||||
// Clear existing item icons/text from slots if needed (future refinement)
|
||||
// For now we just show names or placeholders
|
||||
@@ -588,8 +596,8 @@ export default class GameUI extends Phaser.Scene {
|
||||
this.floorText.setText(`Floor ${floorIndex}`);
|
||||
|
||||
|
||||
const p = world.actors.get(playerId);
|
||||
if (!p || !p.stats) return;
|
||||
const p = world.actors.get(playerId) as CombatantActor;
|
||||
if (!p || p.category !== "combatant" || !p.stats) return;
|
||||
|
||||
const barX = 40;
|
||||
const barY = 40;
|
||||
@@ -655,9 +663,10 @@ export default class GameUI extends Phaser.Scene {
|
||||
private updateMenuText(world: World, playerId: EntityId, _floorIndex: number) {
|
||||
|
||||
|
||||
const p = world.actors.get(playerId);
|
||||
const stats = p?.stats;
|
||||
const inv = p?.inventory;
|
||||
const p = world.actors.get(playerId) as CombatantActor;
|
||||
if (!p || p.category !== "combatant") return;
|
||||
const stats = p.stats;
|
||||
const inv = p.inventory;
|
||||
|
||||
const lines: string[] = [];
|
||||
lines.push(`Level ${stats?.level ?? 1}`);
|
||||
@@ -668,6 +677,10 @@ export default class GameUI extends Phaser.Scene {
|
||||
lines.push(` Attack: ${stats?.attack ?? 0}`);
|
||||
lines.push(` Defense: ${stats?.defense ?? 0}`);
|
||||
lines.push(` Speed: ${p?.speed ?? 0}`);
|
||||
lines.push(` Crit: ${stats?.critChance ?? 0}%`);
|
||||
lines.push(` Crit x: ${stats?.critMultiplier ?? 0}%`);
|
||||
lines.push(` Accuracy: ${stats?.accuracy ?? 0}%`);
|
||||
lines.push(` Evasion: ${stats?.evasion ?? 0}%`);
|
||||
|
||||
lines.push("");
|
||||
lines.push("Inventory");
|
||||
|
||||
Reference in New Issue
Block a user