Skip to content

Commit da2c599

Browse files
Switch to prob api wip 2
todo -Blurred edition -Bus Driver -Update descriptions of Critical and Legendary deck with new prob vars
1 parent a451832 commit da2c599

File tree

4 files changed

+99
-43
lines changed

4 files changed

+99
-43
lines changed

items/code.lua

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4911,12 +4911,8 @@ local copypaste = {
49114911
cost = 14,
49124912
blueprint_compat = true,
49134913
loc_vars = function(self, info_queue, card)
4914-
local num, denom = SMODS.get_probability_vars(card, 1, card and card.ability.extra.odds or 2)
49154914
return {
4916-
vars = {
4917-
num,
4918-
denom,
4919-
}, -- this effectively prevents a copypaste from ever initially misprinting at above 50% odds. still allows rigging/oops
4915+
vars = { SMODS.get_probability_vars(card, 1, card.ability.extra.odds, "Copy/Paste") },
49204916
key = Cryptid.gameset_loc(self, { madness = "madness", exp_modest = "modest" }),
49214917
}
49224918
end,
@@ -4959,7 +4955,8 @@ local copypaste = {
49594955
card,
49604956
"cry_copypaste_joker",
49614957
1,
4962-
card and card.ability.extra.odds or 2
4958+
card.ability.extra.odds,
4959+
"Copy/Paste"
49634960
)
49644961
then
49654962
G.E_MANAGER:add_event(Event({

items/deck.lua

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,26 @@ local legendary = {
358358
},
359359
name = "cry-Legendary",
360360
key = "legendary",
361-
config = { cry_legendary = true, cry_legendary_rate = 0.2 },
361+
config = { cry_legendary = true, cry_legendary_rate = 5 },
362362
pos = { x = 0, y = 6 },
363363
atlas = "atlasdeck",
364364
order = 15,
365+
loc_vars = function(self, info_queue, center)
366+
return { vars = { SMODS.get_probability_vars(self, 1, self.config.cry_legendary_rate, "Legendary Deck") } }
367+
end,
365368
calculate = function(self, back, context)
366369
if context.context == "eval" and Cryptid.safe_get(G.GAME, "last_blind", "boss") then
367370
if G.jokers then
368371
if #G.jokers.cards < G.jokers.config.card_limit then
369-
local legendary_poll = pseudorandom(pseudoseed("cry_legendary"))
370-
legendary_poll = legendary_poll / (G.GAME.probabilities.normal or 1)
371-
if legendary_poll < self.config.cry_legendary_rate then
372+
if
373+
SMODS.pseudorandom_probability(
374+
self,
375+
"cry_legendary",
376+
1,
377+
self.config.cry_legendary_rate,
378+
"Legendary Deck"
379+
)
380+
then
372381
local card = create_card("Joker", G.jokers, true, 4, nil, nil, nil, "")
373382
card:add_to_deck()
374383
card:start_materialize()
@@ -441,18 +450,21 @@ local critical = {
441450
name = "cry-Critical",
442451
key = "critical",
443452
order = 10,
444-
config = { cry_crit_rate = 0.25, cry_crit_miss_rate = 0.125 },
453+
config = { cry_crit_rate = 4, cry_crit_miss_rate = 8 },
445454
pos = { x = 4, y = 5 },
446455
atlas = "atlasdeck",
447456
loc_vars = function(self, info_queue, center)
448-
return { vars = { G.GAME.probabilities.normal or 1 } }
457+
local _, aaa = SMODS.get_probability_vars(self, 1, self.config.cry_crit_miss_rate, "Critical Deck")
458+
return { vars = { SMODS.get_probability_vars(self, 1, self.config.cry_crit_rate, "Critical Deck"), aaa } }
449459
end,
450460
calculate = function(self, card, context)
451461
if context.final_scoring_step then
462+
local aaa =
463+
SMODS.pseudorandom_probability(self, "cry_critical", 1, self.config.cry_crit_rate, "Critical Deck")
464+
local bbb =
465+
SMODS.pseudorandom_probability(self, "cry_critical", 1, self.config.cry_crit_miss_rate, "Critical Deck")
452466
local check
453-
local crit_poll = pseudorandom(pseudoseed("cry_critical"))
454-
crit_poll = crit_poll / (G.GAME.probabilities.normal or 1)
455-
if crit_poll < self.config.cry_crit_rate then
467+
if aaa then
456468
check = 2
457469
G.E_MANAGER:add_event(Event({
458470
func = function()
@@ -468,7 +480,7 @@ local critical = {
468480
return true
469481
end,
470482
}))
471-
elseif crit_poll < self.config.cry_crit_rate + self.config.cry_crit_miss_rate then
483+
elseif bbb then
472484
check = 0.5
473485
G.E_MANAGER:add_event(Event({
474486
func = function()
@@ -676,8 +688,8 @@ local antimatter = {
676688
key = "antimatter",
677689
config = {
678690
cry_antimatter = true,
679-
cry_crit_rate = 0.25, --Critical Deck
680-
cry_legendary_rate = 0.2, --Legendary Deck
691+
cry_crit_rate = 4, --Critical Deck
692+
cry_legendary_rate = 5, --Legendary Deck
681693
-- Enhanced Decks
682694
cry_force_enhancement = "random",
683695
cry_force_edition = "random",
@@ -974,8 +986,6 @@ local antimatter = {
974986

975987
function Cryptid.antimatter_trigger_final_scoring(self, context, skip)
976988
if context.context == "final_scoring_step" then
977-
local crit_poll = pseudorandom(pseudoseed("cry_critical"))
978-
crit_poll = crit_poll / (G.GAME.probabilities.normal or 1)
979989
--Critical Deck
980990
if
981991
(
@@ -985,7 +995,15 @@ local antimatter = {
985995
~= 0
986996
or skip
987997
then
988-
if crit_poll < self.config.cry_crit_rate then
998+
if
999+
SMODS.pseudorandom_probability(
1000+
self,
1001+
"cry_critical",
1002+
1,
1003+
self.config.cry_crit_rate,
1004+
"Antimatter Deck"
1005+
)
1006+
then
9891007
context.mult = context.mult ^ 2
9901008
update_hand_text({ delay = 0 }, { mult = context.mult, chips = context.chips })
9911009
G.E_MANAGER:add_event(Event({
@@ -1098,9 +1116,15 @@ local antimatter = {
10981116
or skip
10991117
then
11001118
if #G.jokers.cards < G.jokers.config.card_limit then
1101-
local legendary_poll = pseudorandom(pseudoseed("cry_legendary"))
1102-
legendary_poll = legendary_poll / (G.GAME.probabilities.normal or 1)
1103-
if legendary_poll < self.config.cry_legendary_rate then
1119+
if
1120+
SMODS.pseudorandom_probability(
1121+
self,
1122+
"cry_legendary",
1123+
1,
1124+
self.config.cry_legendary_rate,
1125+
"Antimatter Deck"
1126+
)
1127+
then
11041128
local card = create_card("Joker", G.jokers, true, 4, nil, nil, nil, "")
11051129
card:add_to_deck()
11061130
card:start_materialize()

items/misc_joker.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3921,7 +3921,7 @@ local rnjoker = {
39213921
config = {},
39223922
order = 59,
39233923
loc_vars = function(self, info_queue, card)
3924-
local num, denom = SMODS.get_probability_vars(card, 1, card and card.ability.extra.cond_value or 0)
3924+
local num, denom = SMODS.get_probability_vars(card, 1, card and card.ability.extra.cond_value or 0, "RNJoker")
39253925
local vars = {
39263926
vars = {
39273927
(card.ability.extra and card.ability.extra.value_mod and card.ability.extra.value) or 0,
@@ -4163,7 +4163,8 @@ local rnjoker = {
41634163
card,
41644164
"rnj",
41654165
1,
4166-
card and card.ability.extra.cond_value or 0
4166+
card and card.ability.extra.cond_value or 0,
4167+
"RNJoker"
41674168
)
41684169
then
41694170
cond_passed = true
@@ -4450,7 +4451,8 @@ local rnjoker = {
44504451
card,
44514452
"rnj",
44524453
1,
4453-
card and card.ability.extra.cond_value or 0
4454+
card and card.ability.extra.cond_value or 0,
4455+
"RNJoker"
44544456
)
44554457
then
44564458
cond_passed = true
@@ -4538,7 +4540,8 @@ local rnjoker = {
45384540
card,
45394541
"rnj",
45404542
1,
4541-
card and card.ability.extra.cond_value or 0
4543+
card and card.ability.extra.cond_value or 0,
4544+
"RNJoker"
45424545
)
45434546
then
45444547
cond_passed = true

items/sleeve.lua

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ if CardSleeves then
197197
name = "Critical Sleeve",
198198
atlas = "atlasSleeves",
199199
pos = { x = 8, y = 0 },
200-
config = { cry_crit_rate = 0.25, cry_crit_miss_rate = 0.125 },
200+
config = { cry_crit_rate = 4, cry_crit_miss_rate = 8 },
201201
unlocked = true,
202202
unlock_condition = { deck = "Redeemed Deck", stake = 1 },
203203
loc_vars = function(self)
@@ -206,9 +206,21 @@ if CardSleeves then
206206
apply = function(self) end,
207207
trigger_effect = function(self, args)
208208
if args.context == "final_scoring_step" then
209-
local crit_poll = pseudorandom(pseudoseed("cry_critical"))
210-
crit_poll = crit_poll / (G.GAME.probabilities.normal or 1)
211-
if crit_poll < self.config.cry_crit_rate then
209+
local aaa = SMODS.pseudorandom_probability(
210+
self,
211+
"cry_critical",
212+
1,
213+
self.config.cry_crit_rate,
214+
"Critical Sleeve"
215+
)
216+
local bbb = SMODS.pseudorandom_probability(
217+
self,
218+
"cry_critical",
219+
1,
220+
self.config.cry_crit_miss_rate,
221+
"Critical Sleeve"
222+
)
223+
if aaa then
212224
args.mult = args.mult ^ 2
213225
update_hand_text({ delay = 0 }, { mult = args.mult, chips = args.chips })
214226
G.E_MANAGER:add_event(Event({
@@ -225,7 +237,7 @@ if CardSleeves then
225237
return true
226238
end,
227239
}))
228-
elseif crit_poll < self.config.cry_crit_rate + self.config.cry_crit_miss_rate then
240+
elseif bbb then
229241
args.mult = args.mult ^ 0.5
230242
update_hand_text({ delay = 0 }, { mult = args.mult, chips = args.chips })
231243
G.E_MANAGER:add_event(Event({
@@ -366,7 +378,7 @@ if CardSleeves then
366378
name = "Legendary Sleeve",
367379
atlas = "atlasSleeves",
368380
pos = { x = 1, y = 1 },
369-
config = { cry_legendary = true, cry_legendary_rate = 0.2 },
381+
config = { cry_legendary = true, cry_legendary_rate = 5 },
370382
unlocked = true,
371383
unlock_condition = { deck = "Legendary Deck", stake = 1 },
372384
loc_vars = function(self)
@@ -376,9 +388,15 @@ if CardSleeves then
376388
if args.context == "eval" and G.GAME.last_blind and G.GAME.last_blind.boss then
377389
if G.jokers then
378390
if #G.jokers.cards < G.jokers.config.card_limit then
379-
local legendary_poll = pseudorandom(pseudoseed("cry_legendary"))
380-
legendary_poll = legendary_poll / (G.GAME.probabilities.normal or 1)
381-
if legendary_poll < self.config.cry_legendary_rate then
391+
if
392+
SMODS.pseudorandom_probability(
393+
self,
394+
"cry_legendary",
395+
1,
396+
self.config.cry_legendary_rate,
397+
"Legendary Sleeve"
398+
)
399+
then
382400
local card = create_card("Joker", G.jokers, true, 4, nil, nil, nil, "")
383401
card:add_to_deck()
384402
card:start_materialize()
@@ -459,8 +477,8 @@ if CardSleeves then
459477
config = {
460478
voucher = {},
461479
cry_antimatter = true,
462-
cry_crit_rate = 0.25, -- Critical Sleeve, Effect Rate
463-
cry_legendary_rate = 0.2, -- Legendary Sleeve, Effect Rate
480+
cry_crit_rate = 4, -- Critical Sleeve, Effect Rate
481+
cry_legendary_rate = 5, -- Legendary Sleeve, Effect Rate
464482
cry_negative_rate = 20,
465483
cry_highlight_limit = 1e20,
466484
},
@@ -781,7 +799,15 @@ if CardSleeves then
781799
if #G.jokers.cards < G.jokers.config.card_limit then
782800
local legendary_poll = pseudorandom(pseudoseed("cry_legendary"))
783801
legendary_poll = legendary_poll / (G.GAME.probabilities.normal or 1)
784-
if legendary_poll < self.config.cry_legendary_rate then
802+
if
803+
SMODS.pseudorandom_probability(
804+
self,
805+
"cry_legendary",
806+
1,
807+
self.config.cry_legendary_rate,
808+
"Antimatter Sleeve"
809+
)
810+
then
785811
local card = create_card("Joker", G.jokers, true, 4, nil, nil, nil, "")
786812
card:add_to_deck()
787813
card:start_materialize()
@@ -1321,9 +1347,15 @@ if CardSleeves then
13211347
or skip
13221348
then
13231349
if context.context == "final_scoring_step" then
1324-
local crit_poll = pseudorandom(pseudoseed("cry_critical"))
1325-
crit_poll = crit_poll / (G.GAME.probabilities.normal or 1)
1326-
if crit_poll < self.config.cry_crit_rate then
1350+
if
1351+
SMODS.pseudorandom_probability(
1352+
self,
1353+
"cry_critical",
1354+
1,
1355+
self.config.cry_crit_rate,
1356+
"Antimatter Sleeve"
1357+
)
1358+
then
13271359
context.mult = context.mult ^ 2
13281360
update_hand_text({ delay = 0 }, { mult = context.mult, chips = context.chips })
13291361
G.E_MANAGER:add_event(Event({

0 commit comments

Comments
 (0)