Adds new microtransaction method: Scratch Cards! (#22618)

* scratch cards!

* Apply suggestions from code review

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* tweaking values

* maint loot tweak and to_chat

* sprites

* DGamerL review

* adjusting volume

* better like this

---------

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
Henri215
2023-10-09 20:36:24 +01:00
committed by GitHub
co-authored by DGamerL
parent 21c7ada399
commit a5783c7169
7 changed files with 78 additions and 10 deletions
@@ -132,6 +132,7 @@
/obj/item/storage/bag/plasticbag = 20,
/obj/item/storage/wallet = 20,
/obj/item/storage/wallet/random = 5,
/obj/item/scratch = 10,
/obj/item/caution = 10,
/obj/item/mod/construction/broken_core = 4,
/obj/effect/spawner/random_spawners/mod/maint = 10,
+50
View File
@@ -0,0 +1,50 @@
/obj/item/scratch
name = "scratch card"
desc = "Scratch this with a card or coin to discover if you are the winner!"
icon = 'icons/obj/economy.dmi'
icon_state = "scard"
w_class = WEIGHT_CLASS_TINY
/// Has this been scratched yet?
var/scratched = FALSE
/// The prob chance for it to be the winner card
var/winning_chance = 1
/// Is this the winner card?
var/winner = FALSE
/obj/item/scratch/attackby(obj/item/I, mob/user, params)
. = ..()
if(scratched)
return
if(!(istype(I, /obj/item/card) || istype(I, /obj/item/coin))) // We scratch with cards or coins!
return
if(prob(winning_chance))
to_chat(user, "<span class='notice'>Congratulations! Redeem your prize at the nearest ATM!</span>")
icon_state = "scard_winner"
winner = TRUE
else
to_chat(user, "Good luck next time.")
icon_state = "scard_loser"
playsound(user, 'sound/items/scratching.ogg', 25, TRUE)
scratched = TRUE
update_icon_state()
/obj/item/scratch/attack_obj(obj/O, mob/living/user, params)
if(winner && istype(O, /obj/machinery/economy/atm))
playsound(user, 'sound/machines/ping.ogg', 50, TRUE)
O.atom_say("Congratulations for winning the lottery!")
var/obj/item/reward = new /obj/item/stack/spacecash/c1000
qdel(src)
user.put_in_hands(reward)
return
..()
/obj/item/storage/box/scratch_cards
name = "scratch cards box"
desc = "Try your luck with five scratch cards!"
w_class = WEIGHT_CLASS_SMALL
can_hold = list(/obj/item/scratch)
/obj/item/storage/box/scratch_cards/populate_contents()
for(var/i in 1 to 5)
new /obj/item/scratch(src)
+19 -10
View File
@@ -65,7 +65,8 @@
/obj/item/grenade/barrier/dropwall,
/obj/item/toy/figure/crew/detective,
/obj/item/toy/figure/crew/hos,
/obj/item/toy/figure/crew/secofficer)
/obj/item/toy/figure/crew/secofficer,
/obj/item/storage/box/scratch_cards)
job_list = list("Head of Security", "Security Officer", "Detective", "Warden")
/obj/item/envelope/science
@@ -82,8 +83,9 @@
/obj/item/toy/figure/crew/geneticist,
/obj/item/toy/figure/crew/rd,
/obj/item/toy/figure/crew/roboticist,
/obj/item/toy/figure/crew/scientist)
job_list = list("Research Director", "Roboticist", "Geneticist", "Scientist")
/obj/item/toy/figure/crew/scientist,
/obj/item/storage/box/scratch_cards)
job_list = list("Research Director", "Roboticist", "Geneticist", "Scientist")
/obj/item/envelope/supply
icon_state = "mail_sup"
@@ -97,7 +99,8 @@
/obj/item/stack/wrapping_paper,
/obj/item/toy/figure/crew/cargotech,
/obj/item/toy/figure/crew/qm,
/obj/item/toy/figure/crew/miner)
/obj/item/toy/figure/crew/miner,
/obj/item/storage/box/scratch_cards)
job_list = list("Quartermaster", "Cargo Technician", "Shaft Miner")
/obj/item/envelope/medical
@@ -114,7 +117,8 @@
/obj/item/toy/figure/crew/chemist,
/obj/item/toy/figure/crew/geneticist,
/obj/item/toy/figure/crew/md,
/obj/item/toy/figure/crew/virologist)
/obj/item/toy/figure/crew/virologist,
/obj/item/storage/box/scratch_cards)
job_list = list("Chief Medical Officer", "Medical Doctor", "Coroner", "Chemist", "Virologist", "Psychiatrist", "Paramedic")
/obj/item/envelope/engineering
@@ -129,7 +133,8 @@
/obj/item/grenade/gas/oxygen,
/obj/item/toy/figure/crew/atmos,
/obj/item/toy/figure/crew/ce,
/obj/item/toy/figure/crew/engineer)
/obj/item/toy/figure/crew/engineer,
/obj/item/storage/box/scratch_cards)
job_list = list("Chief Engineer", "Station Engineer", "Life Support Specialist")
/obj/item/envelope/bread
@@ -146,7 +151,8 @@
/obj/item/toy/figure/crew/botanist,
/obj/item/toy/figure/crew/chef,
/obj/item/toy/figure/crew/janitor,
/obj/item/toy/figure/crew/librarian)
/obj/item/toy/figure/crew/librarian,
/obj/item/storage/box/scratch_cards)
job_list = list("Bartender", "Chef", "Botanist", "Janitor", "Barber", "Librarian", "Barber")
/obj/item/envelope/circuses
@@ -162,7 +168,8 @@
/obj/item/toy/figure/crew/clown,
/obj/item/toy/figure/crew/hop,
/obj/item/toy/figure/crew/chaplain,
/obj/item/toy/figure/crew/mime)
/obj/item/toy/figure/crew/mime,
/obj/item/storage/box/scratch_cards)
job_list = list("Clown", "Mime", "Head of Personnel", "Chaplain")
@@ -178,7 +185,8 @@
/obj/item/clothing/head/collectable/petehat,
/obj/item/toy/figure/crew/captain,
/obj/item/toy/figure/crew/lawyer,
/obj/item/toy/figure/crew/dsquad)
/obj/item/toy/figure/crew/dsquad,
/obj/item/storage/box/scratch_cards)
job_list = list("Captain", "Magistrate", "Nanotrasen Representative", "Blueshield", "Internal Affairs Agent")
/obj/item/envelope/misc
@@ -192,7 +200,8 @@
/obj/item/clothing/head/cakehat,
/obj/item/toy/figure/crew/assistant,
/obj/item/toy/figure/owl,
/obj/item/toy/figure/griffin)
/obj/item/toy/figure/griffin,
/obj/item/storage/box/scratch_cards)
job_list = list("Assistant", "Explorer")