Class LifePathXPCostCalculator
The total is everything the path awards from its Fixed XP section, plus a share of its Flexible XP section, less the path's own discount. The total can be negative: a path whose drawbacks, such as negative trait awards, outweigh what it gives pays the character to take it.
How the flexible share is charged. The flexible section is a number of sets. Each set is a list of
individual awards and says how many of them the player takes, and the player picks from every set. Which items
they pick is up to them, so each set has to carry one price that covers any choice. That price is a weighted
average of the set's item values, charged once per pick from that set, and the Life Path pays the sum of its set
prices. Within a set the items are sorted by value and weighted with a bell curve centred on the middle of that
order, so the middle item sets the price and an unusually cheap or unusually expensive item barely moves it. The
weight of the item at position p is exp(-0.5 * ((p - middle) / 0.5) ^ 2), where middle
is (itemCount - 1) / 2.
Example: set A holds Gunnery/Mek 30 XP, Piloting/Mek 30 XP and the SPA Pain Resistance at 200 XP, and the player takes one. The middle item is a 30, and the other 30 and the 200 each carry about an eighth of its weight, so the set prices at 48 XP rather than the flat average of 87. Set B holds Small Arms 20 XP and Melee 20 XP, and the player takes both, so it prices at 40 XP. The flexible section costs 88 XP, whichever items the player chooses. Pricing the two sets together, as the calculator once did, would have charged 150.
A flat average would let one expensive item drag a set's price up even for a player who never takes it, and would make the price jump every time an author added an outlier. Pricing sets separately keeps an expensive set from touching a cheap one.
- Since:
- 0.50.11
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcalculateFlexibleSetCost(LifePathBuilder lifePath, int setIndex) Returns the XP one flexible set costs: the weighted average of its item values, multiplied by the number of items the player picks from it, rounded to the nearest XP.static intcalculateFlexibleXPCost(LifePathBuilder lifePath) Returns the XP the whole flexible section costs: every set's price added together.static intcalculateXPCost(LifePath lifePath) Returns the XP a finished Life Path costs.static intcalculateXPCost(LifePathBuilder lifePath) Returns the XP a Life Path costs.
-
Constructor Details
-
LifePathXPCostCalculator
public LifePathXPCostCalculator()
-
-
Method Details
-
calculateXPCost
Returns the XP a Life Path costs.- Parameters:
lifePath- the Life Path being priced, finished or still under construction- Returns:
- the XP cost, which is negative when the path's drawbacks outweigh its awards
- Since:
- 0.50.11
-
calculateXPCost
Returns the XP a finished Life Path costs.- Parameters:
lifePath- the Life Path to price- Returns:
- the XP cost, which is negative when the path's drawbacks outweigh its awards
- Since:
- 0.50.11
-
calculateFlexibleXPCost
Returns the XP the whole flexible section costs: every set's price added together.- Parameters:
lifePath- the Life Path whose flexible sets are being priced- Returns:
- the flexible XP cost, zero when there are no sets or none allow a pick
- Since:
- 0.50.11
-
calculateFlexibleSetCost
Returns the XP one flexible set costs: the weighted average of its item values, multiplied by the number of items the player picks from it, rounded to the nearest XP.Rounded here, per set, so that the per-set prices the wizard shows add up to the total the file records. See the class documentation for why the average is weighted rather than flat.
- Parameters:
lifePath- the Life Path the set belongs tosetIndex- the set's index- Returns:
- the set's price, zero when it has no items or allows no picks
- Since:
- 0.50.11
-