Debug F8 unlocks everything: every upgrade and shop item at its last level
CampaignDebug.unlock_all (debug builds, not on a co-op partner's machine, until the vacation ends) grants every upgrade and shed item at its last level for free through Upgrades.grant_all, which shares the new Upgrades.level_up with buy(), so each level's effect (max health, pouch, barrier health) applies as if bought. Not counted as bought in the night record. In the morning review the retry snapshot is retaken (CampaignController.retake_morning_snapshot) so a retry keeps it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3f32596034
commit
10390cf382
5 changed files with 101 additions and 5 deletions
|
|
@ -211,11 +211,22 @@ static func buy(campaign: CampaignController, id: String, structures: StructureS
|
|||
if why != "":
|
||||
return "%s: %s" % [u.get("name", id), why.to_lower() if why != "Done" else "already done"]
|
||||
var lvl := level(s, id) + 1
|
||||
s.pay(cost(cfg, id, lvl), slot)
|
||||
s.record_event("upgrades_bought") # every level counts
|
||||
level_up(campaign, id, structures)
|
||||
return "%s done: %s" % [name_at(cfg, id, lvl), text_at(cfg, id, lvl).to_lower()]
|
||||
|
||||
|
||||
## Raises an upgrade one level and applies that level's effect, with no checks and nothing paid:
|
||||
## buy() once it has checked and paid, and grant_all() for free.
|
||||
static func level_up(campaign: CampaignController, id: String, structures: StructureSystem = null) -> void:
|
||||
var cfg := campaign.config
|
||||
var s := campaign.state
|
||||
var u: Dictionary = cfg.upgrades.get(id, {})
|
||||
var lvl := level(s, id) + 1
|
||||
var add := roundi(per_level(u.get("add", 0), lvl))
|
||||
var barrier_before := value(cfg, s, "barrier_hp")
|
||||
s.pay(cost(cfg, id, lvl), slot)
|
||||
s.upgrades[id] = lvl
|
||||
s.record_event("upgrades_bought") # every level counts
|
||||
match String(u.get("stat", "")):
|
||||
"scarecrow_max_hp": # both scarecrows'
|
||||
s.scarecrow_max_hp += add
|
||||
|
|
@ -230,4 +241,15 @@ static func buy(campaign: CampaignController, id: String, structures: StructureS
|
|||
e["hp"] = mini(roundi(int(e["hp"]) * k), structures.max_hp(e["type"]) if structures != null else 1 << 20)
|
||||
"pouch_capacity": # the live value lives in ResourceStore (one for every pouch), not read from cfg each time
|
||||
s.resources.pouch_capacity += add
|
||||
return "%s done: %s" % [name_at(cfg, id, lvl), text_at(cfg, id, lvl).to_lower()]
|
||||
|
||||
|
||||
## Debug (CampaignDebug, F8): every upgrade and shop item to its last level, free, whatever the
|
||||
## day, the goop, or "requires" say, each level's effect applied as if bought. Not counted as
|
||||
## bought in the night record. Returns how many levels it added.
|
||||
static func grant_all(campaign: CampaignController, structures: StructureSystem = null) -> int:
|
||||
var n := 0
|
||||
for id: String in campaign.config.upgrades:
|
||||
while not maxed(campaign.config, campaign.state, id):
|
||||
level_up(campaign, id, structures)
|
||||
n += 1
|
||||
return n
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue