diff --git a/code/game/objects/items/weapons/dice.dm b/code/game/objects/items/weapons/dice.dm index 72c45893439..231bf486d77 100644 --- a/code/game/objects/items/weapons/dice.dm +++ b/code/game/objects/items/weapons/dice.dm @@ -1,29 +1,89 @@ /obj/item/weapon/dice name = "d6" - desc = "A dice with six sides." + desc = "A die with six sides. Basic and servicable." icon = 'icons/obj/dice.dmi' - icon_state = "d66" + icon_state = "d6" w_class = 1 var/sides = 6 - attack_verb = list("diced") + var/result = null /obj/item/weapon/dice/New() - icon_state = "[name][rand(sides)]" + result = rand(1, sides) + update_icon() + +/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 dice with twenty sides." - icon_state = "d2020" + 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) - var/result = rand(1, sides) + diceroll(user) + +/obj/item/weapon/dice/throw_at(atom/target, range, speed, mob/user as mob) + if(!..()) + return + diceroll(user) + +/obj/item/weapon/dice/proc/diceroll(mob/user as mob) + 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 = "[name][result]" - user.visible_message("[user] has thrown [src]. It lands on [result]. [comment]", \ - "You throw [src]. It lands on a [result]. [comment]", \ - "You hear [src] landing on a [result]. [comment]") \ No newline at end of file + update_icon() + if(initial(icon_state) == "d00") + result = (result - 1)*10 + if(user != null) //Dice was rolled in someone's hand + user.visible_message("[user] has thrown [src]. It lands on [result]. [comment]", \ + "You throw [src]. It lands on [result]. [comment]", \ + "You hear [src] landing on [result]. [comment]") + else if(src.throwing == 0) //Dice was thrown and is coming to rest + visible_message("[src] rolls to a stop, landing on [result]. [comment]") +/* +/obj/item/weapon/dice/d4/Crossed(var/mob/living/carbon/human/H) + if(istype(H) && !H.shoes) + H << "You step on the D4!" + H.apply_damage(4,BRUTE,(pick("l_leg", "r_leg"))) + H.Weaken(3) +*///ew. +/obj/item/weapon/dice/update_icon() + overlays.Cut() + overlays += "[src.icon_state][src.result]" \ No newline at end of file diff --git a/icons/obj/dice.dmi b/icons/obj/dice.dmi index 669ad215c5c..0c9cd35a6b2 100644 Binary files a/icons/obj/dice.dmi and b/icons/obj/dice.dmi differ