#46: sprint becomes a permanent speed upgrade
Owning the Sprint upgrade now multiplies the scarecrow's speed by
sprint_speed_mult (1.25) all the time, walking and running, on every
platform; the run clip speeds up to match. The hold-to-sprint burst is
gone: sprint_time, sprint_cooldown, the stamina state in PlayerCharacter
(can_sprint is now has_sprint), and the HUD's stamina bar. The upgrade
keeps its id, cost, and name; its text is "Run 25% faster, always".
The sprint input action stays in project.godot, unused.
Tests: test_scarecrow's sprint checks cover 1x without it, x1.25 with it
(run and walk, clip speed, network strength), 30 s with no time limit,
no cooldown, the next morning, and no platform dependence; test_nights
checks it after the retry and a loaded save; test_economy checks the
text matches the multiplier, the menu row, and that an old save's
{"sprint": 1} still owns it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f0291133fd
commit
962c7b0b93
9 changed files with 138 additions and 149 deletions
|
|
@ -193,7 +193,7 @@ func _upgrades(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void
|
|||
var morning := s.to_dict()
|
||||
var shed := s.resources.shed_total()
|
||||
var spent := 0
|
||||
r.check(not player.can_sprint(), "(no sprint before the Sprint upgrade)")
|
||||
r.check(not player.has_sprint() and player.speed_factor() == 1.0, "(no Sprint before the upgrade: 1x speed)")
|
||||
var day := s.night
|
||||
s.night = 14 # every shed item is in stock by day 14 (#26's from_day)
|
||||
for id in Upgrades.ORDER:
|
||||
|
|
@ -202,7 +202,8 @@ func _upgrades(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void
|
|||
r.check(Upgrades.level(s, id) == 1 and text.contains("done:"), "bought %s: '%s'" % [id, text])
|
||||
s.night = day
|
||||
r.check(s.resources.shed_total() == shed - spent, "all %d cost %d materials together (level 1 each)" % [Upgrades.ORDER.size(), spent])
|
||||
r.check(player.can_sprint(), "sprint: the scarecrow can sprint")
|
||||
r.check(player.has_sprint() and is_equal_approx(player.speed_factor(), cfg.sprint_speed_mult),
|
||||
"sprint: the scarecrow is faster for good (x%.2f)" % player.speed_factor())
|
||||
r.check(Upgrades.buy(c, "sprint", st).contains("already done") and Upgrades.buy(c, "rapid_fire", st).contains("level 2 opens on day 8")
|
||||
and Upgrades.level(s, "rapid_fire") == 1, "a one-off can't be bought twice, and an upgrade's level 2 waits for day 8")
|
||||
r.check(sim.combat.interval_ticks() < int(before["interval"]) and sim.combat.shot_damage() == int(before["damage"]) + 1,
|
||||
|
|
@ -261,12 +262,20 @@ func _upgrades(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void
|
|||
_step(sim, 1)
|
||||
c.retry_night()
|
||||
r.check(s != c.state and c.state.upgrades == bought, "a retry from that morning keeps them")
|
||||
r.check(is_equal_approx(player.speed_factor(), cfg.sprint_speed_mult), "Sprint's speed too, after the retry (x%.2f)" % player.speed_factor())
|
||||
var old := FarmState.from_dict(morning)
|
||||
r.check(old.upgrades.is_empty() and old.resources.shed_total() == shed, "(the morning before they were bought had none, and the materials)")
|
||||
c.new_campaign()
|
||||
_step(sim, 1)
|
||||
r.check(c.state.upgrades.is_empty() and sim.combat.shot_damage() == 1 and st.max_hp("fence") == cfg.fence_hp and not player.can_sprint(),
|
||||
r.check(c.state.upgrades.is_empty() and sim.combat.shot_damage() == 1 and st.max_hp("fence") == cfg.fence_hp and not player.has_sprint()
|
||||
and player.speed_factor() == 1.0,
|
||||
"a new vacation starts without them")
|
||||
c.load_state(back)
|
||||
_step(sim, 1)
|
||||
r.check(player.has_sprint() and is_equal_approx(player.speed_factor(), cfg.sprint_speed_mult),
|
||||
"continuing the save brings Sprint's speed back (x%.2f)" % player.speed_factor())
|
||||
c.new_campaign()
|
||||
_step(sim, 1)
|
||||
player.global_position = AWAY
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue