mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-23 13:18:09 +01:00
[MIRROR] Unlucky trait (#11775)
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
co-authored by
Cameron Lennox
parent
6eab8c8408
commit
b8fe8fa68d
@@ -91,10 +91,10 @@
|
||||
sides = 10
|
||||
result = 10
|
||||
|
||||
/obj/item/dice/attack_self(mob/user as mob)
|
||||
/obj/item/dice/attack_self(mob/user)
|
||||
rollDice(user, 0)
|
||||
|
||||
/obj/item/dice/proc/rollDice(mob/user as mob, var/silent = 0)
|
||||
/obj/item/dice/proc/rollDice(mob/user, silent = FALSE)
|
||||
result = rand(1, sides)
|
||||
if(loaded)
|
||||
if(cheater)
|
||||
@@ -103,6 +103,9 @@
|
||||
else if(prob(75)) //makeshift weighted dice don't always work
|
||||
result = loaded
|
||||
icon_state = "[name][result]"
|
||||
var/result_override = SEND_SIGNAL(user, COMSIG_MOB_ROLLED_DICE, src, silent, result) //We can override dice rolls!
|
||||
if(result_override)
|
||||
result = result_override
|
||||
|
||||
if(!silent)
|
||||
var/comment = ""
|
||||
@@ -192,18 +195,18 @@
|
||||
/obj/item/dice,
|
||||
)
|
||||
|
||||
/obj/item/storage/dicecup/attack_self(mob/user as mob)
|
||||
/obj/item/storage/dicecup/attack_self(mob/user)
|
||||
user.visible_message(span_notice("[user] shakes [src]."), \
|
||||
span_notice("You shake [src]."), \
|
||||
span_notice("You hear dice rolling."))
|
||||
rollCup(user)
|
||||
|
||||
/obj/item/storage/dicecup/proc/rollCup(mob/user as mob)
|
||||
/obj/item/storage/dicecup/proc/rollCup(mob/user)
|
||||
for(var/obj/item/dice/I in src.contents)
|
||||
var/obj/item/dice/D = I
|
||||
D.rollDice(user, 1)
|
||||
|
||||
/obj/item/storage/dicecup/proc/revealDice(var/mob/viewer)
|
||||
/obj/item/storage/dicecup/proc/revealDice(mob/viewer)
|
||||
for(var/obj/item/dice/I in src.contents)
|
||||
var/obj/item/dice/D = I
|
||||
to_chat(viewer, "The [D.name] shows a [D.result].")
|
||||
@@ -230,3 +233,40 @@
|
||||
. = ..()
|
||||
for(var/i = 1 to 5)
|
||||
new /obj/item/dice(src)
|
||||
|
||||
/obj/item/dice/d20/cursed
|
||||
name = "d20"
|
||||
desc = "A dice with twenty sides."
|
||||
icon_state = "d2020"
|
||||
sides = 20
|
||||
result = 20
|
||||
|
||||
///If the dice will apply the major version of unlucky or not.
|
||||
var/evil = TRUE
|
||||
|
||||
|
||||
/obj/item/dice/d20/cursed/rollDice(mob/user, silent = FALSE)
|
||||
..()
|
||||
if(result == 1)
|
||||
to_chat(user, span_cult("You feel extraordinarily unlucky..."))
|
||||
if(evil)
|
||||
user.AddComponent(
|
||||
/datum/component/omen/dice,\
|
||||
incidents_left = 1,\
|
||||
luck_mod = 1,\
|
||||
damage_mod = 1,\
|
||||
evil = TRUE,\
|
||||
safe_disposals = FALSE,\
|
||||
vorish = TRUE,\
|
||||
)
|
||||
|
||||
else
|
||||
user.AddComponent(
|
||||
/datum/component/omen/dice,\
|
||||
incidents_left = 1,\
|
||||
luck_mod = 0.3,\
|
||||
damage_mod = 1,\
|
||||
evil = FALSE,\
|
||||
safe_disposals = FALSE,\
|
||||
vorish = TRUE,\
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user