Create a new bag with the specified tokens added to it. The original bag is unchanged which makes it handy to compare odds based on bag composition.
Comparing odds of success when a token is added to the bag.
const bag = new ArkhamOdds.Bag(ArkhamOdds.Bags.ThePathToCarcosa.Standard);
const bagWithTabletAdded = bag.addTokens([ArkhamOdds.Token.TABLET]);
const effects = ArkhamOdds.DefaultTokenEffects
.merge(new ArkhamOdds.TokenEffects([
[ArkhamOdds.Token.SKULL, new ArkhamOdds.Modifier(-1)],
[ArkhamOdds.Token.CULTIST, new ArkhamOdds.Modifier(-2)],
[ArkhamOdds.Token.TABLET, new ArkhamOdds.Modifier(-2)],
[ArkhamOdds.Token.ELDER_THING, new ArkhamOdds.Modifier(-2)],
[ArkhamOdds.Token.ELDER_SIGN, new ArkhamOdds.Modifier(2)]
]));
const [odds, success] = [ArkhamOdds.odds, ArkhamOdds.success];
console.log(
odds(1, bag, effects, success(2))
- odds(1, bagWithTabletAdded, effects, success(2)));
The tokens to add to the bag.
A new bag.
Get tokens in the bag.
A copy of tokens in the bag (modification to it will not affect the bag).
Returns a new bag with the specified token removed. The original bag is unchanged which makes it handy to compare odds based on bag composition. This is the method to use for seal effects like The Chthonian Stone
const bag = new ArkhamOdds.Bag(ArkhamOdds.Bags.ThePathToCarcosa.Standard);
const theChthonianStone = bag.removeToken(ArkhamOdds.Token.CULTIST);
The token to remove.
A new bag with the token removed. If the original bag does not contain an occurrence of the specified token, the method still returns a copy of the original bag even if there are no differences in their compositions.
Generated using TypeDoc
A representation of a Chaos Bag with its tokens. A bag is immutable, each modification (adding or removing tokens) creates a new bag and leave the original bag unchanged.
Examples
Creating a bag from scratch
const T = ArkhamOdds.Token; const myBag = new ArkhamOdds.Bag([ T.ELDER_SIGN, T.PLUS_ONE, T.ZERO, T.MINUS_ONE, T.AUTOFAIL ]);
Creating a bag from predefined bags
See Bags.
const myBag = new ArkhamOdds.Bag(ArkhamOdds.Bags.ThePathToCarcosa.Standard);