public sealed class AbilityCasterOne thing's abilities: what is ready, what is being cast, and what it costs.
Remarks
Timing and eligibility, and nothing about damage. What an ability does when it completes is CombatResolver's, because that needs the targets it hit and this only knows the one it was aimed at. The split is what lets a cone ability go through the same caster as a single-target one.
⚠ Costs are paid when the cast completes, not when it starts. Paying up front means an interrupted cast has spent the resource, which every game refunds by hand and gets wrong for channels. A channel pays per tick, which is the only reading of "it costs mana per second" that survives being interrupted halfway.
Fields and properties (8)
public GameplaySubject SubjectWhose abilities these are.
public AbilityLibrary AbilitiesWhere ability templates come from.
public float GlobalCooldownHow long the global cooldown lasts, in seconds.
public float GlobalCooldownRemainingHow much of it is left.
public AbilityTemplate? CastingWhat is being cast, or null.
public AbilityTarget CastTargetWhat it is aimed at.
public float CastRemainingHow much longer the cast or channel has, in seconds.
public bool IsCastingWhether anything is being cast.
Methods (8)
public AbilityCaster(GameplaySubject subject, AbilityLibrary abilities)Makes a caster.
public AbilityFailure CanBegin(DefId ability, in AbilityTarget at)Whether an ability could start right now.
public AbilityFailure TryBegin(DefId ability, in AbilityTarget at, ICollection<AbilityEvent>? events = null)Starts an ability.
public bool Interrupt(ICollection<AbilityEvent>? events = null)Stops whatever is being cast.
public void Tick(float delta, ICollection<AbilityEvent>? events = null)Advances the cast, the channel, the global cooldown and every recharging ability.
public int ChargesOf(DefId ability)How many charges of an ability are ready.
public float CooldownOf(DefId ability)How long until an ability's next charge, in seconds.
public void ResetCooldowns()Puts every charge back and clears the global cooldown. What a reset does.
Used by (1)
- AbilityCasterTestsVixen.Gameplay.Combat.Tests