Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(game): legacy commands #239

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
feat(game): Implement /weak and /weaken command
  • Loading branch information
MeikelLP committed Nov 27, 2024
commit 2d91fbea0002df48c40eab47222528352e0ee762
22 changes: 22 additions & 0 deletions src/Libraries/Game.Server/Commands/WeakenCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using QuantumCore.API.Game;
using QuantumCore.Game.World.Entities;

namespace QuantumCore.Game.Commands;

[Command("weak", "Sets health of nearby monsters to 1")]
[Command("weaken", "Sets health of nearby monsters to 1")]
public class WeakenCommand : ICommandHandler
{
public Task ExecuteAsync(CommandContext context)
{
context.Player.ForEachNearbyEntity(e =>
{
if (e is MonsterEntity)
{
e.Health = 1;
}
});

return Task.CompletedTask;
}
}