mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Slot machines influenced by luck, scratch cards less influenced by luck, & made luckier clovers rarer. (#32670)
* Slot machines influenced by luck & made luckier clovers rarer. * Simplify. * Nicer logic. * Update lotto.dm * Update lotto.dm * Update slot_machine.dm * Tweak. * Update slot_machine.dm Harder slots * Update lotto.dm Harder lotto. * Update lotto.dm
This commit is contained in:
@@ -97,7 +97,8 @@
|
||||
|
||||
icon_state = initial_icon
|
||||
|
||||
/obj/machinery/computer/slot_machine/proc/spin_wheels(win = -1) //If win=-1, the result is pure randomness. If win=0, you NEVER win. If win is 1 to 10, you win.
|
||||
/obj/machinery/computer/slot_machine/proc/spin_wheels(win = -1, var/mob/spinner) //If win=-1, the result is pure randomness. If win=0, you NEVER win. If win is 1 to 10, you win.
|
||||
|
||||
while(1)
|
||||
value_1 = rand(1,10)
|
||||
value_2 = rand(1,10)
|
||||
@@ -105,6 +106,15 @@
|
||||
|
||||
switch(win)
|
||||
if(-1)
|
||||
//Take luck into account.
|
||||
if(spinner)
|
||||
var/spinnerluck = spinner.luck()
|
||||
var/jostlepower = rand(25,3000)
|
||||
var/jostles = min(round(abs(spinnerluck), jostlepower) / jostlepower, 1000)
|
||||
while(jostles)
|
||||
if(jostle(spinnerluck > 0))
|
||||
break
|
||||
jostles -= 1
|
||||
return //Pure randomness!
|
||||
if(0)
|
||||
if(!(value_1 == value_2 && value_2 == value_3)) //If we're NOT winning
|
||||
@@ -117,6 +127,32 @@
|
||||
else
|
||||
return
|
||||
|
||||
/obj/machinery/computer/slot_machine/proc/jostle(towin = TRUE)
|
||||
if((value_1 != value_2 || value_2 != value_3 || value_1 != value_3) && towin) //Lucky people get jostles on unaligned wheels.
|
||||
switch(rand(1,3))
|
||||
if(1)
|
||||
if(value_1 != value_2 && value_1 != value_3)
|
||||
value_1 = rand(1,10)
|
||||
if(2)
|
||||
if(value_1 != value_2 && value_2 != value_3)
|
||||
value_2 = rand(1,10)
|
||||
if(3)
|
||||
if(value_1 != value_3 && value_2 != value_3)
|
||||
value_3 = rand(1,10)
|
||||
else if((value_1 == value_2 || value_2 == value_3 || value_1 == value_3) && !towin) //Unlucky people get jostles on aligned wheels.
|
||||
switch(rand(1,3))
|
||||
if(1)
|
||||
if(value_1 == value_2 || value_1 == value_3)
|
||||
value_1 = rand(1,10)
|
||||
if(2)
|
||||
if(value_1 == value_2 || value_2 == value_3)
|
||||
value_2 = rand(1,10)
|
||||
if(3)
|
||||
if(value_1 == value_3 || value_2 == value_3)
|
||||
value_3 = rand(1,10)
|
||||
else
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/slot_machine/proc/spin(mob/user)
|
||||
if(spinning)
|
||||
return
|
||||
@@ -150,9 +186,9 @@
|
||||
|
||||
switch(victory)
|
||||
if(1) //1 in 10 for a guaranteed small reward
|
||||
spin_wheels(win = pick(BELL, MUSHROOM, TREE))
|
||||
spin_wheels(win = pick(BELL, MUSHROOM, TREE), spinner = user)
|
||||
if(2 to 10) //Otherwise, a fully random spin (1/1000 to get jackpot, 1/100 to get other reward)
|
||||
spin_wheels(win = -1)
|
||||
spin_wheels(win = -1, spinner = user)
|
||||
|
||||
//If there's only one icon_state for spinning, everything looks weird
|
||||
var/list/spin_states = list("spin1","spin2","spin3")
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
for(var/prize = 1 to problist.len)
|
||||
var/thisprob = problist[prize]
|
||||
//Take luck into account.
|
||||
if(user ? user.lucky_prob(thisprob, luckfactor = 1/500, ourluck = luck) : prob(thisprob))
|
||||
if(user ? user.lucky_prob(thisprob, luckfactor = 1/5000, maxskew = 25, ourluck = luck) : prob(thisprob))
|
||||
profit = prizelist[prize]*input_prize_multiplier*tuning_value
|
||||
return profit
|
||||
|
||||
@@ -144,4 +144,4 @@
|
||||
user.visible_message("<span class='warning'>As \the [user] grasps onto \the [src], their [external.display_name] begins rapidly combusting!</span>", "<span class = 'warning'>As you try to get a grip onto \the [src], you feel your [external.display_name] tingle and glow, before it rapidly dissipates into ash.</span>")
|
||||
playsound(src, 'sound/effects/supermatter.ogg', 50, 1)
|
||||
external.dust()
|
||||
return 1
|
||||
return 1
|
||||
|
||||
@@ -1148,12 +1148,12 @@ var/list/special_fruits = list()
|
||||
if(shifter ? shifter.lucky_prob(prob1, 1/100, 25, ourluck = luck) : prob(prob1))
|
||||
var/ls = 1
|
||||
var/prob2 = max(clamp(mut, 0, 21) / 21, 0.1)
|
||||
prob2 = shifter ? shifter.lucky_probability(prob2, 1/100 , 33, ourluck = luck) : prob2
|
||||
prob2 = shifter ? shifter.lucky_probability(prob2, 1/333 , 33, ourluck = luck) : prob2
|
||||
for(var/i in 1 to 7)
|
||||
if(prob(prob2))
|
||||
ls += 1
|
||||
leaves += ls * pick(-1,1)
|
||||
if(shifter ? shifter.lucky_prob(3, 1/100, 50, ourluck = luck) : prob(3))
|
||||
if(shifter ? shifter.lucky_prob(3, 1/333, 50, ourluck = luck) : prob(3))
|
||||
leaves = clamp(leaves, 0, 7)
|
||||
else if(leaves < 0 || leaves > 7)
|
||||
leaves = 3
|
||||
|
||||
Reference in New Issue
Block a user