Kill half of enemies in room
This commit is contained in:
@@ -43,6 +43,8 @@ public partial class EffectItem : Node3D, IUsableItem
|
||||
Game.DoubleEXP(TimeSpan.FromSeconds(30));
|
||||
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.TeleportAllEnemiesToRoom))
|
||||
TeleportEnemiesToCurrentRoom();
|
||||
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.KillHalfEnemiesInRoom))
|
||||
KillHalfEnemiesInRoom();
|
||||
}
|
||||
|
||||
public void SetItemStats(InventoryItemStats inventoryItemStats)
|
||||
@@ -88,4 +90,19 @@ public partial class EffectItem : Node3D, IUsableItem
|
||||
enemy.SetEnemyGlobalPosition(randomSpawnPoint.GlobalPosition);
|
||||
}
|
||||
}
|
||||
|
||||
private void KillHalfEnemiesInRoom()
|
||||
{
|
||||
var currentRoom = Player.GetCurrentRoom();
|
||||
if (currentRoom is not MonsterRoom)
|
||||
return;
|
||||
|
||||
var currentMonsterRoom = (MonsterRoom)currentRoom;
|
||||
var enemyList = currentMonsterRoom.GetEnemiesInCurrentRoom().ToList();
|
||||
var enemiesToKill = enemyList.Count / 2;
|
||||
for (var i = 0; i < enemiesToKill; i++)
|
||||
{
|
||||
enemyList[i].Die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
src/items/effect/resources/DevicBalance.tres
Normal file
18
src/items/effect/resources/DevicBalance.tres
Normal file
@@ -0,0 +1,18 @@
|
||||
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://cxfu683mhpu6v"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="1_50lqu"]
|
||||
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_j7j7j"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_50lqu")
|
||||
UsableItemTags = Array[int]([6])
|
||||
Name = "Devic Balance"
|
||||
Description = "Kill half of all enemies in current room."
|
||||
Texture = ExtResource("1_j7j7j")
|
||||
SpawnRate = 0.5
|
||||
ThrowSpeed = 12.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTags = Array[int]([])
|
||||
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"
|
||||
Reference in New Issue
Block a user