@jcendal/opencode-digital-pet 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +2 -2
- package/dist/adapters/opencode/create-server-hooks.d.ts +5 -5
- package/dist/adapters/opencode/usage-event-mapper.d.ts +1 -1
- package/dist/adapters/sqlite/sqlite-digital-pet-archive-reader.d.ts +1 -1
- package/dist/adapters/sqlite/sqlite-digital-pet-write-store.d.ts +2 -2
- package/dist/adapters/sqlite/sqlite-sidebar-snapshot-reader.d.ts +1 -1
- package/dist/dev/attach-dev-tools.js +1327 -7
- package/dist/digital-pet-animation/constants/evolution-battle.d.ts +2 -2
- package/dist/digital-pet-animation/sequences/evolution-battle-artwork.d.ts +5 -8
- package/dist/digital-pet-animation/sessions/evolution-battle-session.d.ts +1 -1
- package/dist/digital-pet-animation/sessions/evolution-presentation.d.ts +14 -0
- package/dist/digital-pet-animation/sessions/presentation-state.d.ts +1 -1
- package/dist/digital-pet-core/adapters/sqlite/sqlite-digital-pet-types.d.ts +2 -2
- package/dist/digital-pet-core/application/use-cases/resolve-evolution-battle.d.ts +1 -1
- package/dist/digital-pet-core/application/use-cases/spawn-partner.d.ts +1 -1
- package/dist/digital-pet-core/data/combat-stats.d.ts +3 -0
- package/dist/digital-pet-core/data/stages.d.ts +2 -2
- package/dist/digital-pet-core/domain/combat.d.ts +28 -0
- package/dist/digital-pet-core/domain/digimon-node.d.ts +2 -0
- package/dist/digital-pet-core/domain/evolution-battle.d.ts +2 -0
- package/dist/digital-pet-core/domain/feeding.d.ts +14 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1690 -370
- package/dist/tui/digital-pet-command-layer.d.ts +1 -1
- package/dist/tui/digital-pet-dex-dialog.d.ts +2 -1
- package/dist/tui/digital-pet-history-dialog.d.ts +2 -1
- package/dist/tui/sidebar-card.d.ts +2 -2
- package/dist/tui.d.ts +5 -5
- package/dist/tui.js +9822 -8482
- package/package.json +7 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const EVOLUTION_BATTLE_HITS_TO_WIN
|
|
2
|
-
export declare const EVOLUTION_BATTLE_MAX_SHOTS
|
|
1
|
+
export declare const EVOLUTION_BATTLE_HITS_TO_WIN: 3;
|
|
2
|
+
export declare const EVOLUTION_BATTLE_MAX_SHOTS: 24;
|
|
3
3
|
export declare const BATTLE_GAP_COLUMNS = 12;
|
|
4
4
|
export declare const BATTLE_SCORE_HIT_PIP = "\u2588";
|
|
5
5
|
export declare const BATTLE_SCORE_MISS_PIP = "\u2591";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { MonsterFrameCatalog } from "../../digital-pet-core/data/monster-frame-catalog.js";
|
|
2
|
+
import type { BattleOutcome, BattlePlan, BattleShot, BattleSide } from "../../digital-pet-core/domain/combat.js";
|
|
2
3
|
/** FIGlet-style BATTLE banner. */
|
|
3
4
|
export declare const BATTLE_FIGLET_LINES: readonly string[];
|
|
4
5
|
export declare const buildBattleIntroTextLines: () => readonly string[];
|
|
5
6
|
/** Block-style flame sprite matching Digimon ASCII art. */
|
|
6
7
|
export declare const FIREBALL_LINES: readonly string[];
|
|
7
|
-
export type EvolutionBattleShooter =
|
|
8
|
-
export type EvolutionBattleOutcome =
|
|
8
|
+
export type EvolutionBattleShooter = BattleSide;
|
|
9
|
+
export type EvolutionBattleOutcome = BattleOutcome;
|
|
9
10
|
export type BattleSpritePose = "attack" | "injured" | "happy" | "idle";
|
|
10
11
|
export type EvolutionBattleResultLabel = "hit" | "miss" | null;
|
|
11
12
|
/** Scores and caption accompanying the shared frame; frontends choose their HUD style. */
|
|
@@ -20,10 +21,7 @@ export type BattleFrameHud = {
|
|
|
20
21
|
readonly captionRow: number;
|
|
21
22
|
};
|
|
22
23
|
export type BattleFrameListener = (artwork: string, hud?: BattleFrameHud) => Promise<void>;
|
|
23
|
-
export type EvolutionBattleShot =
|
|
24
|
-
readonly shooter: EvolutionBattleShooter;
|
|
25
|
-
readonly hit: boolean;
|
|
26
|
-
};
|
|
24
|
+
export type EvolutionBattleShot = BattleShot;
|
|
27
25
|
export type EvolutionBattleScene = {
|
|
28
26
|
readonly shooter: EvolutionBattleShooter | null;
|
|
29
27
|
readonly progress: number;
|
|
@@ -38,8 +36,7 @@ export type EvolutionBattleScene = {
|
|
|
38
36
|
};
|
|
39
37
|
export declare const buildBattleScorePips: (hits: number, total?: number) => string;
|
|
40
38
|
export declare const buildBattleScoreRow: (playerHits: number, opponentHits: number, width?: number) => string;
|
|
41
|
-
export declare const planEvolutionBattle: (outcome: EvolutionBattleOutcome, random?: () => number) => readonly EvolutionBattleShot[];
|
|
42
39
|
export declare const defaultBattleScene: (overrides?: Partial<EvolutionBattleScene>) => EvolutionBattleScene;
|
|
43
40
|
export declare const renderBattleIntroArtwork: (viewportWidth: number, _progress: number, tick?: number) => string;
|
|
44
41
|
export declare const renderEvolutionBattleArtwork: (catalog: MonsterFrameCatalog, playerSprite: string, opponentSprite: string, scene: EvolutionBattleScene, viewportWidth: number) => string;
|
|
45
|
-
export declare const runEvolutionBattleAnimation: (catalog: MonsterFrameCatalog, playerSprite: string, opponentSprite: string, viewportWidth: number,
|
|
42
|
+
export declare const runEvolutionBattleAnimation: (catalog: MonsterFrameCatalog, playerSprite: string, opponentSprite: string, viewportWidth: number, plan: BattlePlan, onFrame: BattleFrameListener) => Promise<EvolutionBattleOutcome>;
|
|
@@ -3,7 +3,7 @@ import type { SidebarSnapshot } from "../../digital-pet-core/application/ports/s
|
|
|
3
3
|
import { type EvolutionBattleRepository } from "../../digital-pet-core/application/use-cases/resolve-evolution-battle.js";
|
|
4
4
|
import type { DigimonCatalog } from "../../digital-pet-core/data/catalog.js";
|
|
5
5
|
import type { MonsterFrameCatalog } from "../../digital-pet-core/data/monster-frame-catalog.js";
|
|
6
|
-
import {
|
|
6
|
+
import type { BattleFrameListener } from "../sequences/evolution-battle-artwork.js";
|
|
7
7
|
import type { PresentationStateListener } from "./presentation-state.js";
|
|
8
8
|
export type EvolutionBattleSessionDependencies = {
|
|
9
9
|
readonly frameCatalog: MonsterFrameCatalog;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MonsterFrameCatalog } from "../../digital-pet-core/data/monster-frame-catalog.js";
|
|
2
|
+
import { type BattleOutcome } from "../../digital-pet-core/domain/combat.js";
|
|
3
|
+
import type { DigimonCatalog } from "../../digital-pet-core/domain/digimon-node.js";
|
|
4
|
+
import { type BattleFrameListener } from "../sequences/evolution-battle-artwork.js";
|
|
5
|
+
import type { PresentationStateListener } from "./presentation-state.js";
|
|
6
|
+
export type EvolutionPresentationDependencies = {
|
|
7
|
+
readonly digimonCatalog: DigimonCatalog;
|
|
8
|
+
readonly frameCatalog: MonsterFrameCatalog;
|
|
9
|
+
readonly onArtwork: BattleFrameListener;
|
|
10
|
+
readonly onState?: PresentationStateListener;
|
|
11
|
+
readonly random?: () => number;
|
|
12
|
+
};
|
|
13
|
+
/** Presentation has no storage dependency; each host commits the result after it completes. */
|
|
14
|
+
export declare const presentEvolution: (fromNodeId: string, targetNodeId: string, opponentNodeId: string | null, width: number, dependencies: EvolutionPresentationDependencies) => Promise<BattleOutcome>;
|
|
@@ -10,7 +10,7 @@ export type PresentationState = {
|
|
|
10
10
|
readonly fromNodeId: string;
|
|
11
11
|
readonly toNodeId: string;
|
|
12
12
|
} | {
|
|
13
|
-
readonly phase: "defeated";
|
|
13
|
+
readonly phase: "defeated" | "draw" | "feeding";
|
|
14
14
|
readonly fromNodeId: string;
|
|
15
15
|
};
|
|
16
16
|
export type PresentationStateListener = (state: PresentationState) => Promise<void>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Partner, PartnerProgression } from "../../domain/partner.js";
|
|
2
1
|
import type { SpawnPartnerInput } from "../../application/models/spawn-partner.js";
|
|
3
2
|
import type { ApplyUsageReceiptOutcome, ResolveEvolutionBattleOutcome, UsageReceiptMetadata } from "../../application/models/usage.js";
|
|
3
|
+
import type { DigitalPetControl } from "../../application/ports/digital-pet-control.js";
|
|
4
4
|
import type { PartnerLifecycle } from "../../application/ports/partner-lifecycle.js";
|
|
5
5
|
import type { UsageLedger } from "../../application/ports/usage-ledger.js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { Partner, PartnerProgression } from "../../domain/partner.js";
|
|
7
7
|
export type PersistedPartner = Partner;
|
|
8
8
|
export type PersistedPartnerEventKind = "spawned" | "usage_applied" | "retired";
|
|
9
9
|
export type PersistedPartnerEvent = {
|
|
@@ -5,4 +5,4 @@ export type EvolutionBattleRepository = {
|
|
|
5
5
|
getActivePartner: () => Partner | null;
|
|
6
6
|
resolveEvolutionBattle: (nextState: import("../../domain/partner.js").PartnerProgression, createdAt: string) => ResolveEvolutionBattleOutcome;
|
|
7
7
|
};
|
|
8
|
-
export declare const resolveEvolutionBattleForPartner: (repository: EvolutionBattleRepository, won: boolean, digimonById: ReadonlyMap<string, DigimonNode>, createdAt: string) => ResolveEvolutionBattleOutcome;
|
|
8
|
+
export declare const resolveEvolutionBattleForPartner: (repository: EvolutionBattleRepository, won: boolean, digimonById: ReadonlyMap<string, DigimonNode>, createdAt: string, expected?: Pick<Partner, "partnerId" | "currentNodeId" | "pendingEvolutionTargetId" | "battleOpponentNodeId">) => ResolveEvolutionBattleOutcome;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PartnerLifecycle } from "../ports/partner-lifecycle.js";
|
|
2
1
|
import type { SpawnPartnerResult } from "../models/spawn-partner.js";
|
|
2
|
+
import type { PartnerLifecycle } from "../ports/partner-lifecycle.js";
|
|
3
3
|
export declare const spawnPartner: (lifecycle: PartnerLifecycle, createdAt: string) => SpawnPartnerResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StageLabels, StageThresholdKey } from "../config/types.js";
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { type DigimonStage, isDigimonStage } from "../domain/stage.js";
|
|
3
|
+
export { type DigimonStage, isDigimonStage };
|
|
4
4
|
export declare const STAGE_VALUES: readonly [0, 1, 2, 3, 4, 5, 6, 7];
|
|
5
5
|
export declare const STAGE_THRESHOLD_KEYS: {
|
|
6
6
|
readonly 0: "egg";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Game balance, shared by every host. Strength controls accuracy, not damage. */
|
|
2
|
+
export type CombatStats = {
|
|
3
|
+
readonly strength: number;
|
|
4
|
+
readonly evasion: number;
|
|
5
|
+
};
|
|
6
|
+
export type BattleSide = "player" | "opponent";
|
|
7
|
+
export type BattleOutcome = BattleSide | "draw";
|
|
8
|
+
export type BattleShot = {
|
|
9
|
+
readonly shooter: BattleSide;
|
|
10
|
+
readonly hit: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type BattlePlan = {
|
|
13
|
+
readonly shots: readonly BattleShot[];
|
|
14
|
+
readonly outcome: BattleOutcome;
|
|
15
|
+
};
|
|
16
|
+
export declare const COMBAT_POLICY: Readonly<{
|
|
17
|
+
hitsToWin: 3;
|
|
18
|
+
maxShots: 24;
|
|
19
|
+
scale: 25;
|
|
20
|
+
minimum: 0.05;
|
|
21
|
+
maximum: 0.95;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const NEUTRAL_COMBAT_STATS: CombatStats;
|
|
24
|
+
export declare const validateCombatStats: (stats: CombatStats) => CombatStats;
|
|
25
|
+
/** Logistic opposed check: equal scores give 50%; extremes never guarantee a hit or miss. */
|
|
26
|
+
export declare const hitProbability: (attacker: CombatStats, defender: CombatStats) => number;
|
|
27
|
+
/** The winner emerges from real hit rolls. A time limit without three hits is a draw. */
|
|
28
|
+
export declare const planCombat: (player: CombatStats, opponent: CombatStats, random?: () => number) => BattlePlan;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CombatStats } from "./combat.js";
|
|
1
2
|
import type { DigimonStage } from "./stage.js";
|
|
2
3
|
export type DigimonNode = {
|
|
3
4
|
readonly id: string;
|
|
@@ -7,6 +8,7 @@ export type DigimonNode = {
|
|
|
7
8
|
readonly sprite: string;
|
|
8
9
|
readonly stage: DigimonStage;
|
|
9
10
|
readonly url: string;
|
|
11
|
+
readonly combatStats: CombatStats;
|
|
10
12
|
};
|
|
11
13
|
export type DigimonCatalog = {
|
|
12
14
|
readonly nodes: readonly DigimonNode[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { DigimonNode } from "./digimon-node.js";
|
|
2
2
|
import type { EvolutionSelector } from "./evolution.js";
|
|
3
|
+
export declare const isEvolutionBranch: (current: DigimonNode, targetId: string) => boolean;
|
|
4
|
+
export declare const assertEvolutionBranch: (current: DigimonNode, targetId: string) => void;
|
|
3
5
|
export declare const pickEvolutionTarget: (current: DigimonNode, selector: EvolutionSelector) => string;
|
|
4
6
|
export declare const pickRandomSameStageOpponent: (current: DigimonNode, catalogNodes: readonly DigimonNode[], selector: EvolutionSelector) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const FEEDING_POLICY: Readonly<{
|
|
2
|
+
intervalMs: number;
|
|
3
|
+
experienceFraction: 0.25;
|
|
4
|
+
}>;
|
|
5
|
+
export type FoodState = {
|
|
6
|
+
readonly kind: "scheduled";
|
|
7
|
+
readonly availableAt: number;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: "available";
|
|
10
|
+
};
|
|
11
|
+
export declare const scheduleFood: (now: number) => FoodState;
|
|
12
|
+
/** Available food has no clock. Missed intervals never accumulate more food. */
|
|
13
|
+
export declare const advanceFood: (food: FoodState | undefined, isEgg: boolean, now: number) => FoodState | undefined;
|
|
14
|
+
export declare const feedingExperience: (gauge: number, threshold: number) => number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
2
|
-
export { createCommandConfig } from "./adapters/opencode/create-server-hooks.js";
|
|
3
|
-
export { DIGIMON_DATA } from "./digital-pet-core/data/digimon-data.js";
|
|
4
2
|
export type { DigimonId, DigimonRecord, DigimonStage } from "./digital-pet-core/data/digimon-data.js";
|
|
3
|
+
export { DIGIMON_DATA } from "./digital-pet-core/data/digimon-data.js";
|
|
4
|
+
export { createCommandConfig } from "./adapters/opencode/create-server-hooks.js";
|
|
5
5
|
export declare const plugin: Plugin;
|
|
6
6
|
declare const entryPlugin: {
|
|
7
7
|
readonly id: "opencode-digital-pet";
|