Class Ability<TArgs>
- Namespace
- TrinketTinker.Effects.Abilities
- Assembly
- TrinketTinker.dll
Abstract class, proc various effects while trinket is equipped.
public abstract class Ability<TArgs> : IAbility where TArgs : IArgs
Type Parameters
TArgs
- Inheritance
-
Ability<TArgs>
- Implements
- Derived
- Inherited Members
Constructors
Ability(TrinketTinkerEffect, AbilityData, int)
Basic constructor, tries to parse arguments as the generic IArgs type.
public Ability(TrinketTinkerEffect effect, AbilityData data, int lvl)
Parameters
effect
TrinketTinkerEffectdata
AbilityDatalvl
int
Fields
Name
Ability name, default to type name.
public readonly string Name
Field Value
args
Class dependent arguments for subclasses
protected readonly TArgs args
Field Value
- TArgs
d
Data for this ability.
protected readonly AbilityData d
Field Value
e
Companion that owns this ability.
protected readonly TrinketTinkerEffect e
Field Value
Properties
AbilityClass
public string AbilityClass { get; }
Property Value
AbilityId
public string AbilityId { get; }
Property Value
Active
True if trinket equiped.
protected bool Active { get; set; }
Property Value
Allowed
True if trinket proc timeout is not set, or elapsed.
protected bool Allowed { get; set; }
Property Value
ProcSyncIndex
The resolved ProcSyncIndex for Sync, only set to >0 if the ability is enabled
public int ProcSyncIndex { get; protected set; }
Property Value
ProcTimer
Tracks trinket proc timeout, counts down to 0 and resets to ProcTimer value is set in AbilityData.
protected double ProcTimer { get; set; }
Property Value
Valid
Mark the new ability as valid, if this is false after constructor, the ability is discarded
public bool Valid { get; protected set; }
Property Value
Methods
Activate(Farmer)
Setup the ability, when trinket is equipped.
public virtual bool Activate(Farmer farmer)
Parameters
farmer
Farmer
Returns
ApplyEffect(ProcEventArgs)
Applies ability effect, mark the ability as not allowed until next tick or longer.
protected virtual bool ApplyEffect(ProcEventArgs proc)
Parameters
proc
ProcEventArgs
Returns
CleanupEffect(Farmer)
Cleanup ability when trinket is unequipped, if is Always
protected virtual void CleanupEffect(Farmer farmer)
Parameters
farmer
Farmer
Deactivate(Farmer)
Teardown the ability, when trinket is removed.
public virtual bool Deactivate(Farmer farmer)
Parameters
farmer
Farmer
Returns
GetTASPosition(ProcEventArgs)
Get where the on proc StardewValley.TemporaryAnimatedSprite should be drawn from.
protected virtual Vector2 GetTASPosition(ProcEventArgs proc)
Parameters
proc
ProcEventArgs
Returns
- Vector2
HandleProc(object?, ProcEventArgs)
Handle proc of ability
protected virtual void HandleProc(object? sender, ProcEventArgs proc)
Parameters
sender
objectproc
ProcEventArgs
Update(Farmer, GameTime, GameLocation)
Update on game tick, handles the proc timer.
public virtual void Update(Farmer farmer, GameTime time, GameLocation location)
Parameters
farmer
Farmertime
GameTimelocation
GameLocation
Events
EventAbilityProc
Proc event for use with sync procs
public event EventHandler<ProcEventArgs>? EventAbilityProc