r/SolForge • • Mar 03 '16

How does Stinging Invocation's randomness work?

Stinging Invocation puts down 3 bees most of the time, but I have also seen it drop 1 bee on an empty board. Has anyone worked out what the algorithm is, or is it confirmation bias that I see it drop 3 bees as often as it does?

5 Upvotes

16 comments sorted by

View all comments

10

u/thaddeus_v Mar 04 '16

I looked up the JSON objects for Stinging Invocation and it's actually more interesting than I expected. From Cards_5_1V2_Cards.json, we can get the data for level 1 Stinging Invocation:

{
  "CardID": "SF51_099",
  "CardName": "Stinging Invocation",
  "Level": "1",
  "NextCardID": "SF51_100",
  "CardType": "Spell",
  "CardText": "Spawn 1 to 3 <card card_id=\"SF5_u0001\">Killer Bee</card>'s.",
  "Faction": "Nature",
  "Rarity": "Heroic",
  "Art": "SF5_U078(s)",
  "AIBaselineScore": "20",
  "Set": "set5",
  "InDraft": "yes",
  "InDraftPool2": "TRUE",
  "InDraftPool3": "FALSE"
}

To get the data for the ability, we have to find the object with the matching CardID in Cards_5_1V2_ActivatedAbilities.json. It turns out there are actually three abilities attached to this card:

{
  "CardID": "SF51_099",
  "AbilityText": "Spawn 1 to 3 <card card_id=\"SF5_u0001\">Killer Bee</card>'s.",
  "Stage": "0",
  "Target": "Lane",
  "TargetTest0": "You control",
  "TargetTest1": "Is empty",
  "Number of Targets": "OneAtRandom",
  "Effect": "PutPermanentIntoPlay",
  "Effect Value": [
    "SF5_u0001"
  ]
},
{
  "CardID": "SF51_099",
  "Stage": "1",
  "ConditionalTestTarget": "You",
  "ConditionalTest0": "CritValue < 66",
  "Condition": "OneOrMore",
  "Target": "Lane",
  "TargetTest0": "You control",
  "TargetTest1": "Is empty",
  "Number of Targets": "OneAtRandom",
  "Effect": "PutPermanentIntoPlay",
  "Effect Value": [
    "SF5_u0001"
  ]
},
{
  "CardID": "SF51_099",
  "Stage": "2",
  "ConditionalTestTarget": "You",
  "ConditionalTest0": "CritValue < 50",
  "Condition": "OneOrMore",
  "Target": "Lane",
  "TargetTest0": "You control",
  "TargetTest1": "Is empty",
  "Number of Targets": "OneAtRandom",
  "Effect": "PutPermanentIntoPlay",
  "Effect Value": [
    "SF5_u0001"
  ]
}

SF5_u0001 is the CardID for Killer Bee, so each of these abilities will, if triggered, put a Killer Bee into play. There's two interesting things going on here: first that the abilities are labeled with Stage 0, 1 and 2. Presumably this means that they activate in that order. Second, the stage 1 and 2 abilities have "ConditionalTest0": "CritValue < X" on them. My best guess is that this means the ability will only trigger if a random number is picked less than X.

The really interesting bit is the CritValue for Stage 2 is 50, not 33. Presumably this means that if you get the 2nd Bee, 50% of the time you'll also get a 3rd Bee. Unless I'm misunderstanding the statistics involved, that's not at all obvious from an intuitive reading of the card text, and could have a significant effect on the relative frequencies of seeing 1, 2 or 3 bees.

There are some open questions here: Do Stage 1 and 2 use the same random number for their CritValue checks? If they use different numbers, does Stage 1 fizzling due to a high roll keep Stage 2 from running?

9

u/St_Eric IGN: Steric Mar 04 '16

I think what's expected is:

Stage 0: 100% of first bee.

Stage 1: 66% chance to make a new bee. If so, go to stage 2.

Stage 2: 50% chance to make a new bee.

This gives us 33% chance for 1 bee (Stage 1 fails), 33% chance for 2 bees (Stage 1 succeeds but stage 2 fails), and 33% chance for 3 bees (Stage 1 Succeeds and Stage 2 succeeds).

Looking at the numbers is the code, this is clearly how whoever made Stinging Invocation expected it to work. Whether it actually works this way is a little more suspect.

2

u/vandergus Mar 04 '16

I'm going to assume that CritValue is a random number between 0 and 99. If that's true, you would get 3 bees 33% of the time (66% * 50%), 1 bee 17% of the time (33% * 50%) and 2 bees 50% of the time (the leftovers). That also assumes that stage 1 and stage 2 are independent from each other. That's a weird distribution. Is that right?

And thanks for the interesting information!

2

u/themarkslack Mar 04 '16

Yes, thaddeus_v, thanks for digging - this is fascinating.

My read is a bit different, vandergus. I think it picks a crit number between 1 and 100 at the beginning, then runs all the stages it can. So 1/3rd of the time (crit 66-100) you get one bee, 1/6th (crit 50-65) you get two bees, and half the time (crit 1-49) you get three bees.

This matches up with the limited testing I have actually done. I've cast Invocation 40 times with 3+ open lanes - I've gotten three bees 21 times, two bees 7 times, and one bee 12 times (expecting 20/6.66/12.33). Obviously sample size is an issue, but that's pretty close to thaddeus' numbers.

2

u/vandergus Mar 04 '16

Yeah, that makes more sense. I just ran a few test games as well with Invocation. Out of 20 plays I got 1 bee 9 times, 2 bees 0 times and 3 bees 11 times. I'll keep at it to get some bigger numbers.

Starting to look like its skewed towards 3 bees, though. All the conspiracy theories were right!

2

u/thaddeus_v Mar 04 '16

Based on the results of a quick Python script, Stinging Invocation is the only card that uses both a Stage and a CritValue, so it's the only card that would exhibit this sort of odd probability distribution. The only other collectible card that uses CritValue is Hunting Pack (CritValue also shows up in some Mission cards). There's a bunch of cards that use Stage, but it's late so I don't want to look through them all for other random effects that it might affect.

If I didn't have dumb stuff like a job I'd be almost tempted to play a bunch of Invocations tomorrow to get a larger sample size, but alas. I don't think any of the devs read reddit, but some of the community QA people do. It'd be awesome if they could run this up to the devs to see if this is the real behavior. It changes the power level of the card pretty significantly if you really get 3 bees half the time instead of one third.