diff --git a/README.md b/README.md index 5ad7727..e419538 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ Godot 4 tactical RPG prototype inspired by classic turn-based Romance of the Thr - Damage forecast for selected-unit attacks. - 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, poison/seal cure previews, and target overlay. +- MP tactics with low/high damage options, healing options, ally support buffs, enemy debuffs, poison damage-over-time, seal/snare action locks, a skill list menu, previews, and target overlays. +- Campaign inventory consumables with an item menu, HP/MP recovery, poison/seal/snare 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. @@ -111,10 +111,10 @@ Godot 4 tactical RPG prototype inspired by classic turn-based Romance of the Thr - Dialogue portrait slot with officer default image paths, optional per-line overrides, and speaker-initial fallback. - Dialogue lines can place the portrait on the left or right side of the dialogue panel. - Placeholder menu/battle BGM plus UI, movement, attack, tactic, item, victory, and defeat SFX. -- Floating combat text for damage, recovery, misses, support effects, poison ticks, tactic seal, level-ups, and promotions. +- Floating combat text for damage, recovery, misses, support effects, poison ticks, action locks, level-ups, and promotions. - Short unit slide animation for board movement. - Hover target preview badges for attacks, tactics, and items. -- Low-HP board unit warning rings, HP bar color states, and board status pips for support, debuff, poison, and seal effects. +- Low-HP board unit warning rings, HP bar color states, and board status pips for support, debuff, poison, seal, and snare effects. - Data-driven scenario setup through JSON definitions and deployments. ## Run diff --git a/data/defs/classes.json b/data/defs/classes.json index 16559c0..b22fe07 100644 --- a/data/defs/classes.json +++ b/data/defs/classes.json @@ -160,7 +160,7 @@ "move_type": "foot", "move": 4, "attack_range": [1, 1], - "skills": ["spark", "fire_tactic", "mend", "guard_order", "rally_order", "disrupt_order", "poison_mist", "seal_tactic"], + "skills": ["spark", "fire_tactic", "mend", "guard_order", "rally_order", "disrupt_order", "poison_mist", "seal_tactic", "snare_tactic"], "growth": { "hp": "C", "mp": "A", "atk": "E", "def": "D", "int": "A", "agi": "C" }, "base_bonus": { "hp": -2, "mp": 8, "atk": -2, "def": -1, "int": 2 }, "equipment_slots": { @@ -176,7 +176,7 @@ "move_type": "foot", "move": 4, "attack_range": [1, 1], - "skills": ["spark", "fire_tactic", "mend", "great_mend", "guard_order", "rally_order", "disrupt_order", "poison_mist", "seal_tactic"], + "skills": ["spark", "fire_tactic", "mend", "great_mend", "guard_order", "rally_order", "disrupt_order", "poison_mist", "seal_tactic", "snare_tactic"], "growth": { "hp": "B", "mp": "A", "atk": "E", "def": "C", "int": "A", "agi": "C" }, "base_bonus": { "hp": 2, "mp": 6, "atk": -2, "def": 1, "int": 2 }, "equipment_slots": { diff --git a/data/defs/items.json b/data/defs/items.json index 82388da..8df4801 100644 --- a/data/defs/items.json +++ b/data/defs/items.json @@ -117,7 +117,8 @@ "uses": 1, "effects": [ { "type": "cure_status", "status": "poison" }, - { "type": "cure_status", "status": "seal" } + { "type": "cure_status", "status": "seal" }, + { "type": "cure_status", "status": "snare" } ], "price": 140 }, diff --git a/data/defs/skills.json b/data/defs/skills.json index e439c83..93e930c 100644 --- a/data/defs/skills.json +++ b/data/defs/skills.json @@ -103,5 +103,17 @@ "effects": [ { "type": "action_lock", "status": "seal", "action": "skill", "duration_turns": 2 } ] + }, + "snare_tactic": { + "name": "Snare Tactic", + "kind": "support", + "target": "enemy", + "mp_cost": 5, + "range": [1, 3], + "power": 0, + "stat": "int", + "effects": [ + { "type": "action_lock", "status": "snare", "action": "move", "duration_turns": 2 } + ] } } diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 0495b0b..f6fb0f8 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -56,8 +56,8 @@ 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 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. +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/snare 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. +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/snare 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, seal, and snare 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. The `New Campaign` button clears `user://campaign_save.json`, resets campaign state to the first scenario, and reloads the opening briefing. diff --git a/docs/DATA_MODEL.md b/docs/DATA_MODEL.md index 116787d..e3c0c5b 100644 --- a/docs/DATA_MODEL.md +++ b/docs/DATA_MODEL.md @@ -242,26 +242,26 @@ Skills define MP tactics. A class, officer, or scenario deployment can add skill } ``` -Support skills use an `effects` array. `stat_bonus` uses `stat` in `atk`, `def`, `int`, or `agi`, a non-zero `amount`, and positive `duration_turns`. Positive amounts are buffs and negative amounts are debuffs; both are battle-only and expire when the target's team begins enough future phases. `damage_over_time` uses a stable `status`, positive `amount`, and positive `duration_turns`; it ticks at the start of the target team's phase before expiration and can defeat units without awarding delayed defeat EXP. `action_lock` uses a stable `status`, an `action` of `skill`, and positive `duration_turns`; it blocks the affected unit from selecting or casting tactics while active. +Support skills use an `effects` array. `stat_bonus` uses `stat` in `atk`, `def`, `int`, or `agi`, a non-zero `amount`, and positive `duration_turns`. Positive amounts are buffs and negative amounts are debuffs; both are battle-only and expire when the target's team begins enough future phases. `damage_over_time` uses a stable `status`, positive `amount`, and positive `duration_turns`; it ticks at the start of the target team's phase before expiration and can defeat units without awarding delayed defeat EXP. `action_lock` uses a stable `status`, an `action` of `skill` or `move`, and positive `duration_turns`; it blocks the affected unit from selecting or casting tactics, or from moving, while active. ```json { - "seal_tactic": { - "name": "Seal Tactic", + "snare_tactic": { + "name": "Snare Tactic", "kind": "support", "target": "enemy", - "mp_cost": 6, + "mp_cost": 5, "range": [1, 3], "power": 0, "stat": "int", "effects": [ - { "type": "action_lock", "status": "seal", "action": "skill", "duration_turns": 2 } + { "type": "action_lock", "status": "snare", "action": "move", "duration_turns": 2 } ] } } ``` -The current single-target tactic set includes `spark`, `fire_tactic`, `blaze`, `mend`, `great_mend`, `guard_order`, `rally_order`, `disrupt_order`, `poison_mist`, and `seal_tactic`. Hero classes get low-cost Spark alongside Fire/Mend and ally orders, strategist classes also get Poison Mist and Seal Tactic, promoted command/advisor classes add Great Mend, and late scenario deployments can add stronger pressure skills such as Blaze without changing their base class. +The current single-target tactic set includes `spark`, `fire_tactic`, `blaze`, `mend`, `great_mend`, `guard_order`, `rally_order`, `disrupt_order`, `poison_mist`, `seal_tactic`, and `snare_tactic`. Hero classes get low-cost Spark alongside Fire/Mend and ally orders, strategist classes also get Poison Mist, Seal Tactic, and Snare Tactic, promoted command/advisor classes add Great Mend, and late scenario deployments can add stronger pressure skills such as Blaze without changing their base class. ## Terrain @@ -314,7 +314,8 @@ Consumables use `kind: "consumable"` with effect records. `heal_hp` restores HP, "uses": 1, "effects": [ { "type": "cure_status", "status": "poison" }, - { "type": "cure_status", "status": "seal" } + { "type": "cure_status", "status": "seal" }, + { "type": "cure_status", "status": "snare" } ], "price": 140 } diff --git a/docs/GODOT_4_6_MIGRATION.md b/docs/GODOT_4_6_MIGRATION.md index 4c043d7..864ece8 100644 --- a/docs/GODOT_4_6_MIGRATION.md +++ b/docs/GODOT_4_6_MIGRATION.md @@ -48,8 +48,9 @@ powershell -NoProfile -ExecutionPolicy Bypass -File tools\check_godot46_readines - A player unit can move, attack, wait, use a tactic, use an item, and equip compatible gear. - 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, Panacea can cure poison or seal, and neither consumes stock when used on a target without a matching status. +- Snare Tactic applies snare, prevents the affected unit from moving during its next action phase, and still leaves attacks, tactics, items, and wait available. +- Support, debuff, poison, seal, and snare status pips appear on affected board units and disappear when those effects expire or are cured. +- Antidote can cure poison, Panacea can cure poison, seal, or snare, 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. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 99b91ad..150cf92 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -32,8 +32,8 @@ - Weapon, armor, and accessory slots. Basic stat bonuses exist. - 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, Panacea poison/seal cure, item menu, preview, and target overlay exist. +- Skills, tactics, and MP. Multiple single-target damage/heal tactics, ally support buffs, enemy debuffs, poison damage-over-time, seal/snare action locks, 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, Panacea poison/seal/snare 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. @@ -132,7 +132,7 @@ ## Milestone 5: Presentation - Portrait pipeline. Officer definitions can provide default portrait paths, dialogue lines can override them, and missing art falls back to speaker initials. -- Unit sprites and animations. Board movement now has a short slide animation, and board units show low-HP warning rings plus small status pips for active support, debuff, poison, and seal effects. +- Unit sprites and animations. Board movement now has a short slide animation, and board units show low-HP warning rings plus small status pips for active support, debuff, poison, seal, and snare effects. - Battle effects. First floating combat text now covers damage, recovery, misses, support effects, poison ticks, level-ups, and promotions. Hover target preview badges summarize attacks, tactics, and items. - Music and sound. Basic placeholder BGM and SFX now play for menus, battle flow, unit actions, tactics, items, and result states. - Chapter UI and visual novel scenes. Pre-battle briefing now uses campaign chapter ranges for chapter-aware numbering, has a chapter progress/replay overview, and dialogue lines can choose left or right portrait placement. diff --git a/scripts/core/battle_state.gd b/scripts/core/battle_state.gd index 3bdd295..410b83e 100644 --- a/scripts/core/battle_state.gd +++ b/scripts/core/battle_state.gd @@ -558,6 +558,9 @@ func try_move_selected(cell: Vector2i) -> bool: return false if unit.get("moved", false) or unit.get("acted", false): return false + if _unit_has_action_lock(unit, "move"): + _emit_log("%s cannot move while snared." % unit["name"]) + return false if not get_movement_range(unit["id"]).has(cell): return false if not get_unit_at(cell).is_empty(): @@ -606,7 +609,7 @@ func try_cast_selected_skill(skill_id: String, target_cell: Vector2i) -> bool: return false if caster.get("acted", false): return false - if _unit_has_skill_lock(caster): + if _unit_has_action_lock(caster, "skill"): _emit_log("%s cannot use tactics while sealed." % caster["name"]) return false if not _unit_has_skill(caster, skill_id): @@ -732,7 +735,7 @@ func get_skill_preview(caster_id: String, skill_id: String, target_cell: Vector2 var target := get_unit_at(target_cell) var skill_kind := str(skill.get("kind", "damage")) - var skill_locked := _unit_has_skill_lock(caster) + var skill_locked := _unit_has_action_lock(caster, "skill") var preview := { "skill_id": skill_id, "skill_name": str(skill.get("name", skill_id)), @@ -826,7 +829,7 @@ func is_unit_skill_sealed(unit_id: String) -> bool: var unit := get_unit(unit_id) if unit.is_empty(): return false - return _unit_has_skill_lock(unit) + return _unit_has_action_lock(unit, "skill") func _effective_stat(unit: Dictionary, stat: String) -> int: @@ -862,7 +865,7 @@ func _skill_has_support_effects(skill: Dictionary) -> bool: return true if effect_type == "damage_over_time" and int(effect.get("amount", 0)) > 0: return true - if effect_type == "action_lock" and str(effect.get("action", "skill")) == "skill" and not str(effect.get("status", "seal")).strip_edges().is_empty(): + if effect_type == "action_lock" and not str(effect.get("action", "")).strip_edges().is_empty() and not str(effect.get("status", "")).strip_edges().is_empty(): return true return false @@ -901,16 +904,17 @@ func _resolve_skill_support(caster: Dictionary, target: Dictionary, skill_id: St "amount": damage, "remaining_phases": max(1, int(effect.get("duration_turns", 1))) }) - elif effect_type == "action_lock" and str(effect.get("action", "skill")) == "skill": - var status := str(effect.get("status", "seal")) - if status.strip_edges().is_empty(): + elif effect_type == "action_lock": + var action := str(effect.get("action", "")) + var status := str(effect.get("status", "")) + if action.strip_edges().is_empty() or status.strip_edges().is_empty(): continue status_effects.append({ "source_skill": skill_id, "name": str(skill.get("name", skill_id)), "type": effect_type, "status": status, - "action": "skill", + "action": action, "remaining_phases": max(1, int(effect.get("duration_turns", 1))) }) target["status_effects"] = status_effects @@ -961,9 +965,9 @@ func _format_support_effects(skill: Dictionary) -> String: continue var status_name := _status_display_name(str(effect.get("status", "poison"))) parts.append("%s -%d HP for %s" % [status_name, damage, duration_text]) - elif effect_type == "action_lock" and str(effect.get("action", "skill")) == "skill": - var status_name := _status_display_name(str(effect.get("status", "seal"))) - parts.append("%s tactics for %s" % [status_name, duration_text]) + elif effect_type == "action_lock": + var status_name := _status_display_name(str(effect.get("status", "status"))) + parts.append("%s %s for %s" % [status_name, _action_lock_display_name(str(effect.get("action", ""))), duration_text]) if parts.is_empty(): return "No support effect." return _join_strings(parts, ", ") @@ -986,8 +990,8 @@ func _format_support_popup(skill: Dictionary) -> String: var damage := int(effect.get("amount", 0)) if damage > 0: parts.append(_status_display_name(str(effect.get("status", "poison"))).to_upper()) - elif effect_type == "action_lock" and str(effect.get("action", "skill")) == "skill": - parts.append(_status_display_name(str(effect.get("status", "seal"))).to_upper()) + elif effect_type == "action_lock": + parts.append(_status_display_name(str(effect.get("status", "status"))).to_upper()) if parts.is_empty(): return "Support" return _join_strings(parts, ", ") @@ -997,8 +1001,8 @@ func _support_feedback_kind(skill: Dictionary) -> String: for effect in skill.get("effects", []): if typeof(effect) != TYPE_DICTIONARY: continue - if str(effect.get("type", "")) == "action_lock" and str(effect.get("action", "skill")) == "skill": - return str(effect.get("status", "seal")) + if str(effect.get("type", "")) == "action_lock": + return str(effect.get("status", "status")) for effect in skill.get("effects", []): if typeof(effect) != TYPE_DICTIONARY: continue @@ -1021,8 +1025,11 @@ func _format_active_status_effects(unit: Dictionary) -> String: if amount > 0: parts.append("%s -%d HP" % [_status_display_name(str(effect.get("status", "poison"))), amount]) continue - if effect_type == "action_lock" and str(effect.get("action", "skill")) == "skill": - parts.append("%s tactics" % _status_display_name(str(effect.get("status", "seal")))) + if effect_type == "action_lock": + parts.append("%s %s" % [ + _status_display_name(str(effect.get("status", "status"))), + _action_lock_display_name(str(effect.get("action", ""))) + ]) continue var stat := str(effect.get("stat", "")) if not _is_supported_status_stat(stat) or amount == 0: @@ -1043,13 +1050,24 @@ func _is_supported_status_stat(stat: String) -> bool: return stat == "atk" or stat == "def" or stat == "int" or stat == "agi" -func _unit_has_skill_lock(unit: Dictionary) -> bool: +func _unit_has_action_lock(unit: Dictionary, action: String) -> bool: + var normalized_action := action.strip_edges().to_lower() + if normalized_action.is_empty(): + return false for effect in _active_status_effects(unit): - if str(effect.get("type", "")) == "action_lock" and str(effect.get("action", "skill")) == "skill": + if str(effect.get("type", "")) == "action_lock" and str(effect.get("action", "")).strip_edges().to_lower() == normalized_action: return true return false +func _action_lock_display_name(action: String) -> String: + if action == "skill": + return "tactics" + if action == "move": + return "movement" + return "action" + + func try_wait_selected() -> bool: var unit := get_selected_unit() if unit.is_empty() or battle_status != STATUS_ACTIVE: @@ -1148,6 +1166,8 @@ func get_movement_range(unit_id: String) -> Array[Vector2i]: return [] if unit.get("team", "") == TEAM_PLAYER and not unit.get("deployed", true): return [] + if _unit_has_action_lock(unit, "move"): + return [] return _movement_range_for_unit(unit) @@ -1171,7 +1191,7 @@ func get_skill_cells(unit_id: String, skill_id: String) -> Array[Vector2i]: return [] if unit.get("team", "") == TEAM_PLAYER and not unit.get("deployed", true): return [] - if _unit_has_skill_lock(unit): + if _unit_has_action_lock(unit, "skill"): return [] if not _unit_has_skill(unit, skill_id): return [] @@ -1228,7 +1248,7 @@ func get_first_usable_skill_id(unit_id: String) -> String: var unit := get_unit(unit_id) if unit.is_empty() or typeof(unit.get("skills", [])) != TYPE_ARRAY: return "" - if _unit_has_skill_lock(unit): + if _unit_has_action_lock(unit, "skill"): return "" for skill_id in unit.get("skills", []): var normalized := str(skill_id) @@ -1247,7 +1267,7 @@ func get_usable_skill_ids(unit_id: String) -> Array: return result if unit.get("team", "") == TEAM_PLAYER and not unit.get("deployed", true): return result - if _unit_has_skill_lock(unit): + if _unit_has_action_lock(unit, "skill"): return result for skill_id in unit.get("skills", []): var normalized := str(skill_id) @@ -1624,6 +1644,8 @@ func get_turn_limit() -> int: func _movement_range_for_unit(unit: Dictionary) -> Array[Vector2i]: + if _unit_has_action_lock(unit, "move"): + return [] var start: Vector2i = unit["pos"] var frontier: Array[Vector2i] = [start] var costs := {start: 0} @@ -2053,7 +2075,7 @@ func _try_enemy_skill_action(enemy: Dictionary) -> bool: return false if typeof(enemy.get("skills", [])) != TYPE_ARRAY: return false - if _unit_has_skill_lock(enemy): + if _unit_has_action_lock(enemy, "skill"): return false var finishing_action := _best_ai_damage_skill_action(enemy, true) @@ -2183,10 +2205,11 @@ func _support_ai_score(caster: Dictionary, target: Dictionary, skill: Dictionary var duration: int = max(1, int(effect.get("duration_turns", 1))) score += damage * duration * 5 score += _ai_target_priority_score(target) - elif effect_type == "action_lock" and not target_is_ally and str(effect.get("action", "skill")) == "skill": - if _unit_has_skill_lock(target): + elif effect_type == "action_lock" and not target_is_ally: + var action := str(effect.get("action", "")) + if _unit_has_action_lock(target, action): continue - var threat_score := _unit_skill_threat_score(target) + var threat_score := _unit_action_threat_score(target, action) if threat_score <= 0: continue score += 18 + threat_score @@ -2229,6 +2252,17 @@ func _unit_skill_threat_score(unit: Dictionary) -> int: return score +func _unit_action_threat_score(unit: Dictionary, action: String) -> int: + if action == "skill": + return _unit_skill_threat_score(unit) + if action == "move": + var move_score := int(unit.get("move", 0)) * 5 + if int(unit.get("range", 1)) <= 1: + move_score += 10 + return move_score + return 0 + + func _best_ai_damage_skill_action(caster: Dictionary, defeating_only := false) -> Dictionary: var best_action := {} var best_score := -1 @@ -2274,7 +2308,7 @@ func _execute_ai_skill_action(caster: Dictionary, action: Dictionary) -> bool: return false if not _unit_has_skill(caster, skill_id): return false - if _unit_has_skill_lock(caster): + if _unit_has_action_lock(caster, "skill"): return false if int(caster.get("mp", 0)) < int(skill.get("mp_cost", 0)): return false diff --git a/scripts/scenes/battle_scene.gd b/scripts/scenes/battle_scene.gd index ce52433..b7e4b35 100644 --- a/scripts/scenes/battle_scene.gd +++ b/scripts/scenes/battle_scene.gd @@ -1039,8 +1039,8 @@ func _unit_status_marker_kinds(unit: Dictionary) -> Array[String]: func _unit_status_marker_kind(effect: Dictionary) -> String: var effect_type := str(effect.get("type", "stat_bonus")) - if effect_type == "action_lock" and str(effect.get("action", "skill")) == "skill": - return str(effect.get("status", "seal")) + if effect_type == "action_lock": + return str(effect.get("status", "status")) if effect_type == "damage_over_time" and int(effect.get("amount", 0)) > 0: return str(effect.get("status", "poison")) if effect_type == "stat_bonus": @@ -1061,6 +1061,8 @@ func _unit_status_marker_color(marker_kind: String) -> Color: return Color(0.54, 0.95, 0.36) if marker_kind == "seal": return Color(0.44, 0.86, 1.0) + if marker_kind == "snare": + return Color(1.0, 0.64, 0.22) return Color(0.72, 0.86, 1.0) @@ -1119,6 +1121,8 @@ func _floating_text_color(kind: String) -> Color: return Color(0.54, 0.95, 0.36) if kind == "seal": return Color(0.44, 0.86, 1.0) + if kind == "snare": + return Color(1.0, 0.64, 0.22) if kind == "miss" or kind == "fade": return Color(0.82, 0.84, 0.90) if kind == "defeat": @@ -1210,7 +1214,7 @@ func _skill_target_preview_badge(selected: Dictionary, target: Dictionary) -> Di return _make_target_preview_badge("+%d HP" % heal, "heal") if kind == "support": var effect_text := str(preview.get("effect_text", "Support")) - var badge_kind := "seal" if effect_text.contains("Seal") else ("poison" if effect_text.contains("Poison") else ("debuff" if effect_text.contains("-") else "support")) + var badge_kind := "snare" if effect_text.contains("Snare") else ("seal" if effect_text.contains("Seal") else ("poison" if effect_text.contains("Poison") else ("debuff" if effect_text.contains("-") else "support"))) return _make_target_preview_badge(_compact_support_preview_text(effect_text), badge_kind) var result_text := "KO" if bool(preview.get("would_defeat", false)) else "-%d" % int(preview.get("damage", 0)) @@ -1287,6 +1291,8 @@ func _target_preview_badge_color(kind: String) -> Color: return Color(0.54, 0.95, 0.36) if kind == "seal": return Color(0.44, 0.86, 1.0) + if kind == "snare": + return Color(1.0, 0.64, 0.22) return Color(0.78, 0.80, 0.86) @@ -3367,8 +3373,11 @@ func _format_tactic_effect_text(skill: Dictionary) -> String: elif effect_type == "damage_over_time" and amount > 0: var status_name := str(effect.get("status", "status")).replace("_", " ").capitalize() parts.append("%s -%d" % [status_name, amount]) - elif effect_type == "action_lock" and str(effect.get("action", "skill")) == "skill": - parts.append("%s tactics" % str(effect.get("status", "seal")).replace("_", " ").capitalize()) + elif effect_type == "action_lock": + parts.append("%s %s" % [ + str(effect.get("status", "status")).replace("_", " ").capitalize(), + _action_lock_effect_label(str(effect.get("action", ""))) + ]) if not parts.is_empty(): return _join_strings(parts, ", ") return "P%d" % int(skill.get("power", 0)) @@ -3387,6 +3396,14 @@ func _format_tactic_range_text(skill: Dictionary) -> String: return "1" +func _action_lock_effect_label(action: String) -> String: + if action == "skill": + return "tactics" + if action == "move": + return "movement" + return "action" + + func _on_tactic_skill_pressed(skill_id: String) -> void: _play_ui_confirm() selected_skill_id = skill_id diff --git a/tools/validate_data.ps1 b/tools/validate_data.ps1 index 12ee57b..d64e1b7 100644 --- a/tools/validate_data.ps1 +++ b/tools/validate_data.ps1 @@ -798,8 +798,8 @@ function Check-Skill-Definitions() { Fail "Skill $skillId action_lock effect must have a stable status." } $action = [string](Get-Prop $effect "action" "") - if ($action -ne "skill") { - Fail "Skill $skillId action_lock effect currently supports only action=skill." + if ($action -ne "skill" -and $action -ne "move") { + Fail "Skill $skillId action_lock effect currently supports only action=skill or action=move." } if ([int](Get-Prop $effect "duration_turns" 1) -le 0) { Fail "Skill $skillId action_lock effect must have positive duration_turns."