Table of Contents

Class AbilitySummary

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Everything the UI needs to describe an ability, composed once from one set of rules.

public sealed class AbilitySummary
Inheritance
AbilitySummary
Inherited Members

Remarks

Why this exists. An ability's numbers were worked out in three places that disagreed. Ability sums the template's stats, the events baked into the template, and any crafted events. The template's tooltip summed only the template and whatever the crafting panel passed it, ignoring the template's own events entirely — so a fireball whose bundled movement event supplies its speed advertised numbers the crafted ability would never have. The crafting panel then added its own third rule for the price. A player comparing the preview against the ability they got was comparing two different calculations.

One composition now serves the template tooltip, the learned ability's tooltip, the knowledge panel and the crafting preview. It also keeps BaseStats beside Stats, which is what lets the crafting UI show what each chosen effect actually changed rather than only the total.

Fields

BaseResourceCosts

Resource cost of the base ability alone.

public readonly Dictionary<CharacterAttributeTemplate, int> BaseResourceCosts

Field Value

Dictionary<CharacterAttributeTemplate, int>

BaseStats

The base ability with only the effects its template ships with.

public AbilityStatBlock BaseStats

Field Value

AbilityStatBlock

CraftedEvents

Effects crafted onto the base ability.

public readonly List<AbilityEvent> CraftedEvents

Field Value

List<AbilityEvent>

Effects

What the composed ability does when it connects.

public readonly List<string> Effects

Field Value

List<string>

Requirements

What the character must have or be, in the order the conditions were authored.

public readonly List<string> Requirements

Field Value

List<string>

ResourceCosts

Resource cost of the composed ability.

public readonly Dictionary<CharacterAttributeTemplate, int> ResourceCosts

Field Value

Dictionary<CharacterAttributeTemplate, int>

Stats

The composed ability, including every crafted effect.

public AbilityStatBlock Stats

Field Value

AbilityStatBlock

Targeting

How the composed ability picks what it affects.

public readonly List<string> Targeting

Field Value

List<string>

TemplateEvents

Effects the template ships with. The player did not choose these and cannot remove them.

public readonly List<AbilityEvent> TemplateEvents

Field Value

List<AbilityEvent>

Properties

CraftPrice

What crafting this composition costs: the base ability plus every chosen effect.

public int CraftPrice { get; }

Property Value

int

Description

The ability's description.

public string Description { get; }

Property Value

string

EventSlots

How many effects may be crafted onto this base ability.

public int EventSlots { get; }

Property Value

int

HasCraftedEvents

True when at least one effect was crafted on, so deltas are worth drawing.

public bool HasCraftedEvents { get; }

Property Value

bool

Icon

The ability's icon.

public Sprite Icon { get; }

Property Value

Sprite

Name

The ability's name.

public string Name { get; }

Property Value

string

Template

The base ability this was composed from.

public AbilityTemplate Template { get; }

Property Value

AbilityTemplate

Type

The effective ability type, after any override event.

public AbilityType Type { get; }

Property Value

AbilityType

TypeOverride

The override event that replaced the type, when one was chosen.

public AbilityTypeOverrideEventType TypeOverride { get; }

Property Value

AbilityTypeOverrideEventType

Methods

BuildTooltip(TooltipContent, bool, bool)

Writes the whole composition into a tooltip.

public void BuildTooltip(TooltipContent content, bool showDeltas = false, bool includePrice = true)

Parameters

content TooltipContent

The content being assembled.

showDeltas bool

When true, each stat carries what the crafted effects changed it by. The crafting panel wants that; a finished ability's tooltip does not, because there is nothing to compare against once the ability exists.

includePrice bool

Whether to write the crafting price. A seller writes its own.

Compose(AbilityTemplate, IReadOnlyList<ITooltip>)

Composes a base ability with the effects a player has chosen for it.

public static AbilitySummary Compose(AbilityTemplate template, IReadOnlyList<ITooltip> chosen = null)

Parameters

template AbilityTemplate

The base ability.

chosen IReadOnlyList<ITooltip>

Effects and type overrides being crafted onto it. Entries that are neither are ignored, which is what lets a UI pass its slot contents straight in.

Returns

AbilitySummary

EventCategory(AbilityEvent)

When an event runs, in words a player can act on.

public static string EventCategory(AbilityEvent abilityEvent)

Parameters

abilityEvent AbilityEvent

Returns

string

FormatDelta(float, float, string)

The change a stat underwent, or null when nothing changed it.

public static string FormatDelta(float baseValue, float composed, string suffix)

Parameters

baseValue float

The base ability's value.

composed float

The composed value.

suffix string

Unit suffix, e.g. "s" or "m".

Returns

string

FromAbility(Ability)

Describes an ability the character has already learned.

public static AbilitySummary FromAbility(Ability ability)

Parameters

ability Ability

Returns

AbilitySummary

Remarks

The crafted effects are recovered by subtracting the template's own: an ability holds one flat dictionary of events and does not record where each came from, but the template does, and a player looking at a crafted ability wants to see the parts they chose separately from the ones that came in the box.

ToneForDelta(float, bool)

Whether a change to a stat is an improvement.

public static TooltipTone ToneForDelta(float delta, bool moreIsBetter)

Parameters

delta float
moreIsBetter bool

Returns

TooltipTone

Remarks

Direction is per-stat and is not guessable from the sign: more range is good, more cooldown is not. Getting this wrong colours a penalty green, so it is stated once here rather than at each call site.