List of 'bad' tokens, tokens generally triggering bad effects.
Compare 2 arrays using ===
. No deep comparaison.
First array
Second array
True if a
and b
contains the same values in the same order.
Choose the right token to call with Recall the Future which is, among tokens that can be turned to success using the +2 bonus, the one which has the most occurrences in the bag. Note that it will take into account redraw tokens. For example, when testing at -2, it will not choose -3 even though there is a Bless token (+2, redraw) in the bag.
value and the difficulty.
The Chaos bag
The token effects mapping.
The best token to call or null
if there is none.
Returns combinations of elements from an array.
The number of elements in each combination.
The array of elements to pull from.
All possible combinations of k
elements among elems
.
Check if a list of elements contains at least one of the elements provided as second argument.
The list of elements to check.
The list of elements to look for.
True if the list provided as first argument contains at least one of the elements provided as second argument.
Check if a list of elements does not contains any of the elements provided as second argument.
The list of elements to check.
The list of elements to look for.
True if the list provided as first argument does contains not contain any of the elements provided as second argument.
Determine success using Dark Prophecy.
The difference between the total skill value and the difficulty.
An outcome function determining success.
Return all possible sets of n tokens that can be pulled from the bag along with the odds of pullingthis particular set among all possible sets. For exemple, if drawing only 1 token from a bag containing only a +1 token and 2 -1 token, the result will be:
The number of tokens simultaneously pulled from the bag.
The bag from which the tokens are pulled.
The token effects if needed (which is true if some of them have redraw effects).
[]} The list of possible pulls along with their odds.
Compute the fractional n!
Here we are using an iterative version of this function for better performance over a recursive version.
The number to compute the factorial from
The result of n!
Return all possible sets of n tokens that can be pulled from the bag along with the odds of pullingthis particular set among all possible sets. For exemple, if drawing only 1 token from a bag containing only a +1 token and 2 -1 token, the result will be:
The number of tokens simultaneously pulled from the bag.
The bag from which the tokens are pulled.
The token effects if needed (which is true if some of them have redraw effects).
The list of possible pulls along with their odds as fractions.
Determine success using Jacqueline Fine's ability to draw 3 tokens and cancel 2 non-tentacle tokens or a tentacle token.
The difference between the total skill value and the difficulty.
An outcome function determining success.
Compute the odds of a particular outcome when pulling tokens from the bag.
The outcome function is called for each possible combination of numTokens
from the bag and return true
or false
wether this specific combination
is a success or not. This function is called with first argument being the
combination (it will contain exactly numTokens
tokens), second optional
argument being the effects of the tokens and third optional argument being
the Chaos bag.
The simplest outcome function is checking if a particular token was pulled:
function pulledASkull(tokensPulled) {
return tokensPulled[0] === ArkhamOdds.Token.SKULL;
}
Using the token effects mapping, you can check if the skill test is a success when the total skil vallue is 2 above the difficulty.
function isSuccessWhenTwoAbove(tokensPulled, tokenEffects) {
return tokenEffects.isSuccess(tokensPulled, 2);
}
The number of tokens simultaneously pulled from the bag.
The bag from which the tokens are pulled.
The token effects.
The outcome function returning true
if the pulled tokens represent a
desired outcome and false
otherwise.
The first argument passed to the function are the tokens pulled, the second
is the token effects map and the third is the bag.
The outcome function should always assume that redraw tokens are counted
and that pulled tokens contains the result of redrawing.
The odds of the desired outcome.
Compute the odds of a particular combination of tokens based on how many tokens are not "redraw" tokens. It took me a lot of time to get this formula right. Many thanks to those who helped me get it.
The total number of tokens in the bag
The number of tokens in the combination
The number of tokens in this combination that are not "redraw" tokens
The odds of this combination
Similar to odds
but this time putting tokens back into the bag between
each pull.
It should be used for abilities like Wendy's:
let wendyOdds = ArkhamOdds.oddsWithRedraw(
2, theBag, theEffects,
ArkhamOdds.successChoosingBest(0));
TODO Update this function to account for tokens with a redraw effect.
The number of tokens sequentially pulled from the bag while putting them back in between each pull..
The bag from which the tokens are pulled.
The outcome function returning true
if the pulled tokens represent a
desired outcome and false
otherwise.
The first argument passed to the function are the tokens pulled, the second
is the token effects map and the third is the bag.
The odds of the desired outcome.
Choose the 2 best tokens.
The difference between the total skill value and the difficulty.
An outcome function determining if the two chosen tokens result in a success.
Determine success and doing exactly 3 damage using .35 Winchester and Olive McBride.
The difference between the total skill value and the difficulty.
An outcome function determining success.
Determine success and doing exactly 3 damage using .35 Winchester and Olive McBride.
The difference between the total skill value and the difficulty.
An outcome function determining success.
Choose a Skull if able and the best of remaining tokens.
The difference between the total skill value and the difficulty.
An outcome function determining if the tokens include a Skull and that this Skull + the best of remaining tokens result in a success.
Determine success using Recall the Future. The strategy applied for Recall the Future is the following :
The difference between the total skill value and the difficulty.
An outcome function determining success.
Returns a new array with the first occurrence of an element removed from the array passed.
The original array.
The element to remove
A new array with the element removed if original array contained it.
Returns a new array with element at index idx
replaced with elem
.
The original array.
The index at which to replace.
The element to place at the specified index.
A new array with the element replaced.
Basically determine success based on difference between skill value and difficulty.
The difference between the total skill value and the difficulty.
An outcome function determining success.
Determine success when pulling several tokens and choosing the best to resolve and ignore to others.
The difference between the total skill value and the difficulty.
An outcome function determining success.
The comma-separated list of tokens.
The array of tokens parsed from the string.
Determine success and doing exactly 1 damage using .35 Winchester.
The difference between the total skill value and the difficulty.
An outcome function determining success.
Determine success and doing exactly 3 damage using .35 Winchester.
The difference between the total skill value and the difficulty.
An outcome function determining success.
Bag compositions for the different campaigns.
Carnevale of Horrors
Curse of the Rougarou
Guardians of the Abyss
Guardians of the Abyss
Night of the Zealot
The Blob That Ate Everything
The Circle Undone
The Dream-Eaters : The Dream-Quest
The Dream-Eaters : The Web of Dreams
The Dunwich Legacy
The Forgotten Age
The Innsmouth Conspiracy
The Labyrinths of Lunacy
The Path to Carcosa
Generated using TypeDoc
An outcome function determine success based of the tokens pulled. The function is passed the mapping of token effects and the bag in case they are needed to determine success.
The simplest example just check whether a particular token was pulled:
const elderSignPulled = (tokensPulled) => { return tokensPulled[0] === ArkhamOdds.Token.ELDER_SIGN; }
You can return an outcome function from another function :
const pulledAToken = (token) => { return (tokensPulled) => { return tokensPulled[0] === token; } }
A more complex example includes the token effects:
const isSuccessWhenOverByTwo = (tokensPulled, tokenEffects) => { return tokenEffects.isSuccess(tokensPulled, 2); }
See TokenEffects.
Finally, some complex cases may require access to the bag. For example an outcome function for Recall the Future may use the bag composition to determine which token to name based on bag composition (see recallTheFuture).
The tokens pulled from the bag.
Mapping of token effects
The bag from which the tokens were pulled.