初次提交

This commit is contained in:
2026-07-20 10:56:52 +08:00
commit 7bcc0026e0
462 changed files with 50191 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
## DamageContext — 伤害上下文数据类(必须单独放在此文件)
## 权威来源:implementation_plan.md §2.1 E-N2 P6-N49
## 禁止将 class_name DamageContext 写入 damage_context_pool.gd
extends RefCounted
class_name DamageContext
var base_damage: float = 0.0
var mult: float = 1.0
var damage_type: int = 0 # DamageType.PHYSICAL
var owner_id: int = -1
var source_tags: int = 0
var is_crit: bool = false
var pierce_rate: float = 0.0 # 护甲穿透率 0.0~1.0
func reset() -> void:
base_damage = 0.0
mult = 1.0
damage_type = 0
owner_id = -1
source_tags = 0
is_crit = false
pierce_rate = 0.0
## 伤害公式:((base_damage + add) × mult) × (1 resistance) armor
## S1 简化版:返回 base_damage * mult
func calc_damage(armor: float = 0.0, resistance: float = 0.0) -> float:
var effective_armor: float = armor * (1.0 - pierce_rate)
return max(0.0, base_damage * mult * (1.0 - resistance) - effective_armor)