SetNet.Abilities 1.2.0

dotnet add package SetNet.Abilities --version 1.2.0
                    
NuGet\Install-Package SetNet.Abilities -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SetNet.Abilities" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SetNet.Abilities" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="SetNet.Abilities" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SetNet.Abilities --version 1.2.0
                    
#r "nuget: SetNet.Abilities, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SetNet.Abilities@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SetNet.Abilities&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=SetNet.Abilities&version=1.2.0
                    
Install as a Cake Tool

<p align="center"> <img src="https://raw.githubusercontent.com/Povstalez/SetNet/master/assets/icon.png" alt="SetNet" width="96"> </p>

SetNet.Abilities

Server-authoritative abilities and skills for SetNet.

Define abilities with a cooldown, resource cost, range and target kind, plus composable effects — DamageEffect (through SetNet.Combat), HealEffect, and BuffEffect (a timed SetNet.Stats modifier). Clients request an ability; the server validates cooldown/cost/target/range and applies the effects. Entity stats, health, positions and resources all come through seams, so mobs and players run through the exact same system. Added by composition — no base class.

Install

dotnet add package SetNet
dotnet add package SetNet.Abilities

Usage

Call AbilitiesRuntime.Enable() once at startup on both ends.

Server — wire the seams to your entity state, then Define abilities:

AbilitiesRuntime.Enable();
var abilities = server.UseAbilities(new AbilityOptions
{
    StatsOf    = key => world.StatsOf(key),      // string key -> StatSet?
    HealthOf   = key => world.HealthOf(key),     // string key -> Health?
    PositionOf = key => world.PositionOf(key),   // for range checks (null disables them)
    ResourceOf = (key, id) => world.ResourceOf(key, id),   // mana/energy pools
});

abilities.Define(new AbilityDefinition
{
    Id = "fireball", CooldownMs = 3000, Range = 30,
    ResourceId = "mana", ResourceCost = 20,
    TargetKind = TargetKind.Target,
    Effects = { new DamageEffect(coefficient: 1.5, damageType: "fire") },
});

// server/mob logic can fire it directly through the same entry point:
AbilityOutcome outcome = await abilities.TryUseAsync("mob:dragon#7", "fireball", AbilityTarget.Of(playerKey));

Client — request a use; the server is the authority:

AbilitiesRuntime.Enable();
var abilities = client.UseAbilities();
var outcome = await abilities.UseAsync("fireball", targetKey: enemyId);
if (!outcome.Ok) Toast(outcome.Message);   // "on cooldown", "out of range", "not enough mana", …
else StartCooldownUi(outcome.CooldownMs);

Notes

  • TryUseAsync is the one gate. Both client requests and server/mob logic go through it: it validates cooldown → target → range → resource cost, starts the cooldown before applying (so a throwing effect can't be spammed), then runs each effect. A bad effect is caught so it can't abort the rest.
  • Composable effects. Drop DamageEffect, HealEffect, BuffEffect into AbilityDefinition.Effects, or implement IAbilityEffect for your own. BuffEffect applies re-tagged stat modifiers and auto-removes them after its duration.
  • Seams, not subclasses. AbilityOptions resolves stats/health/position/resource from entity keys, so the same abilities work for players and mobs. Set PlayerKey to map a peer to its stable key (default = connection id — override to the authenticated account id, matching your other hubs).
  • Targeting. TargetKind (None/Self/Target/Point) plus AbilityTarget.Of(key) / At(point). Range is enforced only when PositionOf is set.
  • Rides the unified SetNet.Protocol messaging layer on the Channels.Abilities channel (all modules share one envelope wire type, 65447) — no per-module wire ids to reserve. The control protocol is hand-framed byte[].

Documentation & source

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 109 8/5/2026