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_017NTjSa2VgCtWZWVm573NB6main
parent
e13368ab17
commit
7743a9b8d2
|
|
@ -20,6 +20,8 @@ var death_sound = preload("res://assets/music&sfx/sfx/hit2.wav")
|
||||||
var last_direction := Vector2.DOWN
|
var last_direction := Vector2.DOWN
|
||||||
signal died
|
signal died
|
||||||
var xp = 1
|
var xp = 1
|
||||||
|
var explosion_scene = preload("res://scenes/explosion.tscn")
|
||||||
|
var is_tagged: bool = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
add_to_group("enemies")
|
add_to_group("enemies")
|
||||||
|
|
@ -41,6 +43,8 @@ func _on_base_body_exited(body: Node2D) -> void:
|
||||||
|
|
||||||
func die():
|
func die():
|
||||||
is_dying = true
|
is_dying = true
|
||||||
|
if is_tagged:
|
||||||
|
modulate = Color.WHITE
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
var death_anim: String
|
var death_anim: String
|
||||||
if abs(last_direction.x) >= abs(last_direction.y):
|
if abs(last_direction.x) >= abs(last_direction.y):
|
||||||
|
|
@ -66,6 +70,12 @@ func _play_hit_sound() -> void:
|
||||||
func take_damage(amount: int) -> void:
|
func take_damage(amount: int) -> void:
|
||||||
if is_dying:
|
if is_dying:
|
||||||
return
|
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
|
hp -= amount
|
||||||
if hp <= 0:
|
if hp <= 0:
|
||||||
die()
|
die()
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ var cauldron
|
||||||
var available_perks: Array[Perk] = []
|
var available_perks: Array[Perk] = []
|
||||||
var spell_modes: Dictionary = {}
|
var spell_modes: Dictionary = {}
|
||||||
var laser_retarget_enabled = false
|
var laser_retarget_enabled = false
|
||||||
|
var shuriken_tag_enabled = false
|
||||||
var throwing_knife_enabled = false
|
var throwing_knife_enabled = false
|
||||||
var throwing_knife_cooldown: float = 2.0
|
var throwing_knife_cooldown: float = 2.0
|
||||||
var throwing_knife_count: int = 1
|
var throwing_knife_count: int = 1
|
||||||
|
|
@ -197,6 +198,15 @@ func _ready() -> void:
|
||||||
bh.effect = battle_hardened
|
bh.effect = battle_hardened
|
||||||
available_perks.append(bh)
|
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()
|
var ss = Perk.new()
|
||||||
ss.name = "Swift Strike"
|
ss.name = "Swift Strike"
|
||||||
ss.description = "Attack more often"
|
ss.description = "Attack more often"
|
||||||
|
|
@ -221,6 +231,9 @@ func _process(delta: float) -> void:
|
||||||
func laser_retarget():
|
func laser_retarget():
|
||||||
laser_retarget_enabled = true
|
laser_retarget_enabled = true
|
||||||
|
|
||||||
|
func enable_marked_prey() -> void:
|
||||||
|
shuriken_tag_enabled = true
|
||||||
|
|
||||||
func double_shuriken():
|
func double_shuriken():
|
||||||
witch.shuriken_count += 2
|
witch.shuriken_count += 2
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
extends ProjectileBase
|
extends ProjectileBase
|
||||||
|
|
||||||
var enemies_hit = 0
|
var enemies_hit = 0
|
||||||
|
@onready var perk_effects = get_node("/root/Game/PerkEffects")
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
speed = 500
|
speed = 500
|
||||||
super()
|
super()
|
||||||
|
|
@ -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:
|
if body.is_in_group("enemies") and not body.is_hurt and not body.is_dying:
|
||||||
enemies_hit += 1
|
enemies_hit += 1
|
||||||
body.take_damage(damage)
|
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:
|
if enemies_hit == 20:
|
||||||
queue_free()
|
queue_free()
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue