Class PremadeAbilityTemplate
A complete, ready-to-use ability a merchant sells: a base AbilityTemplate with its events already chosen, at a price of its own.
[CreateAssetMenu(fileName = "New Premade Ability", menuName = "FishMMO/Character/Merchant/Premade Ability", order = 2)]
public class PremadeAbilityTemplate : ScriptableObject, ITooltip
- Inheritance
-
ObjectScriptableObjectPremadeAbilityTemplate
- Implements
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
- Extension Methods
Remarks
The ordinary route to a usable ability is two steps — buy the template and the effects from a merchant, then combine them at an Ability Crafter. This is the one-step alternative: the buyer receives the finished Ability straight into their usable set, exactly as if they had crafted it, and never needs to know the template. Content decides the trade-off; a premade combination will usually be weaker or plainer than what a player could build.
A plain ScriptableObject rather than a cached template. Nothing ever looks one of these up by ID: the purchase names a merchant and an index into that merchant's list, the server reads the recipe from its own copy of the asset, and the client renders it from the copy that loaded with the merchant template. It therefore needs no addressable label and no place in the cache.
The recipe is held to the crafting rules — at most AdditionalEventSlots events and at most one type override — so a premade ability can never be something a player could not have built. Validate(out string) is the single statement of those rules; the server runs it before selling and the inspector runs it on edit.
Fields
Ability
The base ability the finished ability is built from.
[Tooltip("The base ability. The buyer receives a finished ability built from it; they do not learn the template itself.")]
public AbilityTemplate Ability
Field Value
Events
Events attached to the ability, as a crafter would attach them.
[Tooltip("Events baked into the ability. Bound by the base ability's Additional Event Slots.")]
public List<AbilityEvent> Events
Field Value
Price
What the merchant charges. Zero is free; the template and event prices are not summed.
[Tooltip("The merchant's price for the finished ability. Zero is free. Component prices are not added on top.")]
[Min(0)]
public int Price
Field Value
TypeOverride
Optional ability-type override, as a crafter would attach one.
[Tooltip("Optional type override. Counts as one event slot, like it does at the crafter.")]
public AbilityTypeOverrideEventType TypeOverride
Field Value
Properties
AssetName
Human-readable name of the offer, for logs and the inspector.
public string AssetName { get; }
Property Value
Icon
Gets the icon sprite to display in the tooltip.
public Sprite Icon { get; }
Property Value
- Sprite
Name
Gets the display name for the tooltip.
public string Name { get; }
Property Value
Methods
BuildEventIDs()
The event IDs a crafted Ability is constructed with: the events, then the type override, in that order. The same shape the crafter sends and the database stores.
public List<int> BuildEventIDs()
Returns
BuildTooltip(TooltipContent)
Describes the finished ability this offer sells, at the price it sells for.
public void BuildTooltip(TooltipContent content)
Parameters
contentTooltipContentThe content being assembled.
Remarks
The composition is the one a crafter would produce from the same parts, so the offer cannot advertise numbers the bought ability will not have. The craft cost is suppressed: this is sold at its own price and two price lines would defeat the point of showing one.
Validate(out string)
Checks the recipe against the crafting rules.
public bool Validate(out string reason)
Parameters
reasonstringWhy the recipe is not sellable, or null when it is.
Returns
- bool
True when a crafter would have accepted this exact combination.
Remarks
Written once and used on both sides so an asset the inspector accepts is one the server will sell. Duplicate events are tolerated here and collapsed by BuildEventIDs(), because a duplicated inspector row is a slip rather than an attempt to double an effect.