# Sengoku offline reconstruction — phases 1–3

This is an independent, offline HTML5 reconstruction of the core experience of 戦国じゃんぶる. The implementation is a prototype, not recovered original source code. The reference recording is 28 minutes 53 seconds long; sampled battle, result, recruitment and formation screens supplement the original manual.

## Scope and estimates

| Phase | Productive hours by GPT-6 Astra (planning estimate) | Acceptance target |
|---|---:|---|
| 1 — Reference investigation and specification | 8–14 hours | Record rules, eight classes, five tactics, five stats, source links, uncertainty and phase boundaries |
| 2 — Battle prototype | 18–30 hours | Run a repeatable 30-versus-30 battle with player control, AI, bases, scoring, retreat/healing, status feedback and one default special per class |
| 3 — Complete playable loop | 18–28 hours | Arrange formation → fight → results → recruit/replace → save → reload, including export/import and roster checks |
| **Total** | **44–72 hours** | Core playable offline prototype |

These are provisional planning budgets, not measured GPT-6 Astra benchmarks or elapsed-time promises. Parallel agent work may overlap; the sum of productive agent hours is not wall-clock duration. Update estimates after actual verification. Do not infer completion merely because files have been generated.

Estimated application package: **1–5 MB** for the phase 1–3 build with code-drawn graphics, without a bundled browser/runtime. Current source-only files can be substantially smaller. Exclude the 438 MB reference recording, extracted reference images, scratch work, downloaded analysis libraries and test tooling. Later artwork/audio or a bundled desktop runtime may substantially increase size.

## Evidence labels

- **Documented:** explicitly described in the original manual.
- **Observed:** visible in a sampled recording frame.
- **Provisional:** a reconstruction choice whose original formula or exact behavior has not been established.
- **Deferred:** intentionally outside the first three phases.

The manual spans revisions. Prefer explicit replacement notes over combining old and new abilities. Source pages and video frames do not reveal every probability or timing value.

## Eight troop classes

The basic-data page lists eight names despite saying “seven types.” The named list and cavalry note establish the intended eight classes.

| Japanese | English label | Documented recruitment location | Maximum in army |
|---|---|---|---:|
| 足軽 | Infantry | 平地 — plains | No separate limit documented; army limit applies |
| 弓兵 | Archer | 平地 — plains | No separate limit documented; army limit applies |
| 猛者 | Heavy fighter | 繁華街 — town | 6 |
| 武将 | Commander | 武家屋敷 — samurai residence | 4 |
| 軍師 | Strategist | 兵学舎 — military school | 4 |
| 鉄砲 | Firearm troop | 鉄砲鍛造所 — firearm forge | 6 |
| 忍者 | Ninja | 忍の里 — ninja village | 6 |
| 騎馬 | Cavalry | Uesugi Kagekatsu, Takeda Katsuyori or Sanada Masayuki strongholds; plains level 4 or above | 1 |

Sources: [recruitment](https://splax.net/manual/outline06.html), [basic soldier data](https://splax.net/manual/hei01.html).

The prototype offers these encounter categories on one arena; it does not yet contain a connected campaign map or historically reconstructed stronghold armies. The starting army includes all eight classes to make testing possible.

## Basic stats — required in phases 2–3

| Stat | Required effect | Current numerical interpretation |
|---|---|---|
| 体力 — HP | Decreases with damage; zero means leaving that battle; can recover at the home base | Class-based starting HP; no permanent death |
| 戦闘 — Combat | Affects normal contact-combat success | Provisional relative combat probability |
| 防御 — Defense | Chance to guard normal attacks | Provisional probability; does not ordinarily guard specials |
| 技量 — Technique | Controls special attack frequency and player skill-bar charging | Prototype charge time is approximately `400 / technique` seconds |
| 脚力 — Walking speed | Controls movement | Prototype pixels per simulation second; original displayed scale not recovered |

Ordinary normal hits deal one HP damage in the documented baseline. Attack probabilities, collision timing and exact guard formulas are not established. The manual says a player-controlled soldier has a minimum movement speed equivalent to 脚力 3; the prototype approximates this with its own movement scale.

Source: [normal parameters](https://splax.net/manual/hei02.html).

## Individual tactics

These are selectable behaviors available to a soldier, not permanent personality labels. A soldier's complete eligibility set remains subject to further evidence; the prototype restricts 待機 to archers/firearm troops and otherwise exposes the known behaviors for testing.

| Tactic | Documented intent | Prototype detail to verify/tune |
|---|---|---|
| 突撃 — Charge | Move toward enemy base; prioritize fighting encountered enemies | Local detection distance and how long contact holds a target |
| 守備 — Defend | Wait until an enemy enters the home-base defense area, then engage | Circular radius is a provisional approximation |
| 迎撃 — Intercept | Wait until an enemy crosses the interception line, then engage | Line position and return behavior are provisional |
| 乱戦 — Free combat | Independently select enemies and act freely; common among heavy fighters | Target randomization and ignoring global orders are reconstruction choices |
| 待機 — Wait | Wait for enemies; retain the chosen ranged target until it leaves range | Special attacks must honor that target lock; pursuit/movement needs further observation |
| 特務 — Special duty | Unknown / `???` in this reference | Disabled; no invented behavior |

Source: [tactics](https://splax.net/manual/hei03.html).

Do not conflate individual 守備 with the army-wide defense command: the latter returns soldiers to their initial positions. Gathering sends troops toward the player. Charge and gather cannot be issued close to the enemy base; the exact prohibited distance is provisional. Current prototype bindings are 1/2/3/0, deliberately separate from WASD movement.

## Battle state and scoring

- Two armies of 30 soldiers; the counter decreases when soldiers leave the battle, not when they merely retreat to heal.
- Base points start at 30 and decrease with base attacks. The HUD displays **remaining base points**, not the number of attacks already received.
- Repel points count forcing an enemy to retreat even if it is not removed from battle.
- The prototype credits one repel event per retreat/withdrawal cycle and resets eligibility after full recovery. Exact original event ordering and repeat-credit details need further evidence.
- At the timer's end, score each side as:

  `remaining base points × 5 + soldiers still in battle × 3 + repel points`

- A tied score is a defeat for the player.
- The prototype battle duration is 150 seconds; that is a test setting, not a recovered universal duration.
- The player does not directly damage the enemy base; their army must do so.
- Display gathering, attacking/charging, defending, skill activation/readiness, healing and low-HP information. The prototype uses readable text/effects rather than copied original icons.
- Low-HP automatic retreat also applies to the player in this prototype. This is an explicit approximation; the original manual tells the player to retreat rather than establishing identical automatic behavior.

Sources: [victory determination](https://splax.net/manual/outline04.html), [status marks and commands](https://splax.net/manual/outline07.html), [general manual](https://splax.net/manual/).

The recording's 00:00 result supports the formula: `29×5 + 30×3 + 2 = 237` versus `0×5 + 17×3 + 0 = 51`.

## Default special attacks — one per class first

| Class | Prototype default | Intended effect |
|---|---|---|
| 足軽 | Spear strike | Short-range stronger strike |
| 弓兵 | Arrow | Ranged hit |
| 猛者 | Whirlwind | Damage nearby enemies |
| 武将 | 号令 — Command | Trigger surrounding allies' specials; charge the player's skill bar |
| 軍師 | Fire tactic I | Ignite an enemy and apply damage over time |
| 鉄砲 | Shot | Longer-range hit |
| 忍者 | 忍術 — Ninjutsu | Nearby multi-target attack |
| 騎馬 | Mounted sweep | Nearby multi-target attack |

These are simplified defaults derived from the documented categories. English labels are descriptive, not a claim of exact original translated skill names. Ranges, damage, fire duration and charge conversion are provisional. Phase 2 needs one functioning special per class; second choices and the complete catalogue are lower priority.

The prototype prevents commanders from recharging other commanders, avoiding recursive command chains. This is a prototype safeguard, not a documented original restriction. Ranged specials honor the current valid ranged target lock.

Source: [special attacks](https://splax.net/manual/hei05.html).

Historical Phase 1–3 scope: passive abilities were deferred. Phase 4 now implements the 18 abilities listed in the v0.5 section below. The source explicitly replaces old 追撃 with 討取 and old 援護 with 奮起; do not implement both old and revised behavior as simultaneous defaults. The original medical-support icons depend on these abilities and will be completed with that system.

Source: [special abilities and revision notes](https://splax.net/manual/hei04.html).

## Recruitment and progression

After victory, choose at most one eligible enemy soldier and replace one existing soldier. Recruitment consumes coins equal to that soldier's salary, must fit total salary, and must respect class caps. Replacing a soldier of the same capped class is valid if the resulting army remains within its cap.

Current prototype choices: 60,000 total salary cap, 10,000 initial coins, 600 coins per victory, fixed class stats, and a bounded candidate list. These numbers and enemy composition are testing conveniences. Recruitment rarity, stat variation, growth, salary derivation and a full campaign remain deferred.

## Offline architecture and saving

- Plain HTML/CSS/JavaScript with Canvas rendering and local bundled artwork; no runtime network dependency.
- Pure battle logic in `engine.js`, interface in `app.js`, presentation in `style.css`.
- Fixed 30 Hz simulation with selectable 1×/2×/4× test speed; rendering is separate.
- Seeded battle randomness for repeatable simulation tests.
- Current storage uses localStorage, not the earlier proposed IndexedDB. This is sufficient for the compact phase 1–3 state, provided writes/imports are validated and backup/export remain available.
- Autosave between battles and after formation/tactic/recruitment changes; manual Save now.
- A previous valid local save acts as backup; export/import transfers JSON files.
- Mid-battle resume, multiple named save slots and cloud saves are not implemented in this prototype. Online services are out of scope entirely.
- Use the same local address and browser to access the same browser save. Export before moving the folder, switching launch mode/browser, or clearing browser data.

## Verification gates

Phase 1 is reviewable when documented and provisional rules are distinguishable and all user requirements are represented. Phase 2 is complete only after deterministic simulation tests and an actual playable battle verify class behavior, tactics, stats, skills, retreat scoring and timer results. Phase 3 requires an interactive formation-to-recruitment loop plus save/reload and export/import verification.

Required edge cases: tie defeat; repeated retreat after recovery; no duplicate points within one retreat; zero-HP units returning next battle; capped-class replacement; insufficient coins/salary; invalid imported references or numbers; no eligible targets for specials; wait-target retention; dead player; hidden-tab pause; offline startup.

This document does not certify that those checks have passed. Consult the accompanying implementation report and test output for current verification results.

## Phase 1–3 polish — v0.2 (user requirements, 2026-10-24)

These changes supersede the earlier prototype behavior:

- A base reaching zero ends the battle immediately. The side with the surviving base wins regardless of score. No later unit takes its turn after the decisive hit. Timer-expiry scoring and tie defeat still apply when both bases survive.
- A hit on a base alerts its defenders for five seconds, refreshed by further hits. Non-player troops with the Defend tactic (or a current defense order) recall to intercept threats around home, overriding charge/gather orders. Recall persists until they reach safety at home and the threat has cleared. Healing retreat retains priority; player control is not overridden by a defense alert.
- Each troop has a one-second shared attack cooldown for normal attacks, specials and base attacks. Normal attempts consume it even on miss/guard. Target switches and commander-triggered attacks cannot bypass it. Incoming hits do not grant invulnerability; existing fire damage continues.
- Opposing contact within 20 field pixels pushes both troops back seven pixels. Each troop may bounce at most once per 0.45 seconds. Retreating units are excluded from the impulse so they can disengage. Friendly overlap still uses gentle separation.
- Bounce distances, alert duration and contact radius are tunable reconstruction choices. The one-second attack interval is the user-requested pacing rule.
- Existing version-1 saves remain compatible; these new battle-only fields are initialized for every encounter.

## Phase 1–3 siege polish — v0.3 (user requirements, 2026-10-24)

- Each successful base hit throws its attacker 120 field pixels toward its own side and imposes a 0.45-second recovery pause. This is additional to the shared one-second attack cooldown. Return travel slows repeat hits naturally, with faster classes returning sooner. Player-controlled troops still cannot damage bases.
- Base approach blocking is geometric: a live, non-retreating enemy within 115 pixels of its base and within a 24-pixel corridor between attacker and base blocks the hit. A troop behind the attacker or off that path does not create blanket invulnerability. Knockouts and retreats open the path.
- Defensive AI rallies proactively when threats enter the defense area. Guard posts form an arc around home (75-pixel first row), and defenders use a short pursuit leash so they do not abandon the entrance. The red encounter army now includes three defensive infantry to exercise siege behavior.
- Low-HP retreat below 25% receives a 2x movement multiplier, including the player. Recovery pauses still apply; retreat is not invulnerability. Full home healing removes retreat state.
- HP zero explicitly marks a knockout, excludes the troop from movement/combat/blocking and healing for the rest of battle, and reduces surviving troop count. The roster is intact for the next battle.
- Recoil distance, guard formation, blocker width and retreat multiplier are tuning choices for this prototype, not claims about recovered original constants. Existing saves are compatible.

## Phase 1–3 animation and patrol polish — v0.4

- Knockout is immediate for simulation and scoring: HP-zero troops cannot attack, heal, block, be selected as targets, or contribute surviving-troop points. Their sprites remain visible while fleeing off their own side at 5x their walking speed, with running legs and motion streaks.
- Flee position and age are presentation-only fields. This animation continues after battle results appear, without advancing combat, score, or rewards. It freezes with pause and is cleared on returning to formation.
- Every other non-player defender in each starting army receives a patrol role. Others retain their normal defensive behavior. Patrols follow a front arc at radius 110 around home, within the defense area. Nearby threats/base alarms interrupt patrol to rally and intercept; low-HP retreat and explicit army orders take priority. Patrol resumes once recall clears and there is no overriding order.
- Patrol route/radius and alternating assignment are prototype tuning choices. Save schema remains version 1; battle roles and animations initialize per encounter.

## Phase 4–5 — v0.5 (supersedes earlier special-skill deferrals)

Phase 4 is deeper combat only: eight class profiles, selectable original-named special skills and 18 passive abilities. Training/growth and campaign development are explicitly excluded. Phase 5 covers troop appearance, portraits, status readability and animation. Online battles/rankings remain out of scope.

The lab allows one class-compatible special and up to three distinct abilities per soldier. This is a testing interface, not a claim that the original game allowed free customization. Existing saved stats are preserved; **Apply class balance to army** adopts the updated balance for all troops, while **Apply current class stats** changes only the selected soldier. New troops use it automatically.

Implemented abilities: 突進, 攻略, 膂力, 連発, 鉄壁, 見切, 討取, 奮起, 鼓舞, 回復, 治療, 療所, 仕掛, 堅陣, 母衣, 逃足, 火遁 and 忍狩. The replaced names 追撃/援護 are not duplicated. Effects and numerical values are visible in the lab and defined in engine.js. Unknown original constants remain provisional.

Key tuning: 連発 has a 20% repeat chance inside the same skill activation; all attacks still share the one-second outgoing cooldown. 攻略 deals two base points. 膂力 deals two normal HP damage, with 討取 adding one against targets at five HP or below. 見切 allows defense to guard specials; 母衣 adds arrow protection. 火遁 blocks burning and explosion bonus damage, not the direct impact. 逃足 increases the existing 2x retreat speed to 3x; knockout animation remains 5x.

治療 draws retreating allies toward a nearby living medic and treats on contact, once until a home-base visit. 回復 doubles home healing and treatment; treatment also triggers nearby healing. 奮起 and 鼓舞 react to a newly counted retreat, not each hit; one retreat still earns one repel point. 療所, 仕掛 and 堅陣 improve with living holders and have capped/probabilistic prototype effects. All healing excludes knocked-out troops.

Special categories include spear single/area, arrows/long-range/fire/explosives, command, five fire tiers, confusion, healing, heavy-fighter area attacks, ninja leaps/barrier, firearm range/explosives, and cavalry sweep. Command cannot recharge another commander and cannot bypass recipient cooldown. Confusion briefly forces movement toward home and prevents casting. 結界 is a simplified confusion/support reconstruction; its original random branch behavior is not fully reproduced.

Animations use visual offsets/facing and effects rather than recovered original animation sequences. Remaining unavailable art and any source uncertainties are documented in ASSETS.md and PHASE4-5.md. This is a playable reconstruction, not a byte-exact restoration.

## v0.5.2 — current player and patrol rules (supersedes earlier player retreat rules)

The player remains manually controlled below 25% HP and does not receive an automatic retreat state or repel credit merely for low HP. Voluntary home healing remains available. Existing confusion and recoil effects still apply. AI low-HP retreat is unchanged.

Player knockout immediately finishes the encounter with reason `player-knocked-out` and victory for the opposing team, independent of score. Damage through normal attacks, special attacks, burning or traps uses the same defeat path. The engine stops pending attacks/actions; the UI records the result once, including knockouts caused outside a simulation step.

Patrol radius increases from 110 to 180 pixels and its angular sweep from ±1 to ±1.2 radians. Patrols acquire nearby enemies within 70 pixels, provided the enemy remains within 250 pixels of home. They resume patrol after losing that local target. Inner defense alarms, recall, retreat and player orders retain priority. These are prototype tuning values.

## v0.5.3 — current stat and personality rules

The v0.5.3 table in README.md defines current baseline class stats and supersedes earlier class presets. March levels are discrete integers1–6, mapped to physical speed18/26/36/46/60/76; retreat, dash and knockout visuals use that same conversion. Player movement no longer has an artificial speed floor. Other stats are10–125; ninja HP10–40, march3–6. Archer march1–4; gunner1–3.

Version2 saves enforce the new limits. Version1 migration first validates the legacy schema, maps old physical speed to the nearest level (ties choose lower), clamps to class speed bounds, and clamps physical stats to the new limits. Legacy ranged 待機 defaults become 守備; other saved tactic choices remain. The existing localStorage key is retained so upgrades find prior saves. Version2 round trips never remap a level as physical speed. Legacy customized stats are preserved within bounds; Apply class balance to army explicitly adopts new baselines and tactics.

Ranged 守備 troops patrol ±90 pixels vertically around deployment Y, clamped inside the field, with fixed deployment X. They stop when an enemy enters the selected skill range and retain that target until it leaves. They do not join melee defenders' circular patrol/recall. Retreat, explicit orders and player control take priority.

Ninjas target nearby military-school/strategist troops within180 pixels when charging or in free combat; interception still requires crossing its line. Their normal attacks gain1 damage against strategists. Bravers in 乱戦 acquire ordinary enemies within180 pixels, prioritize ninjas within240 and otherwise wander to seeded random field destinations. They gain1 normal damage against ninjas and ignore army orders. These counter bonuses are reconstruction tuning.

The four priority classes have their full listed catalogs:2 spear,2 general,3 braver and3 firearm skills. 豪傑 was recovered from original icon08 and combines5 area damage at70 radius with command. Command still excludes commanders as recipients to prevent recursive activation chains; the player receives charge rather than automatic casting. 砲撃 has8 direct plus8 explosion damage and60 splash radius, with3% encounter generation probability. Fire immunity blocks explosion bonus, not impact. All outgoing attacks share the one-second cooldown. Other complex skill formulas remain provisional.

Reference: https://splax.net/manual/hei05.html. This source establishes skill categories and relative ranges, not the numerical values above.

### Final v0.5.3 fire, confusion, ninja and cavalry rules

Fire is a discrete nonstacking pending tick: one HP one second after impact, with no refresh by another hit before the tick. All five mage fire tiers share direct damage2, burn damage1 and area behavior; only radius changes (70/90/110/130/150). Fire arrows use the same delayed tick after their projectile impact. The user explicitly overrides the earlier fire-immunity interpretation: 火遁 now blocks the entire mage-fire attack, while arrow/explosion protection still blocks only the added effect.

虚報 and 幻術 use one-second confusion. Affected troops move along a bounded curving path, cannot attack/cast, and retain their defense and guarding abilities. Presentation rotates the troop figure. Confusion expires without altering saved stats/tactics.

Ninja catalog is 忍術/影走/幻術/結界. 結界 uses a 35% group-support trigger, then a 50/50 choice between healing+command and temporary AI charge. Each nearby allied ninja may receive that branch. Other 結界 holders are excluded from healing only, not command; shared cooldown prevents recursive immediate activation loops. A separate 25% self-heal chance applies only to AI casters. Player recipients receive charge but never forced movement/casting. All healing excludes knocked-out troops. A skill-issued charge lasts four seconds, supersedes ordinary orders, and still permits low-HP retreat. Probabilities are provisional, not original constants.

騎突 uses swept movement in increments no larger than eight pixels, strikes each encountered enemy once per activation (twice with a triggered 連発), and applies42-pixel knockback. A living enemy remaining within22 pixels blocks further motion, including at arena edges or after a successful special guard. Cavalry deals10 damage, can charge up to110 pixels, costs5,200 for new troops, and remains capped at one. A player knockout stops the charge immediately.

妖術/治癒 are retained only for backward compatibility with earlier prototype saves; they are not offered as ordinary new mage skills. Saved strategist 幻術 normalizes to 虚報. Numerical details above supersede earlier prototype fire/confusion/barrier/cavalry values.

## v0.5.4 formations

applyFormation changes x/y only. Layered line spreads ordinary troops from y130–470 in class ranks; Compact center compresses that body to y190–410; Pincer splits it around a central gap. Gunners and archers precede mage/general support, spearmen and bravers. Ninja/cavalry use alternating top/bottom positions near map margins. Opposing placement mirrors x about the battlefield center. Generated enemy variants are deterministic by seed; existing saved player positions remain untouched until applying a preset.

Formation controls lock while a battle/result exists. In-session Undo restores the immediately previous arrangement, and normal save/backup behavior persists positions. New visual dash/charge events record the actual simulated start/end coordinates and decay without affecting combat. Mage fire adds a radius-based flash; HP bars are raised above the new headgear for readability.

## v0.5.5 balancing specification

Current rules supersede older damage figures: direct normal/skill damage 1; 膂力 normal damage 2; 討取 adds 1 at target HP <=5. No innate class matchup damage bonuses. Skill charge duration = 120/(clamped technique +20), with technique10–125. Rare high technique can cast faster than one second; normal/base attacks retain their one-second cooldown.

Explosions: direct1 + explosion1 per victim. If exactly one living enemy occupies the impact blast footprint before guarding, total damage is multiplied by BALANCE.singleTargetBlastMultiplier (currently2). 火遁 removes all added explosion/fire damage, leaving direct1. Guard rolls are independent per victim and volley. Combined impact/explosion is one incoming attack for retaliation.

20 selectable abilities include cavalry-only 猛退 and 陣頭. Rare cavalry generation is5% each. 猛退 requires an already-retreating homeward target, excludes treatment retreat, burn/trap damage and recursive counters. 陣頭 excludes player holders and player movement recipients. 連発 probability10%. These values are tuning assumptions.

## v0.5.6 current rule overrides

Retreat: normal1.2× march, 逃足3× for home/treatment. Live enemy collision and bounce remain active during retreat; swept retreat movement blocks at20px even during bounce cooldown. Contact normal attacks may hit retreaters without adding general pursuit. KO5× departure is visual only.

療所: on home-radius entry, chance=min(1, .02 × living friendly holders). One draw per visit, shared army-wide eligibility including the player. No continuous probability accumulation while remaining inside. Regular healing remains5HP/s, doubled by回復.

討取: priority targeting only, no damage increment. Eligible enemies are retreating OR HP<=5 OR HP<25% maximum. Lowest HP then nearest; ranged acquisition uses skill range, melee180px. Priority overrides ordinary locked targets and 突進 base advance, creating a knockout-versus-base-pressure tradeoff. Manual player movement and player knockout loss remain unchanged.

Ability capacity15; browser upgrade once randomizes all30 friendly loadouts to2–5 distinct eligible abilities and saves abilityTestVersion1. New enemy battle generation uses randomAbilities:true; recruitment retains those generated loadouts. Standard engine generation remains available without the testing option. Cavalry-only restrictions remain enforced in saves/UI/combat. No special-attack randomization or extra special-attack slots are introduced.

Ability design distinction: 突進 and 討取 modify AI priorities/personality and create tactical tradeoffs; they do not increase damage stats. 膂力 and 逃足 directly improve performance through normal-hit damage and retreat movement speed. More behavioral abilities are not automatically a stronger troop.

## v0.5.7 command lifecycle overrides

Runtime orders are per troop (commandOrder/commandTime), with315px player acquisition radius and10s duration. b.order is HUD metadata only. Explicit cancel applies within the same radius. Non-receptive free-combat troops ignore ordinary player orders; skill motivation can override that personality temporarily. Orders do not modify saved tactic/start position or carry between battles.

Expiry enters returningHomeFormation, optionally retaining one non-retreating live target already within45px. No new pursuit is acquired during this phase. When the final target disengages, return to startX/startY, then resume original tactic. Home full recovery and successful treatment also enter this return phase with no retained combat target. Player excludes automated return. Retreat has priority over temporary orders.

陣頭: AI cavalry holder, local100px,4s motivate any allied class. 結界 charge branch: local120px,4s motivate any allied class; healing branch stillninjas only. Both exclude player and retreating recipients. 猛退 unchanged. Player command ring315px shown with Zones enabled.

Existing emergency base-defense recall takes precedence over ordinary player commands for defensive troops. Skill-driven motivation may override that recall temporarily.

## v0.5.8 stat-profile rules

STAT_PROFILES in engine.js is the current normal/strong stat source; README contains the full eight-class table. Weak=.7×normal; super=1.2–1.5×normal, one shared multiplier for HP/attack/defense/technique, rounded/clamped10–125 (ninjaHP<=40). March stays in class normal range for weak/super; explicit strong ranges apply to strong. General range1–6 is an interpretation of unspecified variation. The15/55/25/5% distribution applies per non-favored stat, not per troop; current role-weighted generation is described below. Costs/abilities/skill types/positions/tactics are independent of profile strength.

Save schema2 retains optional tier metadata; older saves lacking it become custom without changing numeric stats. Gunner validation now accepts march4 for strong profiles. Historical broader archer/ninja saved march bounds are retained for compatibility; new generated values use the supplied narrower profile ranges. Current special-hit damage and ability behavior remain unchanged.

### Final mixed-stat generation

ROLE_STATS favors ninja combat+hp, cavalry combat, ranged/mage technique, and frontline ashigaru/brute/commander defense+hp. rollMixedStats independently samples each stat using favored5/35/45/15% or other15/55/25/5% weak/normal/strong/super probabilities. Generated tier metadata is mixed, not an overall power assessment. Each gunner has an8% chance of technique90 independent of other stats. Skills and abilities are not forced by this roll. All five stats remain random even where less valuable to a class. Current saves retain their rolls on reload; buttons permit explicit rerolls and custom editing.

## v0.5.9 economy implementation

Economy lives in economy.js, loaded before engine.js in browser and required by engine.js in Node. createSengokuEconomy exposes priceTroop,armyValue,LEVELS,generateArmy,startingArmy,victoryReward. Stat weighting depends on class role. Allowed abilities add individual values, with useful synergy/loadout count premiums. Cavalryfloor3500; premium skill floors include幻術4000,結界3500,妖術3000,治癒2500,炎術2500,砲撃2000. Actual prices often exceed floors. No fixed10000 ceiling.

Seeded generation assigns quality quotas, independently varies stats, selects legal skills/abilities, and uses bounded price-derived upgrades toward each target without exceedingmax. Earlylevels forbid dangerous area-control/explosive/healing combinations; level1 has45%chance of one safe ultra troop. Level10forces class-preferredboss skills. Recruitmentpool and classcaps remain respected. Price is recomputed in save migration and recruitment, so editing cost cannot create discounts.

Schema3 adds armyLevel1–10, testModeboolean and playerArmyLevelnull/1–9. Oldsaves migrate numericstats/loadouts intact. Overbudget persistence is allowed to prevent data loss; deployment and recruitment enforce62k unless explicittestmode. Quick player generation mirrors legal enemy generation into blue deployment withdistinctIDs; pretestroster backup is stored separately from ordinary rotating backup. Preparedenemyseed pins the preview to actualbattle generation. Generation controls lock duringbattle/results untilreturntoformation.

## Next phase — map progression specification (not implemented)

18×18=324 cells:274 flat lands,40 recruitment locations,9cities and1boss. Recruitment locations:Lv1–4 seveneach, Lv5–6 sixeach (40total). Cities:oneeachLv1–9. Boss:Lv10. Flatlands distributed acrossLv1–9; exact allocation pending.

Start army-value limit32,000. First victory at a new recruitmentlocation/city marksX and raises limit by100×level; repeated wins andordinaryflatlands do not increaseit. Locations add13,600; citiesadd4,500; total18,100. Clearingallnonbosscontent wouldsum50,100. Ifallothercontentisclearedfirst, beforeLv9citylimit49,200. DefeatingLv9city unlocksLv10boss andsetsarmycapdirectly62,000. These are nextphase requirements, distinctfromcurrentfreeleveltesting.

## Map campaign (v0.6.0)

Implemented: 18×18 map, 274 plains, 40 locations, 9 cities and hidden level-10 boss. Frontier expands through victories; visited tiles support free travel and repeat farming. Location/city first-clear cap bonus is level×100 from a 32,000 initial limit. City-nine victory reveals boss and sets limit to 62,000. Campaign and sandbox retain separate rosters, currency and records in schema-4 saves. Legacy armies migrate to sandbox without rerolling. No troop training added.
