Add panacea status cure item

This commit is contained in:
2026-06-18 10:02:57 +09:00
parent 23642a14e1
commit dcf45a3cd1
15 changed files with 35 additions and 16 deletions

View File

@@ -15,7 +15,7 @@ Godot 4 tactical RPG prototype inspired by classic turn-based Romance of the Thr
- Terrain defense and avoid affect physical attack damage and hit chance.
- Min/max attack ranges and counterattack forecasts.
- MP tactics with low/high damage options, healing options, ally support buffs, enemy debuffs, poison damage-over-time, tactic seal, a skill list menu, previews, and target overlays.
- Campaign inventory consumables with an item menu, HP/MP recovery and status-cure previews, and target overlay.
- Campaign inventory consumables with an item menu, HP/MP recovery, poison/seal cure previews, and target overlay.
- Weapon, armor, and accessory rewards can be stored, displayed, and equipped from the battle HUD.
- Scenario-specific pre-battle shop purchases, optional finite shop stock, and 50% sell-back save immediately and sync into the upcoming battle inventory.
- Pre-battle Armory equipment changes save immediately and sync roster equipment plus inventory stock.

View File

@@ -109,6 +109,18 @@
"effects": [{ "type": "cure_status", "status": "poison" }],
"price": 70
},
"panacea": {
"name": "Panacea",
"kind": "consumable",
"target": "ally",
"range": [0, 1],
"uses": 1,
"effects": [
{ "type": "cure_status", "status": "poison" },
{ "type": "cure_status", "status": "seal" }
],
"price": 140
},
"wine": {
"name": "Wine",
"kind": "consumable",

View File

@@ -39,6 +39,7 @@
"items": [
"bean",
"antidote",
"panacea",
"wine",
"iron_sword",
"training_spear",

View File

@@ -39,6 +39,7 @@
"items": [
"bean",
"antidote",
"panacea",
"wine",
"iron_sword",
"training_spear",

View File

@@ -24,6 +24,7 @@
"shop": {
"items": [
"bean",
"panacea",
"wine",
"iron_sword",
"training_spear",

View File

@@ -38,6 +38,7 @@
"items": [
"bean",
"antidote",
"panacea",
"wine",
"iron_sword",
"training_spear",

View File

@@ -44,6 +44,7 @@
"items": [
"bean",
"antidote",
"panacea",
"wine",
"iron_sword",
"training_spear",

View File

@@ -43,6 +43,7 @@
"shop": {
"items": [
"bean",
"panacea",
"wine",
"iron_sword",
"training_spear",

View File

@@ -37,6 +37,7 @@
"shop": {
"items": [
"bean",
"panacea",
"wine",
"iron_sword",
"training_spear",

View File

@@ -37,6 +37,7 @@
"shop": {
"items": [
"bean",
"panacea",
"wine",
"iron_sword",
"training_spear",

View File

@@ -56,7 +56,7 @@
Joined officers gate whether `requires_joined` player deployments are loaded at all. Rewards and post-battle choices can add or remove joined officers without deleting their saved roster snapshot, so a later rejoin can preserve progression. When a save loads, `CampaignState` scans completed scenarios in campaign order and reapplies only officer join/leave transitions from rewards and the saved `applied_post_battle_choices` ledger, allowing added recruitment rewards to reach older saves without replaying gold or items. Old saves without the ledger can backfill a choice id only when exactly one completed scenario choice matches saved flags. Roster entries are keyed by `officer_id` when available, so future scenarios can deploy the same joined officer under different scenario-specific `unit_id` values. Saved progression overlays final battle stats for now; a later equipment refactor should split base stats from equipment bonuses before adding item leveling or stat recalculation. New battles currently start player units healed to their saved maximum HP/MP. Skill access is carried in roster snapshots, with class defaults still applied for old saves that do not include skills. Promoted class ids are saved in the roster, and the next battle rehydrates class-derived movement, growth, skills, and range from the saved class id before equipment range is recalculated.
Inventory and campaign flags are copied from `CampaignState` into `BattleState` when a scenario starts. The pre-battle Chapters overview reads `CampaignState` chapter progress and can load completed or current battles without mutating the save. The pre-battle Save menu can write the current campaign state to `user://campaign_manual_save.json`, and loading that checkpoint restores it into `user://campaign_save.json` before re-entering the same pending-choice, completion, or current-briefing branch as startup. Pre-battle shop stock comes from the loaded scenario's `shop.items` list plus matching `shop.conditional_items` blocks, with optional finite limits from item entries or `stock` maps. Shop purchases and 50% sell-back are campaign transactions: they update saved gold, unequipped inventory, and finite-stock purchase counts immediately, write the save file, and refresh the already-loaded battle inventory before the player begins the battle. Pre-battle Armory equipment changes use the same equipment rules as battle HUD equipment changes, then immediately save merged roster equipment/stat snapshots and inventory stock. Pre-battle Roster uses scenario `roster.max_units`, `roster.required_officers`, and `roster.required_units` to mark optional player deployments as sortie or reserve; reserve units remain in the candidate list but are excluded from board occupancy, drawing, selection, AI targeting, and living-unit victory checks. Non-controllable player units can act as protected escort targets: enemies can attack them and conditions can reference them, but they are skipped by player selection, Armory, Formation, counterattacks, and campaign roster progression snapshots when `persist_progression` is false. Scenario `ai_target_priority` nudges enemy movement and damage-skill scoring toward important targets such as envoys without overriding defeat bonuses or range checks. Pre-battle Formation uses the loaded scenario's `formation.cells` and only mutates current battle unit positions before battle-begin events fire. Destination victory cells from `unit_reaches_tile` conditions are exposed to the scene for objective overlays and tile info. Movement-triggered `unit_reaches_tile` events receive the unit that just moved, so ambushes fire on entry rather than from units already standing on a marker. Briefing data can append matching `briefing.conditional_lines`, and scenario events can use `when.campaign_flags` to branch dialogue, objective changes, and reinforcements from saved campaign choices. Consumable use can restore HP or MP or cure matching damage-over-time statuses, and in-battle item use plus equipment swaps mutate only the battle copy until victory; defeats and restarts do not spend saved items or preserve in-battle gear changes. Post-battle choices write campaign `flags` only after the result-panel button is pressed; if the player reloads after rewards are saved but before selecting, the pending scenario id restores the victory choice panel without replaying rewards. The next battle button stays locked until the campaign choice save succeeds. Equipment rewards share the same `item_id -> count` inventory stock, cover weapon, armor, and accessory slots, can be equipped from the side HUD before the selected unit moves or acts, and do not appear in the consumable action menu. Already completed scenarios can be replayed without granting duplicate rewards, choices, replay inventory consumption, save writes, current-scenario advancement, or finite-stock purchases; pre-battle Shop, Armory, Roster, Formation, and Save are disabled on completed-scenario replays to avoid side effects.
Inventory and campaign flags are copied from `CampaignState` into `BattleState` when a scenario starts. The pre-battle Chapters overview reads `CampaignState` chapter progress and can load completed or current battles without mutating the save. The pre-battle Save menu can write the current campaign state to `user://campaign_manual_save.json`, and loading that checkpoint restores it into `user://campaign_save.json` before re-entering the same pending-choice, completion, or current-briefing branch as startup. Pre-battle shop stock comes from the loaded scenario's `shop.items` list plus matching `shop.conditional_items` blocks, with optional finite limits from item entries or `stock` maps. Shop purchases and 50% sell-back are campaign transactions: they update saved gold, unequipped inventory, and finite-stock purchase counts immediately, write the save file, and refresh the already-loaded battle inventory before the player begins the battle. Pre-battle Armory equipment changes use the same equipment rules as battle HUD equipment changes, then immediately save merged roster equipment/stat snapshots and inventory stock. Pre-battle Roster uses scenario `roster.max_units`, `roster.required_officers`, and `roster.required_units` to mark optional player deployments as sortie or reserve; reserve units remain in the candidate list but are excluded from board occupancy, drawing, selection, AI targeting, and living-unit victory checks. Non-controllable player units can act as protected escort targets: enemies can attack them and conditions can reference them, but they are skipped by player selection, Armory, Formation, counterattacks, and campaign roster progression snapshots when `persist_progression` is false. Scenario `ai_target_priority` nudges enemy movement and damage-skill scoring toward important targets such as envoys without overriding defeat bonuses or range checks. Pre-battle Formation uses the loaded scenario's `formation.cells` and only mutates current battle unit positions before battle-begin events fire. Destination victory cells from `unit_reaches_tile` conditions are exposed to the scene for objective overlays and tile info. Movement-triggered `unit_reaches_tile` events receive the unit that just moved, so ambushes fire on entry rather than from units already standing on a marker. Briefing data can append matching `briefing.conditional_lines`, and scenario events can use `when.campaign_flags` to branch dialogue, objective changes, and reinforcements from saved campaign choices. Consumable use can restore HP or MP or cure matching poison/seal statuses, and in-battle item use plus equipment swaps mutate only the battle copy until victory; defeats and restarts do not spend saved items or preserve in-battle gear changes. Post-battle choices write campaign `flags` only after the result-panel button is pressed; if the player reloads after rewards are saved but before selecting, the pending scenario id restores the victory choice panel without replaying rewards. The next battle button stays locked until the campaign choice save succeeds. Equipment rewards share the same `item_id -> count` inventory stock, cover weapon, armor, and accessory slots, can be equipped from the side HUD before the selected unit moves or acts, and do not appear in the consumable action menu. Already completed scenarios can be replayed without granting duplicate rewards, choices, replay inventory consumption, save writes, current-scenario advancement, or finite-stock purchases; pre-battle Shop, Armory, Roster, Formation, and Save are disabled on completed-scenario replays to avoid side effects.
The battle scene owns presentation feedback: briefing and result states use menu BGM, briefing headers combine `CampaignState` chapter ranges, campaign order, and title data with `BattleState` briefing and objective text, active battles use battle BGM, dialogue lines can show optional portrait textures or speaker-initial fallback panels and can place the portrait on the left or right side of the dialogue panel, board units render low-HP warning rings, HP bar color states, and active support/debuff/poison/seal status pips from battle state fields, hover previews are rendered as target badges from existing `BattleState` forecast APIs, log/result hooks trigger placeholder SFX, support, debuff, poison, and seal effects use distinct floating feedback colors, `BattleState.unit_motion_requested` asks the scene to interpolate a unit's draw position during movement, and `BattleState.combat_feedback_requested` asks the scene to draw transient floating combat text without changing battle rules.

View File

@@ -302,18 +302,21 @@ Items start as static bonuses and consumable effects. Equipment leveling should
Weapon `range` also uses `[min, max]`. When class and equipment both provide range, the runtime unit keeps the lowest minimum and highest maximum. Accessories use `kind: "accessory"` with an `accessory_type` checked against the class `equipment_slots.accessory` list; `war_drum` and `imperial_seal` are the first branch-choice accessory rewards. Current equipment inventory is stackable stock only; unique equipment instances, durability, and enhancement are planned later. `war_axe` is a stronger axe reward for the Warrior/Bandit weapon family.
Consumables use `kind: "consumable"` with effect records. `heal_hp` restores HP, `heal_mp` restores MP, and `cure_status` removes matching damage-over-time status effects from a valid target; `Bean`, `Wine`, and `Antidote` are the first examples. Item use consumes the acting unit's action and only commits to the save file on victory. Weapons, armor, and accessories can be granted through `rewards.items`; they are shown in inventory, can be equipped through the Equip menu before the unit moves or acts, and are not usable from the battle item menu.
Consumables use `kind: "consumable"` with effect records. `heal_hp` restores HP, `heal_mp` restores MP, and `cure_status` removes active battle-only effects with a matching `status` from a valid target; `Bean`, `Wine`, `Antidote`, and `Panacea` are the first examples. Item use consumes the acting unit's action and only commits to the save file on victory. Weapons, armor, and accessories can be granted through `rewards.items`; they are shown in inventory, can be equipped through the Equip menu before the unit moves or acts, and are not usable from the battle item menu.
```json
{
"antidote": {
"name": "Antidote",
"panacea": {
"name": "Panacea",
"kind": "consumable",
"target": "ally",
"range": [0, 1],
"uses": 1,
"effects": [{ "type": "cure_status", "status": "poison" }],
"price": 70
"effects": [
{ "type": "cure_status", "status": "poison" },
{ "type": "cure_status", "status": "seal" }
],
"price": 140
}
}
```

View File

@@ -49,7 +49,7 @@ powershell -NoProfile -ExecutionPolicy Bypass -File tools\check_godot46_readines
- Poison Mist applies poison, poison ticks at the target team's phase start, and poison defeat immediately ends the battle when it satisfies a victory or defeat condition.
- Seal Tactic applies seal, prevents the affected unit from using tactics during its next action phase, and disables the tactic button with a sealed forecast/badge.
- Support, debuff, poison, and seal status pips appear on affected board units and disappear when those effects expire or are cured.
- Antidote can cure poison and does not consume stock when used on a target without a matching status.
- Antidote can cure poison, Panacea can cure poison or seal, and neither consumes stock when used on a target without a matching status.
- Enemy turn advances and AI acts.
- Victory and defeat panels still appear.
- Post-battle dialogue and post-battle choices still block progression until a choice is saved.

View File

@@ -33,7 +33,7 @@
- Equipment rewards can be stored, displayed, and swapped from the battle HUD.
- Terrain movement, defense, and avoid modifiers affect combat.
- Skills, tactics, and MP. Multiple single-target damage/heal tactics, ally support buffs, enemy debuffs, poison damage-over-time, tactic seal, a skill list menu with range/effect hints, and enemy tactic AI exist.
- Consumable item use. Basic global inventory, Bean HP recovery, Wine MP recovery, Antidote poison cure, item menu, preview, and target overlay exist.
- Consumable item use. Basic global inventory, Bean HP recovery, Wine MP recovery, Antidote poison cure, Panacea poison/seal cure, item menu, preview, and target overlay exist.
- Counterattacks exist. Battle-only support, debuff, damage-over-time, and first action-lock status effects exist; richer ailment/status families are still planned.
- Battle EXP, level-ups, class promotion, and campaign roster persistence exist.

View File

@@ -1831,11 +1831,7 @@ func _apply_item_status_cure(target: Dictionary, status: String) -> Array:
var kept_effects := []
for effect in _active_status_effects(target):
var effect_status := str(effect.get("status", "")).strip_edges().to_lower()
var effect_type := str(effect.get("type", ""))
var should_cure := (
effect_type == "damage_over_time"
and (normalized_status.is_empty() or effect_status == normalized_status)
)
var should_cure := not effect_status.is_empty() and (normalized_status.is_empty() or effect_status == normalized_status)
if should_cure:
var display_name := _status_display_name(str(effect.get("status", normalized_status)))
if not cured_statuses.has(display_name):
@@ -1879,9 +1875,9 @@ func _item_curable_status_names(target: Dictionary, item: Dictionary) -> Array:
continue
var status := str(effect.get("status", "")).strip_edges().to_lower()
for active_effect in _active_status_effects(target):
if str(active_effect.get("type", "")) != "damage_over_time":
continue
var active_status := str(active_effect.get("status", "")).strip_edges().to_lower()
if active_status.is_empty():
continue
if not status.is_empty() and active_status != status:
continue
var display_name := _status_display_name(str(active_effect.get("status", status)))