Release Healer Man 0.1.29
This commit is contained in:
1 parent
8c9809d3e0
commit
544c1bee91
120 files changed
+4363
-1036
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import type { CharacterProfile } from "../app/types";
|
||||
import type { ArenaActorSnapshot, ArenaAuthoritativeSnapshot } from "./arenaTypes";
|
||||
|
||||
export function controlledArenaActor(snapshot: ArenaAuthoritativeSnapshot | null, character: Pick<CharacterProfile, "id"> | null): ArenaActorSnapshot | null {
|
||||
if (!snapshot) return null;
|
||||
return snapshot.actors.find((actor) => actor.id === snapshot.controlledActorId)
|
||||
?? snapshot.actors.find((actor) => character && actor.characterId === character.id && !actor.isBot)
|
||||
?? (snapshot.mode === "practice" ? snapshot.actors.find((actor) => actor.id === "practice-player") : null)
|
||||
?? null;
|
||||
}
|
||||
|
||||
export function arenaTargetActor(snapshot: ArenaAuthoritativeSnapshot | null, id: string | null): ArenaActorSnapshot | null {
|
||||
const player = snapshot?.actors.find((actor) => actor.id === id);
|
||||
if (player) return player;
|
||||
for (const owner of snapshot?.actors ?? []) {
|
||||
const summon = owner.combat?.summons.find((entry) => entry.id === id);
|
||||
if (summon) return { ...owner, id: summon.id, name: summon.name, position: summon.position,
|
||||
health: summon.health, maxHealth: summon.maxHealth, alive: summon.health > 0 };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function arenaIntentFeedback(reason?: string): string {
|
||||
return ({
|
||||
"preparation": "Wait for the gates to open.", "invalid-target": "Select a living target.",
|
||||
"out-of-range": "Target is out of range.", "line-of-sight": "Target is out of sight.",
|
||||
"resource": "Not enough resource.", "cooldown": "Ability is not ready yet.",
|
||||
"already-casting": "Already casting.", "moving": "Stop moving to cast.",
|
||||
"controlled": "You cannot cast while controlled or silenced.", "not-learned": "That ability is not learned by this character.",
|
||||
"not-facing": "Face your target.", "must-be-behind": "Move behind your target.",
|
||||
"invalid-destination": "Choose a reachable location in range.", "insufficient-resource": "Not enough resource.",
|
||||
"school-locked": "That spell school is locked.", "player-controlled": "You cannot act while controlled.",
|
||||
"actor-unavailable": "You cannot act right now.",
|
||||
} as Record<string, string>)[reason ?? ""] ?? "Unable to use that ability.";
|
||||
}
|
||||
Reference in new issue
Block a user