67ee2fd661
*the dice now all have different colors, to make them easy to tell the difference between them at a glance. *the d2 has been swapped out for a d00, though you can still create a d2 if someone demands it. *the generic pill bottle full of dice has been replaced with a proper dice bag. *actually throwing a die will now cause it to roll until the throw ends, at which point it will state the result of the throw. The old method still works as well. *most new dice have had their sprites edited to be smaller. *minor grammer corrections.
76 lines
2.2 KiB
Plaintext
76 lines
2.2 KiB
Plaintext
/obj/item/weapon/dice
|
|
name = "d6"
|
|
desc = "A die with six sides. Basic and servicable."
|
|
icon = 'icons/obj/dice.dmi'
|
|
icon_state = "d6"
|
|
w_class = 1
|
|
var/sides = 6
|
|
|
|
/obj/item/weapon/dice/New()
|
|
icon_state = "[initial(icon_state)][rand(1, sides)]"
|
|
|
|
/obj/item/weapon/dice/d2
|
|
name = "d2"
|
|
desc = "A die with two sides. Coins are undignified!"
|
|
icon_state = "d2"
|
|
sides = 2
|
|
|
|
/obj/item/weapon/dice/d4
|
|
name = "d4"
|
|
desc = "A die with four sides. The nerd's caltrop."
|
|
icon_state = "d4"
|
|
sides = 4
|
|
|
|
/obj/item/weapon/dice/d8
|
|
name = "d8"
|
|
desc = "A die with eight sides. It feels... lucky."
|
|
icon_state = "d8"
|
|
sides = 8
|
|
|
|
/obj/item/weapon/dice/d10
|
|
name = "d10"
|
|
desc = "A die with ten sides. Useful for percentages."
|
|
icon_state = "d10"
|
|
sides = 10
|
|
|
|
/obj/item/weapon/dice/d00
|
|
name = "d00"
|
|
desc = "A die with ten sides. Works better for d100 rolls than a golfball."
|
|
icon_state = "d00"
|
|
sides = 10
|
|
|
|
/obj/item/weapon/dice/d12
|
|
name = "d12"
|
|
desc = "A die with twelve sides. There's an air of neglect about it."
|
|
icon_state = "d12"
|
|
sides = 12
|
|
|
|
/obj/item/weapon/dice/d20
|
|
name = "d20"
|
|
desc = "A die with twenty sides. The prefered die to throw at the GM."
|
|
icon_state = "d20"
|
|
sides = 20
|
|
|
|
/obj/item/weapon/dice/attack_self(mob/user as mob)
|
|
diceroll(user)
|
|
|
|
/obj/item/weapon/dice/throw_at(atom/target, range, speed, mob/user as mob)
|
|
..()
|
|
diceroll(user)
|
|
|
|
/obj/item/weapon/dice/proc/diceroll(mob/user as mob)
|
|
var/result = rand(1, sides)
|
|
var/comment = ""
|
|
if(sides == 20 && result == 20)
|
|
comment = "Nat 20!"
|
|
else if(sides == 20 && result == 1)
|
|
comment = "Ouch, bad luck."
|
|
icon_state = "[initial(icon_state)][result]"
|
|
if(initial(icon_state) == "d00")
|
|
result = (result - 1)*10
|
|
if(user != null) //Dice was rolled in someone's hand
|
|
user.visible_message("<span class='notice'>[user] has thrown [src]. It lands on [result]. [comment]</span>", \
|
|
"<span class='notice'>You throw [src]. It lands on [result]. [comment]</span>", \
|
|
"<span class='notice'>You hear [src] landing on [result]. [comment]</span>")
|
|
else if(src.throwing == 0) //Dice was thrown and is coming to rest
|
|
src.loc.visible_message("<span class='notice'>[src] rolls to a stop, landing on [result]. [comment]</span>") |