Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lottery Tickets #1459

Open
wants to merge 2 commits into
base: baymerge-testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions code/modules/urist/datums/supplycrates.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,10 @@ Please keep it tidy, by which I mean put comments describing the item before the
newcargocost = 15 //675th on Nerva
containertype = /obj/structure/closet/crate/secure
containername = "yew wooden flooring crate"

/singleton/hierarchy/supply_pack/supply/lottovendor
name = "Vendor - Games - Lordania Lottery"
contains = list(/obj/machinery/vending/urist/lotto{anchored = FALSE})
cost = 100
containertype = /obj/structure/largecrate
containername = "\improper Vending Machine"
70 changes: 70 additions & 0 deletions code/modules/urist/items/vgitems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,73 @@
w_class = ITEM_SIZE_SMALL
obj_flags = OBJ_FLAG_CONDUCTIBLE
insultmsg = list("HONK!", "HELP, SHITCURITY!", "HELP MAINT", "SHITSEC", "I AM IN A CONSTANT STATE OF SUFFERING, EACH EON SPENT ON THIS PLANE OF EXISTENCE ECHOES ONLY PURE PAIN TO MY MORTAL COIL. GOD HAS DIED, AND HE HAS ONLY LEFT ME SUFFERING. ", "MY FUNNY BONE!")

//lottery scratchers - west3436 of /vg/station13
/obj/item/toy/lotto_ticket
name = "scratch-off lotto ticket"
desc = "A scratch-off lotto ticket."
icon = 'icons/urist/items/tgitems.dmi' //i see no reason to change this
w_class = ITEM_SIZE_TINY
var/revealed = FALSE
var/prize_multiplier
var/winnings = 0
var/list/prizelist = list(100000,50000,10000,5000,1000,500,250,100,50,20,10,5,4,3,2,1)
var/list/problist = list(0.0001, 0.0002, 0.001, 0.002, 0.01, 0.02, 0.04, 0.2, 1, 2.5, 5, 10, 12.5, 17, 20, 25)

/obj/item/toy/lotto_ticket/Initialize()
..()
pixel_y = rand(-8, 8) * PIXEL_MULTIPLIER
pixel_x = rand(-9, 9) * PIXEL_MULTIPLIER

/obj/item/toy/lotto_ticket/proc/scratch(var/input_prize_multiplier)
var/tuning_value = 1/5 //Used to adjust expected values.
var/profit = 0
for(var/prize = 1 to problist.len)
if(prob(problist[prize]))
profit = prizelist[prize]*input_prize_multiplier*tuning_value
return profit

/obj/item/toy/lotto_ticket/attackby(obj/item/S, mob/user)
if(revealed)
to_chat(user, SPAN_NOTICE("The film covering the prizes has already been scratched off."))
return

if(!is_sharp(S) && !istype(S, /obj/item/material/coin))
to_chat(user, SPAN_NOTICE("You need to use something sharp to scratch the ticket."))
return

if(do_after(user, src, 1 SECONDS))
src.revealed = TRUE
src.update_icon()
to_chat(user, SPAN_NOTICE("You scratch off the film covering the prizes."))
winnings = scratch(prize_multiplier)


/obj/item/toy/lotto_ticket/examine(mob/user)
. = ..()
if(revealed && winnings)
to_chat(user, SPAN_NOTICE("This one is a winner! You've won [winnings] thalers."))

/obj/item/toy/lotto_ticket/on_update_icon()
icon_state = initial(icon_state) + (revealed ? "_scratched" : "")

//Tier 1 card
/obj/item/toy/lotto_ticket/gold_rush
name = "Gold Rush lottery ticket"
desc = "A cheap scratch-off lottery ticket. Win up to 100,000 credits!"
icon_state = "lotto_1"
prize_multiplier = 5 //EV 4.55, ER -0.45

//Tier 2 card
/obj/item/toy/lotto_ticket/diamond_hands
name = "Diamond Hands lottery ticket"
desc = "A mid-price scratch-off lottery ticket. Win up to 400,000 credits!"
icon_state = "lotto_2"
prize_multiplier = 20 //EV 18.20, ER -1.80

//Tier 3 card
/obj/item/toy/lotto_ticket/phoron_fortune
name = "Phoron Fortune lottery ticket"
desc = "An expensive scratch-off lottery ticket. Win up to 1,000,000 credits!"
icon_state = "lotto_3"
prize_multiplier = 50 //EV 45.50, ER -4.50
52 changes: 52 additions & 0 deletions code/modules/urist/machinery/uristvending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,55 @@ Please keep it tidy, by which I mean put comments describing the item before the
products = list( /obj/item/device/assembly/prox_sensor = 5, /obj/item/device/assembly/signaler = 4,
/obj/item/device/assembly/infra = 4, /obj/item/device/assembly/prox_sensor = 4,
/obj/item/handcuffs = 8, /obj/item/device/flash = 4, /obj/item/clothing/glasses/sunglasses = 4)

//lottery scratchers - west3436 of /vg/station13
/obj/machinery/vending/urist/lotto
name = "\improper Lordania Lottery"
desc = "A table-mounted machine which prints proprietary scratch-off lottery tickets. Winners can be cashed here by reinserting the winning ticket."
product_slogans = list(
"Feeling lucky?",
"Money won is twice as sweet as money earned.",
"The greatest risk is not taking one."
)
product_ads = list(
"Quit while you're ahead. All the best gamblers do.",
"If there weren't luck involved, you would win every time.",
"Better an ounce of luck than a pound of gold.",
"Behind bad luck comes good luck."
)
vend_reply = "Good luck!"
icon_state = "Lotto"
products = list(
/obj/item/toy/lotto_ticket/gold_rush = 50,
/obj/item/toy/lotto_ticket/diamond_hands = 20,
/obj/item/toy/lotto_ticket/phoron_fortune = 10
)
prices = list(
/obj/item/toy/lotto_ticket/gold_rush = 10,
/obj/item/toy/lotto_ticket/diamond_hands = 25,
/obj/item/toy/lotto_ticket/phoron_fortune = 50,
)

/obj/machinery/vending/lotto/attackby(obj/item/I, user)
add_fingerprint(user)
if(istype(I, /obj/item/toy/lotto_ticket))
var/obj/item/toy/lotto_ticket/T = I
if(!T.winnings)
playsound(src, "buzz-sigh", 50, 1)
visible_message("<b>[src]</b>'s monitor flashes, \"This ticket is not a winning ticket.\"")
else
visible_message("<b>[src]</b>'s monitor flashes, \"Withdrawing [T.winnings] thalers from the Lordania Planetary Lottery Fund!\"")
spawn_money(T.winnings, get_turf(src))
playsound(loc, 'sound/items/polaroid1.ogg', 50, 1)
qdel(T)
else
..()

/obj/machinery/vending/lotto/throw_item()
var/mob/living/target = locate() in view(7, src)

if (!target)
return 0
for(var/i = 0 to rand(3,12))
var/obj/I = new /obj/item/paper(get_turf(src))
I.throw_at(target, 16, 3)
ErrorsWindows marked this conversation as resolved.
Show resolved Hide resolved
Binary file modified icons/urist/items/tgitems.dmi
Binary file not shown.
Binary file modified icons/urist/structures&machinery/machinery.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions maps/nerva/nerva-2.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -13501,6 +13501,7 @@
dir = 4
},
/obj/structure/table/woodentable_reinforced/walnut,
/obj/machinery/vending/urist/lotto,
/turf/simulated/floor/wood/walnut,
/area/civilian/bar)
"axr" = (
Expand Down