User: "数值应该都可以有对应关系." Completed the numeric provenance: - cf_formulas.py/.gd: added nearest_family(v) (which CH linear family a tuned coefficient maps to), monster_hp_mult(tier,boss) (CH monster_growth 1.6^L / 1.145^L + boss 1.5x), skill_duration_scale (CH skills.json duration 30s -> 5s combat timebase). CF_FORMULA_PARITY_PASS 41 cases py==gd. - edict_rules.py now reads coefficients from CH LINEAR_COEFF (D02=linear10 0.10, D03/D05=linear15 0.15, D04=linear20 0.20, D06=linear25 0.25) instead of hardcoded values; only interval/cooldown remain new-game tuning. - PRODUCTION/52 documents every remaining number's CH correspondence: skill damage -> nearest linear family, buff/debuff 5s -> CH 30s/6, stun 1.5s -> 5s*0.3, enemy multipliers -> CH monster curve. Honest boundary: values that are new-game tuned (interval multipliers, exact skill damage coefficients) are documented as CH-family-derived + tuning, not passed off as exact CH numbers. Full P2_CHECKS_PASS (93 gates). prototype/ untracked.
65 lines
2.5 KiB
GDScript
65 lines
2.5 KiB
GDScript
class_name EdictRules
|
|
extends RefCounted
|
|
|
|
## GDScript mirror of tools/fullgame/edict_rules.py (Stage D). 6 combat edicts
|
|
## apply global rules to every hero's skills; 3 meta edicts are out-of-combat.
|
|
## Coefficients are CH linear families from CfFormulas.LINEAR_COEFF:
|
|
## 0.10=linear10, 0.15=linear15, 0.20=linear20, 0.25=linear25.
|
|
|
|
const EDICT_RULES := {
|
|
"D01": {"kind": "combat", "interval": 0.85},
|
|
"D02": {"kind": "combat", "add_effect": {"type": "buff", "stat": "atk", "value": 0.10}},
|
|
"D03": {"kind": "combat", "add_effect": {"type": "poison", "value": 0.15, "duration": 3.0}},
|
|
"D04": {"kind": "combat", "target_mode": "lowest_hp", "add_effect": {"type": "damage", "value": 0.20}},
|
|
"D05": {"kind": "combat", "add_effect": {"type": "energy", "value": 0.15}},
|
|
"D06": {"kind": "combat", "add_effect": {"type": "summon", "value": 0.25}},
|
|
"D07": {"kind": "meta"},
|
|
"D08": {"kind": "meta"},
|
|
"D09": {"kind": "meta"},
|
|
}
|
|
const DAMAGE_LIKE := ["damage", "chain", "shield", "heal", "summon", "poison"]
|
|
|
|
|
|
static func apply(hero_skills: Array, active_edicts: Dictionary, dps: float) -> Array:
|
|
var out: Array = []
|
|
for sk0 in hero_skills:
|
|
var sk: Dictionary = (sk0 as Dictionary).duplicate(true)
|
|
var effects: Array = []
|
|
for e in sk.get("effects", []):
|
|
effects.append((e as Dictionary).duplicate())
|
|
sk["effects"] = effects
|
|
for eid in active_edicts.keys():
|
|
if not bool(active_edicts[eid]):
|
|
continue
|
|
var rule: Dictionary = EDICT_RULES.get(str(eid), {})
|
|
if rule.is_empty() or str(rule.get("kind", "")) != "combat":
|
|
continue
|
|
if rule.has("interval"):
|
|
sk["interval"] = snappedf(float(sk["interval"]) * float(rule["interval"]), 0.0001)
|
|
if rule.has("target_mode"):
|
|
sk["target_mode"] = rule["target_mode"]
|
|
if rule.has("add_effect"):
|
|
var eff: Dictionary = (rule["add_effect"] as Dictionary).duplicate()
|
|
var t := str(eff.get("type", ""))
|
|
if DAMAGE_LIKE.has(t) and eff.has("value") and eff["value"] is float:
|
|
eff["value"] = snappedf(float(eff["value"]) * dps, 0.0001)
|
|
(sk["effects"] as Array).append(eff)
|
|
out.append(sk)
|
|
return out
|
|
|
|
|
|
static func classify(active_edicts: Dictionary) -> Dictionary:
|
|
var combat: Array = []
|
|
var meta: Array = []
|
|
for eid in active_edicts.keys():
|
|
if not bool(active_edicts[eid]):
|
|
continue
|
|
var rule: Dictionary = EDICT_RULES.get(str(eid), {})
|
|
if rule.is_empty():
|
|
continue
|
|
if str(rule.get("kind", "")) == "combat":
|
|
combat.append(str(eid))
|
|
else:
|
|
meta.append(str(eid))
|
|
return {"combat": combat, "meta": meta}
|