SetNet.StatusEffects
1.2.0
dotnet add package SetNet.StatusEffects --version 1.2.0
NuGet\Install-Package SetNet.StatusEffects -Version 1.2.0
<PackageReference Include="SetNet.StatusEffects" Version="1.2.0" />
<PackageVersion Include="SetNet.StatusEffects" Version="1.2.0" />
<PackageReference Include="SetNet.StatusEffects" />
paket add SetNet.StatusEffects --version 1.2.0
#r "nuget: SetNet.StatusEffects, 1.2.0"
#:package SetNet.StatusEffects@1.2.0
#addin nuget:?package=SetNet.StatusEffects&version=1.2.0
#tool nuget:?package=SetNet.StatusEffects&version=1.2.0
<p align="center"> <img src="https://raw.githubusercontent.com/Povstalez/SetNet/master/assets/icon.png" alt="SetNet" width="96"> </p>
SetNet.StatusEffects
Server-authoritative buffs and debuffs for SetNet.
Apply timed, stacking status effects (poison, haste, shield…) to any target key — a player or an entity id. The server owns the effects, a timer expires them, and every change is pushed to the affected player and to anyone watching that target (so players fighting a boss see its debuffs tick down). Stacking and refresh behaviour is configurable per effect type. This layer tracks the effects; interpreting a magnitude (armor bonus, damage-over-time) is your game logic. Added by composition — no base class.
Install
dotnet add package SetNet
dotnet add package SetNet.StatusEffects
Usage
Call StatusEffectRuntime.Enable() once at startup on both ends.
// server
StatusEffectRuntime.Enable();
var effects = server.UseStatusEffects();
effects.Define(new StatusEffectDefinition("poison", maxStacks: 5, defaultDurationMs: 8000, stacking: StackPolicy.Stack, isDebuff: true));
effects.Define(new StatusEffectDefinition("haste", defaultDurationMs: 5000, stacking: StackPolicy.Refresh));
// game logic (an ability hits a player or a mob entity id):
await effects.ApplyAsync(targetKey: victimPlayerKey, "poison", stacks: 2, magnitude: 12, source: casterKey);
await effects.ApplyAsync(targetKey: "mob:dragon#7", "haste", durationMs: 3000);
await effects.RemoveAsync(victimPlayerKey, "poison"); // a cleanse
// client
StatusEffectRuntime.Enable();
var effects = client.UseStatusEffects();
effects.Changed += (target, list) => DrawEffectBar(target, list);
await effects.WatchAsync(myPlayerKey); // my own buffs/debuffs
await effects.WatchAsync("mob:dragon#7"); // the boss I'm fighting
API
Server: server.UseStatusEffects(StatusEffectOptions?) → StatusEffectServer (Dispose() stops the timer)
| Member | Purpose |
|---|---|
Define(StatusEffectDefinition) |
register stack/refresh/duration rules for an effect type |
ApplyAsync(targetKey, effectId, durationMs = 0, stacks = 1, magnitude = 0, source = "") |
apply/refresh an effect |
RemoveAsync(targetKey, effectId) / ClearAsync(targetKey) |
cleanse |
GetAsync(targetKey) |
current effects |
Client: client.UseStatusEffects() → StatusEffectClient — GetAsync(targetKey), WatchAsync(targetKey), UnwatchAsync(targetKey), event Changed.
Definition: EffectId, MaxStacks, DefaultDurationMs (0 = permanent), Stacking (Refresh/Stack/Ignore), IsDebuff.
StatusEffectRuntime.Enable() — one-time bootstrap.
Notes
- Rides the unified SetNet.Protocol messaging layer on the
Channels.StatusEffectschannel (all modules share one envelope wire type,65447) — no per-module wire ids to reserve. Serializer-agnostic: the control protocol is hand-framedbyte[], your payloads use yourSetNetSerializer. - Target keys are arbitrary. A player key (the affected player gets pushes automatically) or an entity id like
"mob:dragon#7"(no peer — read viaGetAsync, or let nearby playersWatchAsyncit). By default the player key is the connection id; overrideStatusEffectOptions.TargetKey. - Stacking policies.
Refreshresets duration and keeps the higher stack count;Stackadds stacks up toMaxStacksand refreshes;Ignoredrops a re-application while one is active. Unregistered effects default to single-stack refresh. - Effects are just data here. The
Magnitudeand stack count are yours to interpret in combat/stat code. Pair withSetNet.StateSyncif you also replicate entity transforms, and drive interest (who watches a mob) from your spatial logic. - Not persisted. Effects live in memory and expire on the timer; that's the usual lifetime for combat buffs. Re-apply on respawn/zone-in as your design requires.
Documentation & source
- 🐙 https://github.com/Povstalez/SetNet — full catalog in docs/MODULES.md
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- SetNet (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0 | 146 | 8/5/2026 |