Show / Hide Table of Contents

Class Cost

Data type used generally for cost handling, including in shops and y/n dialogue prompts.

Inheritance
System.Object
Cost
ConsumablePDIntCost
GeoCost
CumulativeRancidEggCost
FlameCost
MultiCost
PDBoolCost
PDIntCost
Implements
System.IEquatable<Cost>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: ItemChanger
Assembly: ItemChanger.dll
Syntax
public abstract class Cost : IEquatable<Cost>

Properties

| Improve this Doc View Source

DiscountRate

A number between 0 and 1 which modifies numeric costs. Only considered by some costs.
For example, the Leg Eater dung discount sets this to 0.8, to indicate that geo costs should be at 80% price.

Declaration
public virtual float DiscountRate { get; set; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

Paid

Represents whether the cost has been paid yet. Paid costs will be subsequently ignored.

Declaration
public bool Paid { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Recurring

If true, the cost will not set the value of Paid during Pay. Use for costs which are expected to be paid multiple times.
Note that Paid can still be set independently to indicate when the cost should no longer be required.

Declaration
public virtual bool Recurring { get; set; }
Property Value
Type Description
System.Boolean

Methods

| Improve this Doc View Source

AfterPay()

Method for any effects which should take place after the cost has been paid (e.g. conditionally setting Paid, etc).

Declaration
public virtual void AfterPay()
| Improve this Doc View Source

CanPay()

Returns whether the cost can currently be paid.

Declaration
public abstract bool CanPay()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GetBaseCost()

Points to the root-level cost for pattern-matching contexts such as CostDisplayer. Primarily intended for implementation by costs which wrap a single other cost to apply additional functionality.

Declaration
public virtual Cost GetBaseCost()
Returns
Type Description
Cost
Remarks

Implementers of wrapper costs should keep in mind that costs being wrapped may themselves be wrapper costs. A typical correct implementation would likely be WrappedCost.GetBaseCost().

| Improve this Doc View Source

GetCostText()

Method which provides the cost text used in y/n prompts.

Declaration
public abstract string GetCostText()
Returns
Type Description
System.String
| Improve this Doc View Source

HasPayEffects()

Does paying this cost have effects (particularly that could prevent paying other costs of the same type)?

Declaration
public abstract bool HasPayEffects()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Includes(Cost)

Is the other cost a subset of this cost?

Declaration
public virtual bool Includes(Cost c)
Parameters
Type Name Description
Cost c
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Load()

Method which should be called by the Cost's owner during initial loading. Used by certain costs which require global or shared tracking.

Declaration
public virtual void Load()
| Improve this Doc View Source

NewEssenceCost(Int32)

Declaration
public static Cost NewEssenceCost(int amount)
Parameters
Type Name Description
System.Int32 amount
Returns
Type Description
Cost
| Improve this Doc View Source

NewGeoCost(Int32)

Declaration
public static Cost NewGeoCost(int amount)
Parameters
Type Name Description
System.Int32 amount
Returns
Type Description
Cost
| Improve this Doc View Source

NewGrubCost(Int32)

Declaration
public static Cost NewGrubCost(int amount)
Parameters
Type Name Description
System.Int32 amount
Returns
Type Description
Cost
| Improve this Doc View Source

OnPay()

Method for administering all effects of the cost during Pay.

Declaration
public abstract void OnPay()
| Improve this Doc View Source

Pay()

Pays the cost, performing any effects and setting the cost to Paid.

Declaration
public void Pay()
| Improve this Doc View Source

Unload()

Method which should be called by the Cost's owner during unloading. Used by certain costs which require global or shared tracking.

Declaration
public virtual void Unload()

Operators

| Improve this Doc View Source

Addition(Cost, Cost)

Combines two costs into a MultiCost. If either argument is null, returns the other argument. If one or both costs is a MultiCost, flattens the result.

Declaration
public static Cost operator +(Cost a, Cost b)
Parameters
Type Name Description
Cost a
Cost b
Returns
Type Description
Cost

Implements

System.IEquatable<T>

Extension Methods

Extensions.Yield<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX