Windroost 风之精华 previously had NO DPS effect -- it only bought oaths. In CH, the equivalent Hero Soul grants +10% global DPS per point, the exponential layer that lets DPS track 1.55^level monster HP. Restored via cf_tuned_values (CH linear10 = 0.10), Python + GD mirror, identity preserved (essence=0 -> 1.0). This is layer 1 of restoring CH's growth engine (concept correspondence existed but numeric strength was flattened). GROWTH_PARITY 7, CF_TUNED_PARITY 58, P2_CHECKS_PASS 95. Next: apply CH monster HP curve to cycle_pacing so DPS and HP grow together rather than DPS alone.
218 lines
7.3 KiB
GDScript
218 lines
7.3 KiB
GDScript
class_name GrowthModifiers
|
|
extends RefCounted
|
|
|
|
## GDScript mirror of tools/fullgame/growth.py — computes stat modifiers from
|
|
## all 8 design growth layers. Must produce byte-identical numbers to the Python
|
|
## engine for the same profile (cross-language parity is tested in tools/fullgame).
|
|
## Empty profile -> identity, so today's slice numbers are unchanged.
|
|
|
|
const WorldContent = preload("res://scripts/world_content.gd")
|
|
const CfTunedValues = preload("res://scripts/cf_tuned_values.gd")
|
|
const _G = CfTunedValues.GROWTH
|
|
|
|
static var _authored_stats: Dictionary = {}
|
|
static var _gear_stats: Dictionary = {}
|
|
|
|
|
|
## Authored talent stat/stat_value from the full pack. Used only by the
|
|
## full-game world path; the slice keeps the flat fallback (empty dictionary).
|
|
static func authored_talent_stats() -> Dictionary:
|
|
if _authored_stats.is_empty():
|
|
for t in WorldContent.content().get("talents", []):
|
|
var row: Dictionary = t
|
|
_authored_stats[str(row.get("id", ""))] = row
|
|
return _authored_stats
|
|
|
|
|
|
## Authored gear stat/stat_value from the pack (L5 gear wiring).
|
|
static func authored_gear_stats() -> Dictionary:
|
|
if _gear_stats.is_empty():
|
|
for g in WorldContent.content().get("gear", []):
|
|
var row: Dictionary = g
|
|
_gear_stats[str(row.get("id", ""))] = row
|
|
return _gear_stats
|
|
|
|
|
|
## Full-game path: authored talent/gear values + prestige direction effects.
|
|
static func compute_full_game(profile: Dictionary) -> Dictionary:
|
|
const PrestigeDirection = preload("res://scripts/prestige_direction.gd")
|
|
var direction := PrestigeDirection.direction_modifier(
|
|
profile.get("oaths", {}), profile.get("edicts", {})
|
|
)
|
|
return compute(profile, authored_talent_stats(), direction)
|
|
|
|
|
|
static func _active(v: Variant) -> bool:
|
|
if v is bool:
|
|
return v
|
|
if v is int:
|
|
return v > 0
|
|
return false
|
|
|
|
|
|
static func _clampi(v: int, lo: int, hi: int) -> int:
|
|
return maxi(lo, mini(hi, v))
|
|
|
|
|
|
static func empty() -> Dictionary:
|
|
return {
|
|
"roster_mult": 1.0,
|
|
"signature_mult": 1.0,
|
|
"click_mult": 1.0,
|
|
"storm_mult": 1.0,
|
|
"flat_roster": 0.0,
|
|
}
|
|
|
|
|
|
static func compute(profile: Dictionary, talent_stats: Dictionary = {}, prestige_dir: Dictionary = {}) -> Dictionary:
|
|
var roster := 1.0
|
|
var signature := 1.0
|
|
var click := 1.0
|
|
var storm := 1.0
|
|
var flat := 0.0
|
|
|
|
# stars 1-8 permanent, +8% roster per star above 1 across owned heroes.
|
|
# Aggregate steps then apply once, matching growth.py exactly.
|
|
var stars: Dictionary = profile.get("star_levels", {})
|
|
var star_steps := 0
|
|
for v in stars.values():
|
|
if v is int or v is float:
|
|
star_steps += _clampi(int(v), 1, 8) - 1
|
|
roster *= 1.0 + _G["star_roster"] * float(star_steps)
|
|
|
|
# Hero talents: with the authored pack, each talent's real stat/stat_value
|
|
# is consumed (click/signature buckets). Without it the slice keeps the
|
|
# flat +3% hero / +2% global fallback so existing parity stays identity.
|
|
var talents: Dictionary = profile.get("talents", {})
|
|
var sig_add := 0.0
|
|
var click_add := 0.0
|
|
var roster_add := 0.0
|
|
for tid in talents.keys():
|
|
if not _active(talents[tid]):
|
|
continue
|
|
var t := str(tid)
|
|
if talent_stats.has(t):
|
|
var spec: Dictionary = talent_stats[t]
|
|
var stat := str(spec.get("stat", ""))
|
|
var value := float(spec.get("stat_value", 0.0))
|
|
if stat == "click_dps":
|
|
click_add += value
|
|
elif stat == "signature_dps" or stat == "skill_power" or stat == "ultimate_power":
|
|
sig_add += value
|
|
elif stat == "global":
|
|
roster_add += value
|
|
else:
|
|
sig_add += _G["talent_sig"]
|
|
elif t.begins_with("T-G"):
|
|
roster_add += _G["global_roster"]
|
|
elif t.begins_with("T-H"):
|
|
sig_add += _G["talent_sig"]
|
|
roster *= 1.0 + roster_add
|
|
signature *= 1.0 + sig_add
|
|
click *= 1.0 + click_add
|
|
|
|
# awakening 3 nodes permanent: +5% signature per node, +10% at full 3/3
|
|
var awaken: Dictionary = profile.get("awakenings", {})
|
|
var aw_total := 0
|
|
for v in awaken.values():
|
|
if v is int or v is float:
|
|
aw_total += _clampi(int(v), 0, 3)
|
|
# Python growth.py computes this layer from 1.0 (additive within layer) then
|
|
# multiplies layers together. Mirror that: build layer multiplier, fold in.
|
|
var aw_layer := 1.0 + _G["awakening_node"] * float(aw_total)
|
|
if aw_total >= 3:
|
|
aw_layer += _G["awakening_full"]
|
|
signature *= aw_layer
|
|
|
|
# relics long-term: +1.5% roster, +1% click each
|
|
var relics: Dictionary = profile.get("relics", {})
|
|
var relic_n := 0
|
|
for v in relics.values():
|
|
if _active(v):
|
|
relic_n += 1
|
|
roster *= 1.0 + _G["relic_roster"] * float(relic_n)
|
|
click *= 1.0 + _G["relic_click"] * float(relic_n)
|
|
|
|
# Oaths / edicts: full-game uses authored direction buckets (each changes
|
|
# a resource/rule, not a global multiplier); slice keeps flat fallback.
|
|
if not prestige_dir.is_empty():
|
|
roster *= float(prestige_dir.get("roster_mult", 1.0))
|
|
signature *= float(prestige_dir.get("signature_mult", 1.0))
|
|
click *= float(prestige_dir.get("click_mult", 1.0))
|
|
storm *= float(prestige_dir.get("storm_mult", 1.0))
|
|
flat += float(prestige_dir.get("flat_roster", 0.0))
|
|
else:
|
|
var oaths: Dictionary = profile.get("oaths", {})
|
|
var oath_n := 0
|
|
for v in oaths.values():
|
|
if _active(v):
|
|
oath_n += 1
|
|
storm *= 1.0 + _G["oath_storm"] * float(oath_n)
|
|
roster *= 1.0 + _G["oath_roster"] * float(oath_n)
|
|
var edicts: Dictionary = profile.get("edicts", {})
|
|
var edict_n := 0
|
|
for v in edicts.values():
|
|
if _active(v):
|
|
edict_n += 1
|
|
roster *= 1.0 + _G["edict_roster"] * float(edict_n)
|
|
signature *= 1.0 + _G["edict_sig"] * float(edict_n)
|
|
|
|
# emblems (rebuild-retained): +2% signature each
|
|
var emblems: Dictionary = profile.get("emblems", {})
|
|
var emblem_n := 0
|
|
for v in emblems.values():
|
|
if _active(v):
|
|
emblem_n += 1
|
|
signature *= 1.0 + _G["emblem_sig"] * float(emblem_n)
|
|
|
|
# CH Hero Soul layer: essence grants +10% DPS per point (exponential growth
|
|
# engine). essence=0 -> identity.
|
|
var essence_n := maxi(0, int(profile.get("essence", 0)))
|
|
var essence_mult := 1.0 + CfTunedValues.ESSENCE_DPS_PER_POINT * float(essence_n)
|
|
roster *= essence_mult
|
|
signature *= essence_mult
|
|
|
|
# gear (this round): each equipped item contributes its authored stat bucket.
|
|
var equipped: Dictionary = profile.get("equipped", {})
|
|
if not equipped.is_empty():
|
|
var gstats := authored_gear_stats()
|
|
var g_roster := 0.0
|
|
var g_sig := 0.0
|
|
var g_click := 0.0
|
|
var g_storm := 0.0
|
|
for gid in equipped.values():
|
|
var spec: Dictionary = gstats.get(str(gid), {})
|
|
if spec.is_empty():
|
|
continue
|
|
var stat := str(spec.get("stat", ""))
|
|
var value := float(spec.get("stat_value", 0.0))
|
|
if stat == "roster_dps":
|
|
g_roster += value
|
|
elif stat == "signature_dps":
|
|
g_sig += value
|
|
elif stat == "click_dps":
|
|
g_click += value
|
|
elif stat == "storm":
|
|
g_storm += value
|
|
roster *= 1.0 + g_roster
|
|
signature *= 1.0 + g_sig
|
|
click *= 1.0 + g_click
|
|
storm *= 1.0 + g_storm
|
|
|
|
return {
|
|
"roster_mult": snappedf(roster, 0.000001),
|
|
"signature_mult": snappedf(signature, 0.000001),
|
|
"click_mult": snappedf(click, 0.000001),
|
|
"storm_mult": snappedf(storm, 0.000001),
|
|
"flat_roster": snappedf(flat, 0.000001),
|
|
}
|
|
|
|
|
|
static func apply(base_roster: float, base_signature: float, mods: Dictionary) -> Dictionary:
|
|
return {
|
|
"roster_dps": snappedf(base_roster * float(mods["roster_mult"]) + float(mods["flat_roster"]), 0.0001),
|
|
"signature_dps": snappedf(base_signature * float(mods["signature_mult"]), 0.0001),
|
|
"click_mult": snappedf(float(mods["click_mult"]), 0.0001),
|
|
"storm_mult": snappedf(float(mods["storm_mult"]), 0.0001),
|
|
}
|