diff --git a/scripts/enemy_base.gd b/scripts/enemy_base.gd index 17e344a..d61600f 100644 --- a/scripts/enemy_base.gd +++ b/scripts/enemy_base.gd @@ -22,6 +22,10 @@ signal died var xp = 1 var explosion_scene = preload("res://scenes/explosion.tscn") var is_tagged: bool = false +var _push_velocity: Vector2 = Vector2.ZERO + +func apply_push(dir: Vector2, strength: float) -> void: + _push_velocity = dir * strength func _ready() -> void: add_to_group("enemies") @@ -109,6 +113,11 @@ func _chase_witch() -> void: if direction != Vector2.ZERO: last_direction = direction velocity = direction * speed + if _push_velocity != Vector2.ZERO: + velocity += _push_velocity + _push_velocity *= 0.82 + if _push_velocity.length() < 5.0: + _push_velocity = Vector2.ZERO if direction == Vector2.ZERO: animated_sprite_2d.play("idle") diff --git a/scripts/perk_effects.gd b/scripts/perk_effects.gd index 0426cf5..e7810c7 100644 --- a/scripts/perk_effects.gd +++ b/scripts/perk_effects.gd @@ -9,6 +9,7 @@ var available_perks: Array[Perk] = [] var spell_modes: Dictionary = {} var laser_retarget_enabled = false var shuriken_tag_enabled = false +var tornado_push_on_cast = false var throwing_knife_enabled = false var throwing_knife_cooldown: float = 2.0 var throwing_knife_count: int = 1 @@ -198,6 +199,15 @@ func _ready() -> void: bh.effect = battle_hardened available_perks.append(bh) + var rw = Perk.new() + rw.name = "Repulsion Wave" + rw.description = "Casting Tornado blasts all enemies away from the witch" + rw.stats = _stat_toggle("Push on Cast") + rw.spell = SpellLibrary.TORNADO + rw.icon = _icon_fireball + rw.effect = enable_tornado_push + available_perks.append(rw) + var mp = Perk.new() mp.name = "Marked Prey" mp.description = "Shuriken marks enemies. The next spell that hits them triggers an extra explosion" @@ -234,6 +244,9 @@ func laser_retarget(): func enable_marked_prey() -> void: shuriken_tag_enabled = true +func enable_tornado_push() -> void: + tornado_push_on_cast = true + func double_shuriken(): witch.shuriken_count += 2 diff --git a/scripts/witch.gd b/scripts/witch.gd index c71df1b..415a5d6 100644 --- a/scripts/witch.gd +++ b/scripts/witch.gd @@ -150,6 +150,11 @@ func shoot_shuriken(): func shoot_tornado(): StatsManager.on_spell_cast("tornado") + if perk_effects.tornado_push_on_cast: + for enemy in get_tree().get_nodes_in_group("enemies"): + if is_instance_valid(enemy) and not enemy.is_dying: + var push_dir = global_position.direction_to(enemy.global_position) + enemy.apply_push(push_dir, 500.0) var target = get_nearest_enemy(global_position) var tw = tornado.instantiate() tw.global_position = target.global_position if target != null else global_position