You have unlocked: Greedier mode! (#22884)

* You have unlocked: Greedier mode!

* Apply suggestions from code review

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* Update debuffs.dm

* Apply suggestions from code review

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>

---------

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
Qwertytoforty
2023-11-01 20:11:08 +00:00
committed by GitHub
co-authored by Luc Henri215 Contrabang
parent e7b396eddf
commit ed8406d707
5 changed files with 262 additions and 39 deletions
@@ -1,56 +1,101 @@
//These objects are used in the cardinal sin-themed ruins (i.e. Gluttony, Pride...)
// Greed
#define WIN_PROB 5
/obj/structure/cursed_slot_machine //Greed's slot machine: Used in the Greed ruin. Deals clone damage on each use, with a successful use giving a d20 of fate.
/// Greed's slot machine: Used in the Greed ruin. Deals damage on each use, with a successful use giving a d20 of fate.
/obj/structure/cursed_slot_machine
name = "greed's slot machine"
desc = "High stakes, high rewards."
icon = 'icons/obj/economy.dmi'
icon_state = "slots-off"
icon = 'icons/obj/computer.dmi'
icon_state = "slots"
anchored = TRUE
density = TRUE
/// Variable that tracks the screen we display.
var/icon_screen = "slots_screen"
/// Should we be emitting light?
var/brightness_on = TRUE
/// The probability the player has to win.
var/win_prob = 5
/// The maximum amount of curses we will allow a player to have before disallowing them to use the machine.
var/max_curse_amount = 5
/// machine's reward when you hit jackpot
var/prize = /obj/structure/cursed_money
/// should we be applying the cursed status effect?
var/status_effect_on_roll = TRUE
/// Length of the cooldown between the machine being used and being able to spin the machine again.
var/cooldown_length = 30 SECONDS
/// Are we currently in use? Anti-spam prevention measure.
var/in_active_use = FALSE
/// Cooldown between pulls of the cursed slot machine.
COOLDOWN_DECLARE(spin_cooldown)
/obj/structure/cursed_slot_machine/Initialize(mapload)
. = ..()
update_appearance()
set_light(brightness_on)
/obj/structure/cursed_slot_machine/attack_hand(mob/user)
interact(user)
/obj/structure/cursed_slot_machine/interact(mob/living/carbon/human/user)
if(!istype(user))
if(!ishuman(user))
return
if(in_use)
if(!check_and_set_usage(user))
return
in_use = TRUE
if(!ismachineperson(user))
user.adjustCloneLoss(20)
else
to_chat(user, "<span class='userdanger'>Your brain is sparking!</span>")
user.adjustBrainLoss(15)
if(user.stat)
to_chat(user, "<span class='userdanger'>No... just one more try...</span>")
user.gib()
else
user.visible_message("<span class='warning'>[user] pulls [src]'s lever with a glint in [user.p_their()] eyes!</span>", "<span class='warning'>You feel a draining as you pull the lever, but you \
know it'll be worth it.</span>")
icon_state = "slots-on"
playsound(src, 'sound/lavaland/cursed_slot_machine.ogg', 50)
addtimer(CALLBACK(src, PROC_REF(determine_victor), user), 50)
user.visible_message(
"<span class='warning'>[user] pulls [src]'s lever with a glint in [user.p_their()] eyes!</span>",
"<span class='warning'>You feel a draining as you pull the lever, but you know it'll be worth it.</span>")
/obj/structure/cursed_slot_machine/proc/determine_victor(mob/living/user)
icon_state = "slots-off"
in_use = FALSE
if(prob(WIN_PROB))
playsound(src, 'sound/lavaland/cursed_slot_machine_jackpot.ogg', 50)
new/obj/structure/cursed_money(get_turf(src))
if(user)
to_chat(user, "<span class='boldwarning'>You've hit jackpot. Laughter echoes around you as your reward appears in the machine's place.</span>")
qdel(src)
else
if(user)
to_chat(user, "<span class='boldwarning'>Fucking machine! Must be rigged. Still... one more try couldn't hurt, right?</span>")
icon_screen = "slots_screen_working"
update_appearance()
playsound(src, 'sound/lavaland/cursed_slot_machine.ogg', 50, FALSE)
addtimer(CALLBACK(src, PROC_REF(determine_victor), user), 5 SECONDS)
#undef WIN_PROB
/obj/structure/cursed_slot_machine/update_overlays()
. = ..()
var/overlay_state = icon_screen
. += mutable_appearance(icon, overlay_state)
. += emissive_appearance(icon, overlay_state, src)
/// Validates that the user can use the cursed slot machine. User is the person using the slot machine. Returns TRUE if we can, FALSE otherwise.
/obj/structure/cursed_slot_machine/proc/check_and_set_usage(mob/living/carbon/human/user)
if(in_active_use)
to_chat(user, "<span class='warning'>The machine is already spinning!</span>")
return FALSE
var/signal_value = SEND_SIGNAL(user, COMSIG_CURSED_SLOT_MACHINE_USE, max_curse_amount)
if(!COOLDOWN_FINISHED(src, spin_cooldown) || (signal_value & SLOT_MACHINE_USE_POSTPONE))
to_chat(user, "<span class='danger'>The machine doesn't engage. You get the compulsion to try again in a few seconds.</span>")
return FALSE
if(signal_value & SLOT_MACHINE_USE_CANCEL) // failsafe in case we don't want to let the machine be used for some reason (like if we're maxed out on curses but not getting gibbed)
atom_say("We're sorry, but we can no longer serve you at this establishment.")
return FALSE
in_active_use = TRUE
return TRUE
/obj/structure/cursed_slot_machine/proc/determine_victor(mob/living/carbon/human/user)
icon_screen = initial(icon_screen)
update_appearance()
in_active_use = FALSE
COOLDOWN_START(src, spin_cooldown, cooldown_length)
if(!prob(win_prob))
if(status_effect_on_roll && isnull(user.has_status_effect(/datum/status_effect/cursed)))
user.apply_status_effect(/datum/status_effect/cursed)
SEND_SIGNAL(user, COMSIG_CURSED_SLOT_MACHINE_LOST)
playsound(src, 'sound/machines/buzz-sigh.ogg', 30, TRUE)
return
playsound(src, 'sound/lavaland/cursed_slot_machine_jackpot.ogg', 50, FALSE)
new prize(get_turf(src))
if(user)
to_chat(user, "<span class='boldwarning'>You've hit the jackpot!!! Laughter echoes around you as your reward appears in the machine's place.</span>")
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_CURSED_SLOT_MACHINE_WON)
qdel(src)
/obj/structure/cursed_money
name = "bag of money"
@@ -82,7 +127,7 @@
var/turf/T = get_turf(user)
var/obj/item/dice/d20/fate/one_use/critical_fail = new(T)
user.put_in_hands(critical_fail)
qdel(src)
collapse()
// Gluttony
/obj/effect/gluttony //Gluttony's wall: Used in the Gluttony ruin. Only lets the overweight through.