feat: Wut-Ressource für den Krieger implementiert
- warrior.tres: resource_type=RAGE, base_resource=100 - _gain_rage(): Wut aufbauen + Decay-Timer zurücksetzen - _spend_rage(): Wut verbrauchen mit Prüfung (return false wenn zu wenig) - _update_rage_decay(): Wut verfällt nach 5s außerhalb Kampf (10/s) - take_damage(): +15 Wut wenn Krieger Treffer einsteckt - Heavy Strike: +20 Wut beim Schaden austeilen Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9f63249753
commit
b4d37a7836
2 changed files with 37 additions and 0 deletions
|
|
@ -15,3 +15,5 @@ stamina_per_level = 2.5
|
|||
unarmed_min_damage = 2
|
||||
unarmed_max_damage = 4
|
||||
unarmed_attack_speed = 1.8
|
||||
resource_type = 2
|
||||
base_resource = 100
|
||||
|
|
|
|||
35
player.gd
35
player.gd
|
|
@ -87,6 +87,11 @@ var max_mana: int:
|
|||
var current_mana: int:
|
||||
get: return current_resource
|
||||
|
||||
# Wut-Verfall
|
||||
const RAGE_DECAY_DELAY: float = 5.0 # Sekunden nach letztem Kampfkontakt
|
||||
const RAGE_DECAY_RATE: float = 10.0 # Wut pro Sekunde Verfall
|
||||
var _rage_decay_timer: float = 0.0
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════
|
||||
# EQUIPMENT
|
||||
# ═══════════════════════════════════════════════════════════════
|
||||
|
|
@ -413,6 +418,7 @@ func take_damage(amount: int):
|
|||
var effective = max(1, amount - int(armor * 0.1))
|
||||
current_hp = clamp(current_hp - effective, 0, max_hp)
|
||||
hud.update_health(current_hp, max_hp)
|
||||
_gain_rage(15)
|
||||
if current_hp <= 0:
|
||||
die()
|
||||
|
||||
|
|
@ -424,6 +430,31 @@ func restore_mana(amount: int):
|
|||
current_resource = clamp(current_resource + amount, 0, max_resource)
|
||||
hud.update_resource(current_resource, max_resource, get_resource_name())
|
||||
|
||||
func _gain_rage(amount: int):
|
||||
if character_class == null or character_class.resource_type != CharacterClass.ResourceType.RAGE:
|
||||
return
|
||||
current_resource = clamp(current_resource + amount, 0, max_resource)
|
||||
_rage_decay_timer = RAGE_DECAY_DELAY
|
||||
hud.update_resource(current_resource, max_resource, get_resource_name())
|
||||
|
||||
func _spend_rage(amount: int) -> bool:
|
||||
if current_resource < amount:
|
||||
return false
|
||||
current_resource -= amount
|
||||
hud.update_resource(current_resource, max_resource, get_resource_name())
|
||||
return true
|
||||
|
||||
func _update_rage_decay(delta: float):
|
||||
if character_class == null or character_class.resource_type != CharacterClass.ResourceType.RAGE:
|
||||
return
|
||||
if current_resource <= 0:
|
||||
return
|
||||
if _rage_decay_timer > 0.0:
|
||||
_rage_decay_timer -= delta
|
||||
return
|
||||
current_resource = max(0, current_resource - int(RAGE_DECAY_RATE * delta))
|
||||
hud.update_resource(current_resource, max_resource, get_resource_name())
|
||||
|
||||
func die():
|
||||
if is_dead:
|
||||
return
|
||||
|
|
@ -632,6 +663,7 @@ func _do_heavy_strike():
|
|||
return
|
||||
var damage = randi_range(10, 15) + int(strength * 0.5)
|
||||
target.take_damage(damage)
|
||||
_gain_rage(20)
|
||||
skill_cooldowns["heavy_strike"] = HEAVY_STRIKE_COOLDOWN
|
||||
trigger_global_cooldown()
|
||||
start_autoattack()
|
||||
|
|
@ -957,6 +989,9 @@ func _physics_process(delta):
|
|||
if is_dead:
|
||||
return
|
||||
|
||||
# ── Wut-Verfall ───────────────────────────────────────────
|
||||
_update_rage_decay(delta)
|
||||
|
||||
# ── Cooldowns herunterzählen ──────────────────────────────
|
||||
var gcd_was_active = global_cooldown > 0
|
||||
if global_cooldown > 0:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue