Skip to content

Commit 6f1c868

Browse files
Update SetDoorHealthMethod.cs
1 parent de68eb1 commit 6f1c868

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

MethodSystem/Methods/DoorMethods/SetDoorHealthMethod.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
using SER.ArgumentSystem.Arguments;
33
using SER.ArgumentSystem.BaseArguments;
44
using SER.MethodSystem.BaseMethods;
5+
using SER.MethodSystem.MethodDescriptors;
56

67
namespace SER.MethodSystem.Methods.DoorMethods;
7-
public class SetDoorHealthMethod : SynchronousMethod
8+
9+
public class SetDoorHealthMethod : SynchronousMethod, IAdditionalDescription
810
{
9-
public override string Description => "Sets remaining health for specified doors if possible (for example, you can't set health for Gate B, but you can set health for normal HCZ doors)";
11+
public override string Description => "Sets remaining health for specified doors if possible";
12+
13+
public string AdditionalDescription =>
14+
"This is only applicable for doors that can break, like HCZ doors and not gates.";
1015

1116
public override Argument[] ExpectedArguments =>
1217
[
@@ -16,14 +21,9 @@ public class SetDoorHealthMethod : SynchronousMethod
1621

1722
public override void Execute()
1823
{
19-
float HP = Args.GetFloat("health");
2024
Door[] doors = Args.GetDoors("doors");
21-
foreach(Door door in doors)
22-
{
23-
if(door is BreakableDoor brek)
24-
{
25-
brek.Health = HP;
26-
}
27-
}
25+
float health = Args.GetFloat("health");
26+
27+
doors.OfType<Door, BreakableDoor>().ForEach(door => door.Health = health);
2828
}
2929
}

0 commit comments

Comments
 (0)