5c1e881a53
Bull charge damage: - Tunnel-proof swept detection (prev→now segment) for matador gore and bear ram, so a 66 m/s dash no longer skips clean over the thin HitArea. - Horns-first cone (bull_gore_arc): running into an enemy only wounds it when charging roughly at it, not a sideways brush. - Dash is a committed lunge: bypasses the horns cone AND the survival roll, so a dash connect is a guaranteed kill. Cruise charges keep a speed-scaled roll (mat_charge_pierce). Roll ability defers to its own pop (is_rolling guard). Bear: - Horns-first swept ram detection (edge-triggered: one charge = one wound); a tunnelling or point-blank charge now lands where body_entered wouldn't. - Overhead smash lane extends faster (0.1s) and further (20 m). - Leap slam launches the bull from anywhere in the circle (ring_frac 0). - Removed stray-quote syntax errors that broke the script. Matador: - Collider-driven stab (BladeHitbox) with recovery beat + taunt-after-hit so it stops machine-gunning the bull. - A taunting matador answers a charge: spear from range, sword up close. Spear projectile masks the BULL layer so throws connect. Tests: matador_charge/stab/spear/taunt_react, bear_ram/hitbox/fx (+ unified _fake_bull stand-in). Trimmed verbose comments. Note: bear claw-emitter/death work is still WIP (3 bear_boss_test failures). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
102 lines
4.1 KiB
GDScript
102 lines
4.1 KiB
GDScript
extends SceneTree
|
|
## Matador stab-reliability test. The matador runs in, plants at mat_stab_standoff, and its stab
|
|
## damages off the sword's own BladeHitbox collider (armed only during the thrust) — NOT a distance
|
|
## check. This drives the attack tick against a STATIONARY, real-sized bull placed beyond the
|
|
## standoff and asserts it (a) gores the bull when the thrust physically reaches it, (b) lands the
|
|
## hit during the thrust and not the wind-up/walk-up, and (c) plants at the standoff, not inside the
|
|
## bull, and (d) keeps landing on repeat stabs from the same spot (the blade re-arms each swing).
|
|
## Run: godot --headless --script res://tests/matador_stab_test.gd
|
|
|
|
var _pass := 0
|
|
var _fail := 0
|
|
|
|
|
|
func _init() -> void:
|
|
_run.call_deferred()
|
|
|
|
|
|
func _ok(c: bool, m: String) -> void:
|
|
if c:
|
|
_pass += 1
|
|
print(" PASS: ", m)
|
|
else:
|
|
_fail += 1
|
|
print(" FAIL: ", m)
|
|
|
|
|
|
func _run() -> void:
|
|
var dp := root.get_node("/root/DP")
|
|
var standoff: float = dp.f("mat_stab_standoff")
|
|
var strike_at: float = dp.f("mat_stab_strike_at")
|
|
|
|
# Stationary, real-sized bull beyond the standoff — the matador runs in, plants at the standoff,
|
|
# and its THRUST (not the walk-up) has to reach across the gap to gore it.
|
|
var bull := CharacterBody3D.new()
|
|
bull.collision_layer = 2
|
|
bull.collision_mask = 0
|
|
bull.add_to_group(&"player")
|
|
bull.set_script(load("res://tests/_fake_bull.gd"))
|
|
var bcs := CollisionShape3D.new()
|
|
var bshape := CapsuleShape3D.new()
|
|
bshape.radius = 0.75
|
|
bshape.height = 1.845
|
|
bcs.shape = bshape
|
|
bull.add_child(bcs)
|
|
root.add_child(bull)
|
|
bull.global_position = Vector3(0.0, 0.0, standoff + 3.0)
|
|
|
|
var mat := (load("res://Matador.tscn") as PackedScene).instantiate() as CharacterBody3D
|
|
root.add_child(mat) # _ready acquires the bull from the "player" group
|
|
mat.global_position = Vector3.ZERO
|
|
mat.set_physics_process(false) # we drive the attack tick ourselves, isolated from the AI
|
|
await physics_frame
|
|
mat.call("_acquire_bull") # normally done in _physics_process, which we disabled
|
|
|
|
_ok(mat.get("_bull") == bull, "matador acquired the bull")
|
|
mat.call("_carry_sword", true) # actually draw into the hand so the BladeHitbox rides the thrust
|
|
mat.call("_start_attack")
|
|
|
|
dp.call("set_value", "mat_stab_followup_chance", 0.0) # isolate repeat stabs from the break-off roll
|
|
dp.call("set_value", "mat_stab_recovery", 0.0) # no recovery beat gating back-to-back stabs
|
|
dp.call("set_value", "mat_taunt_after_hit", 0.0) # don't break off to taunt after a landed hit
|
|
|
|
var min_dist := 999.0
|
|
var first_hit_phase := -1.0
|
|
var last_hits := 0
|
|
for i in 300: # several swings' worth of ticks (approach + repeated stabs)
|
|
mat.call("_tick_attack", 1.0 / 60.0)
|
|
var d := mat.global_position.distance_to(bull.global_position)
|
|
min_dist = minf(min_dist, d)
|
|
if bull.hits > last_hits:
|
|
if first_hit_phase < 0.0:
|
|
first_hit_phase = mat.call("_swing_phase") # phase on the frame the first hit landed
|
|
last_hits = bull.hits
|
|
await physics_frame
|
|
|
|
_ok(bull.hits >= 1, "the sword's thrust reaches across the standoff and gores the bull")
|
|
_ok(first_hit_phase >= strike_at - 0.1, "hit lands in the thrust, not the wind-up (phase %.2f)" % first_hit_phase)
|
|
_ok(bull.hits >= 2, "repeat stabs from the same spot keep landing (%d hits)" % bull.hits)
|
|
_ok(min_dist >= standoff - 0.5, "matador plants at the standoff, not inside the bull (closest %.2f m)" % min_dist)
|
|
|
|
# Anti-spam: once a stab CONNECTS, a high mat_taunt_after_hit must break the matador off ATTACK
|
|
# (into a taunt/retreat) instead of drilling the bull again. Force the roll and confirm it leaves.
|
|
dp.call("set_value", "mat_taunt_after_hit", 1.0)
|
|
bull.hits = 0
|
|
mat.call("_start_attack")
|
|
var broke_off := false
|
|
for i in 200:
|
|
mat.call("_tick_attack", 1.0 / 60.0)
|
|
if mat.call("ai_state_name") != "ATTACK":
|
|
broke_off = true
|
|
break
|
|
await physics_frame
|
|
_ok(broke_off, "a landed stab breaks the matador off ATTACK (taunt/retreat), not another thrust")
|
|
_ok(bull.hits >= 1, "the break-off only fires after the stab actually connected (%d hits)" % bull.hits)
|
|
|
|
_finish()
|
|
|
|
|
|
func _finish() -> void:
|
|
print("Results: %d passed, %d failed" % [_pass, _fail])
|
|
quit(1 if _fail > 0 else 0)
|