Implement Heaven's Rebellion
This commit is contained in:
@@ -158,6 +158,16 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
Game.EnemyDefeated(GlobalPosition, _enemyStatResource);
|
||||
}
|
||||
|
||||
public void SetCurrentHP(int targetHP)
|
||||
{
|
||||
_currentHP.OnNext(targetHP);
|
||||
}
|
||||
|
||||
public int GetMaximumHP()
|
||||
{
|
||||
return _enemyStatResource.MaximumHP;
|
||||
}
|
||||
|
||||
public void StartAttackTimer()
|
||||
{
|
||||
_attackTimer.Timeout += OnAttackTimeout;
|
||||
|
||||
@@ -9,7 +9,7 @@ public partial class EnemyStatResource : Resource
|
||||
public double CurrentHP { get; set; }
|
||||
|
||||
[Export]
|
||||
public double MaximumHP { get; set; }
|
||||
public int MaximumHP { get; set; }
|
||||
|
||||
[Export]
|
||||
public int CurrentAttack { get; set; }
|
||||
|
||||
@@ -14,6 +14,10 @@ public interface IEnemy : IKillable
|
||||
|
||||
public double CurrentHP { get; }
|
||||
|
||||
public void SetCurrentHP(int newHP);
|
||||
|
||||
public int GetMaximumHP();
|
||||
|
||||
public void StartAttackTimer();
|
||||
|
||||
public void StopAttackTimer();
|
||||
|
||||
@@ -47,6 +47,8 @@ public partial class EffectItem : Node3D, IUsableItem
|
||||
KillHalfEnemiesInRoom();
|
||||
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.TurnAllEnemiesIntoHealingItem))
|
||||
TurnAllEnemiesInRoomIntoHealingItem();
|
||||
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.HealsAllInRoomToMaxHP))
|
||||
HealAllEnemiesAndPlayerInRoomToFull();
|
||||
}
|
||||
|
||||
public void SetItemStats(InventoryItemStats inventoryItemStats)
|
||||
@@ -131,4 +133,13 @@ public partial class EffectItem : Node3D, IUsableItem
|
||||
Game.AddChild(consumable);
|
||||
consumable.GlobalPosition = vector;
|
||||
}
|
||||
|
||||
private void HealAllEnemiesAndPlayerInRoomToFull()
|
||||
{
|
||||
var currentRoom = Player.GetCurrentRoom();
|
||||
var currentEnemies = currentRoom.EnemiesInRoom;
|
||||
foreach (var enemy in currentEnemies)
|
||||
enemy.SetCurrentHP(enemy.GetMaximumHP());
|
||||
Player.Stats.SetCurrentHP(Player.Stats.MaximumHP.Value);
|
||||
}
|
||||
}
|
||||
|
||||
18
src/items/effect/resources/HeavensRebellion.tres
Normal file
18
src/items/effect/resources/HeavensRebellion.tres
Normal file
@@ -0,0 +1,18 @@
|
||||
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://5tbtsch3qagg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="1_drp30"]
|
||||
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_g0a3x"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_drp30")
|
||||
UsableItemTags = Array[int]([8])
|
||||
Name = "Heaven's Rebellion"
|
||||
Description = "Heals self and all enemies in current room to maximum HP."
|
||||
Texture = ExtResource("1_g0a3x")
|
||||
SpawnRate = 0.5
|
||||
ThrowSpeed = 12.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTags = Array[int]([])
|
||||
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"
|
||||
@@ -16,7 +16,7 @@
|
||||
[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://cwh5w1yabwrxf" path="res://src/items/effect/resources/SineMorphization.tres" id="17_db2o3"]
|
||||
[ext_resource type="Resource" uid="uid://5tbtsch3qagg" path="res://src/items/effect/resources/HeavensRebellion.tres" id="17_ntxe5"]
|
||||
[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"]
|
||||
@@ -891,7 +891,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")
|
||||
_effectItemStats = ExtResource("17_ntxe5")
|
||||
|
||||
[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)
|
||||
|
||||
@@ -17,7 +17,7 @@ script = ExtResource("2_xq68d")
|
||||
RotationSpeed = 1.5
|
||||
MoveSpeed = 8.0
|
||||
Acceleration = 1.0
|
||||
CurrentHP = 100
|
||||
CurrentHP = 50
|
||||
MaximumHP = 100
|
||||
CurrentVT = 90
|
||||
MaximumVT = 90
|
||||
|
||||
Reference in New Issue
Block a user