[agent:claude-cli] feat(mobs): shark pursuit 15u + dégâts -20HP + knockback, fish school fuite boost, drops requin(dent)/méduse(gelée), recettes Amulette T2 + Lampe Portable

This commit is contained in:
2026-04-21 08:43:17 +00:00
parent 64b69fd181
commit 42101246d9
7 changed files with 84 additions and 8 deletions

View File

@@ -110,13 +110,20 @@ func _update_boids(dt: float) -> void:
if center_offset.length() > school_radius:
vel += -center_offset.normalized() * 1.5 * dt * 4.0
# --- Player avoidance ---
# --- Player avoidance (boosted player = bigger + faster flee) ---
if is_instance_valid(_player):
var world_fish_pos: Vector3 = global_position + fish.position
var dist_to_player: float = world_fish_pos.distance_to(_player.global_position)
if dist_to_player < 3.0:
var player_boosting: bool = _player.get("is_boosting") if "is_boosting" in _player else false
var flee_radius: float = 6.0 if player_boosting else 3.0
var flee_force: float = 9.0 if player_boosting else 4.0
if dist_to_player < flee_radius:
var flee: Vector3 = (world_fish_pos - _player.global_position).normalized()
vel += flee * 4.0 * dt * (3.0 - dist_to_player)
# Only flee if player is moving toward the school
var player_vel: Vector3 = _player.velocity if "velocity" in _player else Vector3.ZERO
var toward: bool = player_vel.dot((world_fish_pos - _player.global_position).normalized()) > 0.2
if toward or player_boosting:
vel += flee * flee_force * dt * (flee_radius - dist_to_player)
# Clamp speed
if vel.length() > swim_speed * 1.5: