iter51-卡2
This commit is contained in:
1 parent
1cd6e2b1b0
commit
372b4fdc31
27 files changed
+1231
-356
No files matched your search
@@ -44,16 +44,33 @@ var _hero_ac_override := -1 # 主角护甲等级合流入参(begin_battle
|
||||
# 效果端口件(组装期单点注入——host _init bind_port):发射/计数器/事实/揭示/AC 全经端口路由,
|
||||
# 缺省 null=未绑(与原 _fx==null 零扰动守卫同语义——单测直构不接端口的夹具零扰动照跑)
|
||||
var _port: EffectPort = null
|
||||
var facts: BattleFacts # 战斗事实件引用(构造注入——hero_atk 派生读消费面)
|
||||
|
||||
|
||||
func _init(db_ref, rng_ref, units_ref, effects_ref) -> void:
|
||||
func _init(db_ref, rng_ref, units_ref, effects_ref, facts_ref) -> void:
|
||||
db = db_ref
|
||||
rng = rng_ref
|
||||
units = units_ref
|
||||
effects = effects_ref
|
||||
facts = facts_ref
|
||||
units.unit_died.connect(_on_unit_died)
|
||||
|
||||
|
||||
# 主角攻击基值派生读(enc 携带 hero_atk 键受理后只读——E4 收口语义不变:表值运行期不可变,
|
||||
# 派生值恒等;自编排器归位(5.1 封装修复——伤害域原语),「读面即引用、无第二账」同款先例)
|
||||
func hero_atk() -> int:
|
||||
return int(facts.encounter.get("hero_atk", int(db.combat.hero.atk)))
|
||||
|
||||
|
||||
# 效果命中过滤(按效果类型取命中子集——发射点分桶施加面;自编排器归位)
|
||||
static func hits_of(hits: Array, kind: String) -> Array:
|
||||
var out: Array[Variant] = []
|
||||
for h in hits:
|
||||
if String((h as Dictionary).get("kind", "")) == kind:
|
||||
out.append(h)
|
||||
return out
|
||||
|
||||
|
||||
# 主角护甲等级合流入参(战斗编排器 begin_battle 调用——encounter.hero_armor_class;缺参/-1 = 表值兜底)
|
||||
func set_hero_ac_override(v: int) -> void:
|
||||
_hero_ac_override = v
|
||||
@@ -423,7 +440,7 @@ func _hero_attack_deliver(t: Dictionary, ctx: Dictionary, redemption: Dictionary
|
||||
# 敌方伤害技:掷点 → 折扣/暴击 → 克制点数(attack_type vs 主角护甲类型——
|
||||
# 无类型恒中性 delta 0,写法同 hero_attack 的 _counter_delta 消费位)→ hero_defense×enemy_output
|
||||
# 池乘区 → 下限 → +rider(后置必中附加)→ 交付 → commit_action(作废单不 commit——死亡即不动手)。
|
||||
# 掷点算术归 _enemy_roll;damage_taken 统一发射+消费归 _emit_hero_damage_taken(发射在本函数——
|
||||
# 掷点算术归 _enemy_roll;damage_taken 统一发射+消费归 emit_hero_damage_taken(发射在本函数——
|
||||
# 与减伤落快照的先后序固定;「掷点后、交付前」消费时点不变)。
|
||||
func _resolve_enemy_skill(t: Dictionary) -> void:
|
||||
var hero: Dictionary[Variant, Variant] = units.hero_unit()
|
||||
@@ -432,7 +449,7 @@ func _resolve_enemy_skill(t: Dictionary) -> void:
|
||||
# damage_taken 发射(kind=enemy_skill;shield 减伤订阅面:加法族合计 value×per 计数器层值,
|
||||
# 稳健拓荒树规则同面(rebuild 合成订阅);减后过下限保底。damage_reduce〔背水 hp_ratio when〕/
|
||||
# counter_add〔保险丝/石肤〕/ac_bonus〔石肤〕同面施加;hp_ratio fact 由 damage_taken 载荷携带)
|
||||
var dt_res := _emit_hero_damage_taken(total, "enemy_skill", String(t.context.get("skill_id", "")), t.origin_cell, int(t.round_index))
|
||||
var dt_res := emit_hero_damage_taken(total, "enemy_skill", String(t.context.get("skill_id", "")), t.origin_cell, int(t.round_index))
|
||||
total = int(dt_res["total"])
|
||||
units.apply_damage(hero, total)
|
||||
var payload: Dictionary[Variant, Variant] = {"target": "hero", "skill_id": String(t.context.get("skill_id", "")), "baseline": int(t.context.get("baseline", 0)),
|
||||
@@ -468,7 +485,7 @@ func _enemy_roll(t: Dictionary) -> Dictionary:
|
||||
# 资源直伤(后三者经 board_flat_hero 单据进入)都经此 dispatch 一次 damage_taken 并消费一次;
|
||||
# 同一伤害单据重复发射由 context.hero_damage_consumed 标记闸拦(地形路径在开单点标记)。
|
||||
# payload 必含 kind/amount/source/cell/round/hp_ratio;返回 {total, hits} 交调用侧按减后值开单/交付)。
|
||||
func _emit_hero_damage_taken(amount: int, damage_kind: String, source: String, cell: Vector2i, ri: int) -> Dictionary:
|
||||
func emit_hero_damage_taken(amount: int, damage_kind: String, source: String, cell: Vector2i, ri: int) -> Dictionary:
|
||||
var hu: Dictionary[Variant, Variant] = units.hero_unit()
|
||||
var payload: Dictionary[Variant, Variant] = {"kind": damage_kind, "amount": amount, "source": source,
|
||||
"cell": cell, "round": ri, "hp_ratio": int(round(100.0 * float(int(hu.get("hp", 0))) / float(maxi(1, int(hu.get("max_hp", 1))))))}
|
||||
@@ -544,7 +561,7 @@ func _resolve_board_blast(t: Dictionary) -> void:
|
||||
func _resolve_board_flat_hero(t: Dictionary) -> void:
|
||||
var dealt: int = int(t.base_value)
|
||||
if not bool((t.get("context", {}) as Dictionary).get("hero_damage_consumed", false)):
|
||||
var res_flat := _emit_hero_damage_taken(dealt, "board_flat_hero", String(t.get("source_class", "")), t.origin_cell, int(t.round_index))
|
||||
var res_flat := emit_hero_damage_taken(dealt, "board_flat_hero", String(t.get("source_class", "")), t.origin_cell, int(t.round_index))
|
||||
dealt = int(res_flat["total"])
|
||||
dealt = maxi(int(db.combat.settlement.damage_roll.damage_floor), dealt) # 伤害下限全来源(减后过下限)
|
||||
units.apply_damage(units.hero_unit(), dealt)
|
||||
|
||||
Reference in new issue
Block a user