LessonCost ​
Inherits: Resource
What a lesson of a trainer costs: any mix of money, items and skill points. The learner pays: money and items come out of the bag of the character who learns (the shared bag when the party shares it), skill points out of the skill pools of that character.
Description ​
A cost is all or nothing: a character who cannot pay all of it pays nothing. A price multiplier (from a formula of the lesson, from the standing with the trainer) scales every amount, rounded up. See docs/systems/skill-trainers.md, section 3.2.
Properties ​
Dictionary | currencies | {} |
Dictionary | items | {} |
Dictionary | skill_points | {} |
Methods ​
bool | is_free() |
int | scaled( amount: int, multiplier: float ) static |
String | get_blocker( player: Player, multiplier: float = 1.0 ) |
bool | pay( player: Player, multiplier: float = 1.0 ) |
void | refund( player: Player, multiplier: float = 1.0 ) |
String | describe( multiplier: float = 1.0 ) |
Array[Dictionary] | validate() |
Property descriptions ​
Dictionary currencies = ​
Money: currency id -> amount
Dictionary items = ​
Items that are taken from the bag: item id -> how many
Dictionary skill_points = ​
Skill points that are spent: skill pool id -> points
Method descriptions ​
bool is_free() ​
Does the lesson cost nothing?
int scaled( amount: int, multiplier: float ) ​
An amount after the price multiplier, rounded up (never below 1 for an amount above 0)
String get_blocker( player: Player, multiplier: float = 1.0 ) ​
Why the character cannot pay ("" = they can)
bool pay( player: Player, multiplier: float = 1.0 ) ​
Takes the whole cost from the character. False (and nothing is taken) when they cannot pay
void refund( player: Player, multiplier: float = 1.0 ) ​
Gives back what pay took (a lesson that could not be given)
String describe( multiplier: float = 1.0 ) ​
The cost as text: "5 Gold, 2 Iron Ore, 1 Training point". "Free" when there is none
Array[Dictionary] validate() ​
Checks the settings. Gives the problems found (empty when it is fine).