Table of Contents

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 TrinketTinkerEffect
data AbilityData
lvl int

Fields

Name

Ability name, default to type name.

public readonly string Name

Field Value

string

args

Class dependent arguments for subclasses

protected readonly TArgs args

Field Value

TArgs

d

Data for this ability.

protected readonly AbilityData d

Field Value

AbilityData

e

Companion that owns this ability.

protected readonly TrinketTinkerEffect e

Field Value

TrinketTinkerEffect

Properties

AbilityClass

public string AbilityClass { get; }

Property Value

string

AbilityId

public string AbilityId { get; }

Property Value

string

Active

True if trinket equiped.

protected bool Active { get; set; }

Property Value

bool

Allowed

True if trinket proc timeout is not set, or elapsed.

protected bool Allowed { get; set; }

Property Value

bool

ProcSyncIndex

The resolved ProcSyncIndex for Sync, only set to >0 if the ability is enabled

public int ProcSyncIndex { get; protected set; }

Property Value

int

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

double

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

bool

Methods

Activate(Farmer)

Setup the ability, when trinket is equipped.

public virtual bool Activate(Farmer farmer)

Parameters

farmer Farmer

Returns

bool

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

bool

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

bool

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 object
proc 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 Farmer
time GameTime
location GameLocation

Events

EventAbilityProc

Proc event for use with sync procs

public event EventHandler<ProcEventArgs>? EventAbilityProc

Event Type

EventHandler<ProcEventArgs>