marked prey: shuriken tags enemies yellow, next spell hit triggers explosion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017NTjSa2VgCtWZWVm573NB6
main
Artur David 2026-07-07 13:57:59 +02:00
parent e13368ab17
commit 7743a9b8d2
3 changed files with 27 additions and 1 deletions

View File

@ -20,6 +20,8 @@ var death_sound = preload("res://assets/music&sfx/sfx/hit2.wav")
var last_direction := Vector2.DOWN
signal died
var xp = 1
var explosion_scene = preload("res://scenes/explosion.tscn")
var is_tagged: bool = false
func _ready() -> void:
add_to_group("enemies")
@ -41,6 +43,8 @@ func _on_base_body_exited(body: Node2D) -> void:
func die():
is_dying = true
if is_tagged:
modulate = Color.WHITE
collision_layer = 0
var death_anim: String
if abs(last_direction.x) >= abs(last_direction.y):
@ -66,6 +70,12 @@ func _play_hit_sound() -> void:
func take_damage(amount: int) -> void:
if is_dying:
return
if is_tagged:
is_tagged = false
modulate = Color.WHITE
var boom = explosion_scene.instantiate()
boom.global_position = global_position
get_parent().call_deferred("add_child", boom)
hp -= amount
if hp <= 0:
die()

View File

@ -8,6 +8,7 @@ var cauldron
var available_perks: Array[Perk] = []
var spell_modes: Dictionary = {}
var laser_retarget_enabled = false
var shuriken_tag_enabled = false
var throwing_knife_enabled = false
var throwing_knife_cooldown: float = 2.0
var throwing_knife_count: int = 1
@ -197,6 +198,15 @@ func _ready() -> void:
bh.effect = battle_hardened
available_perks.append(bh)
var mp = Perk.new()
mp.name = "Marked Prey"
mp.description = "Shuriken marks enemies. The next spell that hits them triggers an extra explosion"
mp.stats = _stat_toggle("Mark on Hit")
mp.spell = SpellLibrary.SHURIKEN
mp.icon = _icon_shuriken
mp.effect = enable_marked_prey
available_perks.append(mp)
var ss = Perk.new()
ss.name = "Swift Strike"
ss.description = "Attack more often"
@ -221,6 +231,9 @@ func _process(delta: float) -> void:
func laser_retarget():
laser_retarget_enabled = true
func enable_marked_prey() -> void:
shuriken_tag_enabled = true
func double_shuriken():
witch.shuriken_count += 2

View File

@ -1,7 +1,7 @@
extends ProjectileBase
var enemies_hit = 0
@onready var perk_effects = get_node("/root/Game/PerkEffects")
func _ready() -> void:
speed = 500
@ -17,6 +17,9 @@ func _on_body_entered(body: Node2D) -> void:
if body.is_in_group("enemies") and not body.is_hurt and not body.is_dying:
enemies_hit += 1
body.take_damage(damage)
if perk_effects.shuriken_tag_enabled and not body.is_dying:
body.is_tagged = true
body.modulate = Color(1.0, 1.0, 0.45)
if enemies_hit == 20:
queue_free()
else: