Skip to content

Commit 87abee3

Browse files
Create SetHumeShieldMethod.cs
1 parent d3c4a96 commit 87abee3

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using SER.ArgumentSystem.Arguments;
2+
using SER.ArgumentSystem.BaseArguments;
3+
using SER.MethodSystem.BaseMethods;
4+
5+
namespace SER.MethodSystem.Methods.HealthMethods;
6+
7+
public class SetHumeShieldMethod : SynchronousMethod
8+
{
9+
public override string Description => "Sets hume shield for players.";
10+
11+
public override Argument[] ExpectedArguments { get; } =
12+
[
13+
new PlayersArgument("players"),
14+
new FloatArgument("amount", 0)
15+
{
16+
Description = "The amount of hume shield to set."
17+
},
18+
new FloatArgument("limit", 0)
19+
{
20+
Description = "The maximal amount of hume shield."
21+
},
22+
new FloatArgument("regen rate", 0)
23+
{
24+
Description = "The rate of hume shield regenerated per second."
25+
},
26+
new DurationArgument("regen cooldown")
27+
{
28+
Description = "The cooldown before hume shield regeneration begins."
29+
}
30+
];
31+
32+
public override void Execute()
33+
{
34+
var players = Args.GetPlayers("players");
35+
var amount = Args.GetFloat("amount");
36+
var limit = Args.GetFloat("limit");
37+
var regenRate = Args.GetFloat("regen rate");
38+
var regenCooldown = Args.GetDuration("regen cooldown");
39+
40+
players.ForEach(p =>
41+
{
42+
p.HumeShield = amount;
43+
p.MaxHumeShield = limit;
44+
p.HumeShieldRegenRate = regenRate;
45+
p.HumeShieldRegenCooldown = (float)regenCooldown.TotalSeconds;
46+
});
47+
}
48+
}

0 commit comments

Comments
 (0)