prototype vibe
This commit is contained in:
@@ -5,9 +5,10 @@ func _ready() -> void:
|
||||
|
||||
func _on_damage_requested(attacker: Node, target: Node, amount: float) -> void:
|
||||
var remaining: float = amount
|
||||
var shield_system: Node = get_node_or_null("../ShieldSystem")
|
||||
if shield_system:
|
||||
remaining = shield_system.absorb(target, remaining)
|
||||
if not target.is_in_group("tavern"):
|
||||
var shield_system: Node = get_node_or_null("../ShieldSystem")
|
||||
if shield_system:
|
||||
remaining = shield_system.absorb(target, remaining)
|
||||
EventBus.damage_dealt.emit(attacker, target, amount)
|
||||
if remaining > 0:
|
||||
_apply_damage(target, remaining)
|
||||
@@ -33,6 +34,11 @@ func _apply_damage(entity: Node, amount: float) -> void:
|
||||
if health < 0:
|
||||
health = 0
|
||||
PortalData.set_health(entity, health)
|
||||
elif entity.is_in_group("tavern"):
|
||||
var health: float = TavernData.get_stat(entity, "health") - amount
|
||||
if health < 0:
|
||||
health = 0
|
||||
TavernData.set_health(entity, health)
|
||||
|
||||
func _get_player() -> Node:
|
||||
return get_tree().get_first_node_in_group("player")
|
||||
|
||||
Reference in New Issue
Block a user