feat: complete playtest parity improvements
This commit is contained in:
@@ -15,7 +15,8 @@ func _init(scripted_rolls: Array[float] = []) -> void:
|
||||
_rolls.assign(scripted_rolls)
|
||||
|
||||
func resolve_attack(attacker: ActorState, defender: ActorState, grant_xp: bool = true) -> Dictionary:
|
||||
var events: Array[Dictionary] = [_event(&"attack_started", attacker, defender, {"stance": String(attacker.stance)})]
|
||||
var attack_method := String(attacker.metadata.get("melee_weapon_name", "mains nues" if attacker.id == &"player" else "attaque naturelle"))
|
||||
var events: Array[Dictionary] = [_event(&"attack_started", attacker, defender, {"stance": String(attacker.stance), "attack_method": attack_method})]
|
||||
var attack_score := attacker.accuracy - attacker.wound_severity(&"arms") * ARM_WOUND_PENALTY
|
||||
var defense_score := defender.defense * 3 - defender.wound_severity(&"legs") * LEG_WOUND_PENALTY
|
||||
if defender.stance == &"dodge":
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
class_name HealthRegeneration
|
||||
extends RefCounted
|
||||
|
||||
const ENDURANCE_DIVISOR := 3
|
||||
const SKILL_AMPLIFIER := 0.15
|
||||
const DIFFICULTY_MULTIPLIERS := {
|
||||
&"touriste": 1.5,
|
||||
&"crawler": 1.0,
|
||||
&"veteran": 0.75,
|
||||
&"masochiste": 0.5,
|
||||
}
|
||||
|
||||
static func amount(endurance: int, regeneration_skill: int = 1, perk_bonus: int = 0, difficulty_id: StringName = &"crawler") -> int:
|
||||
var base := maxi(1, endurance / ENDURANCE_DIVISOR)
|
||||
var skill_bonus := maxi(0, regeneration_skill - 1)
|
||||
var total := float(base + maxi(0, perk_bonus)) * (1.0 + float(skill_bonus) * SKILL_AMPLIFIER)
|
||||
return maxi(0, int(total * float(DIFFICULTY_MULTIPLIERS.get(difficulty_id, 1.0))))
|
||||
|
||||
static func apply(actor: ActorState, endurance: int, regeneration_skill: int = 1, perk_bonus: int = 0, difficulty_id: StringName = &"crawler") -> int:
|
||||
if actor == null or not actor.is_alive():
|
||||
return 0
|
||||
var before := actor.hit_points
|
||||
actor.hit_points = mini(actor.effective_max_hit_points(), actor.hit_points + amount(endurance, regeneration_skill, perk_bonus, difficulty_id))
|
||||
return actor.hit_points - before
|
||||
@@ -0,0 +1 @@
|
||||
uid://3ccnf6g0ily8
|
||||
@@ -37,6 +37,9 @@ func resolve(map: GridMapState, attacker: ActorState, target: ActorState) -> Dic
|
||||
"events": events,
|
||||
}
|
||||
|
||||
func validation_reason(map: GridMapState, attacker: ActorState, target: ActorState) -> StringName:
|
||||
return _validation_reason(map, attacker, target)
|
||||
|
||||
func _validation_reason(map: GridMapState, attacker: ActorState, target: ActorState) -> StringName:
|
||||
if attacker == null or target == null or attacker == target or attacker.id == target.id or not target.is_alive():
|
||||
return &"invalid_target"
|
||||
|
||||
Reference in New Issue
Block a user