Kill half of enemies in room
This commit is contained in:
@@ -148,6 +148,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
|
||||
public void Die()
|
||||
{
|
||||
_currentHP.OnNext(0);
|
||||
_enemyLogic.Input(new EnemyLogic.Input.EnemyDefeated());
|
||||
_collisionShape.SetDeferred("disabled", true);
|
||||
_enemyModelView.PlayDeathAnimation();
|
||||
|
||||
@@ -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"
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=62 format=4 uid="uid://dl6h1djc27ddl"]
|
||||
[gd_scene load_steps=63 format=4 uid="uid://dl6h1djc27ddl"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c1nhqlem1ew3m" path="res://src/map/dungeon/code/Floor0.cs" id="1_db2o3"]
|
||||
[ext_resource type="Texture2D" uid="uid://b27ksiyfefb33" path="res://src/map/dungeon/models/Set A/02. Altar/02_ALTAR_FLOOR_ZER0_VER_outside_desert.png" id="2_xh2ej"]
|
||||
@@ -16,7 +16,8 @@
|
||||
[ext_resource type="Texture2D" uid="uid://4k6vtn4oip5f" path="res://src/map/dungeon/models/Set A/02. Altar/02_ALTAR_FLOOR_ZER0_VER_TILE4.png" id="14_qqc7i"]
|
||||
[ext_resource type="Texture2D" uid="uid://cururtxtgylxf" path="res://src/map/dungeon/models/Set A/02. Altar/02_ALTAR_FLOOR_ZER0_VER_COLUMN.jpg" id="15_ojbcg"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0pl1n1jf77jm" path="res://src/items/effect/EffectItem.tscn" id="16_aqomv"]
|
||||
[ext_resource type="Resource" uid="uid://bptg6eybj5dxk" path="res://src/items/effect/resources/DevicRecall.tres" id="17_db2o3"]
|
||||
[ext_resource type="Resource" uid="uid://cxfu683mhpu6v" path="res://src/items/effect/resources/DevicBalance.tres" id="17_db2o3"]
|
||||
[ext_resource type="Resource" uid="uid://bptg6eybj5dxk" path="res://src/items/effect/resources/DevicRecall.tres" id="18_ntxe5"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3ubi4"]
|
||||
shading_mode = 0
|
||||
@@ -891,3 +892,7 @@ shape = SubResource("BoxShape3D_ntxe5")
|
||||
[node name="EffectItem" parent="." instance=ExtResource("16_aqomv")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.65239, -2.58967, -1.14642)
|
||||
_effectItemStats = ExtResource("17_db2o3")
|
||||
|
||||
[node name="EffectItem2" parent="." instance=ExtResource("16_aqomv")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.65239, -2.58967, -1.14642)
|
||||
_effectItemStats = ExtResource("18_ntxe5")
|
||||
|
||||
Reference in New Issue
Block a user