Merge pull request #3312 from Anewbe/dice_thing

Adds the Liar's Dice game
This commit is contained in:
Neerti
2017-05-03 16:02:18 -04:00
committed by GitHub
7 changed files with 198 additions and 87 deletions

View File

@@ -1,59 +0,0 @@
/obj/item/weapon/dice
name = "d6"
desc = "A dice with six sides."
icon = 'icons/obj/dice.dmi'
icon_state = "d66"
w_class = ITEMSIZE_TINY
var/sides = 6
attack_verb = list("diced")
/obj/item/weapon/dice/New()
icon_state = "[name][rand(1,sides)]"
/obj/item/weapon/dice/d4
name = "d4"
desc = "A dice with four sides."
icon_state = "d44"
sides = 4
/obj/item/weapon/dice/d8
name = "d8"
desc = "A dice with eight sides."
icon_state = "d88"
sides = 8
/obj/item/weapon/dice/d10
name = "d10"
desc = "A dice with ten sides."
icon_state = "d1010"
sides = 10
/obj/item/weapon/dice/d12
name = "d12"
desc = "A dice with twelve sides."
icon_state = "d1212"
sides = 12
/obj/item/weapon/dice/d20
name = "d20"
desc = "A dice with twenty sides."
icon_state = "d2020"
sides = 20
/obj/item/weapon/dice/d100
name = "d100"
desc = "A dice with ten sides. This one is for the tens digit."
icon_state = "d10010"
sides = 10
/obj/item/weapon/dice/attack_self(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 = "[name][result]"
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 a [result]. [comment]</span>", \
"<span class='notice'>You hear [src] landing on a [result]. [comment]</span>")

View File

@@ -1,30 +1,3 @@
/obj/item/weapon/storage/pill_bottle/dice //7d6
name = "bag of dice"
desc = "It's a small bag with dice inside."
icon = 'icons/obj/dice.dmi'
icon_state = "dicebag"
/obj/item/weapon/storage/pill_bottle/dice/New()
..()
for(var/i = 1 to 7)
new /obj/item/weapon/dice( src )
/obj/item/weapon/storage/pill_bottle/dice_nerd //DnD dice
name = "bag of gaming dice"
desc = "It's a small bag with gaming dice inside."
icon = 'icons/obj/dice.dmi'
icon_state = "magicdicebag"
/obj/item/weapon/storage/pill_bottle/dice_nerd/New()
..()
new /obj/item/weapon/dice/d4( src )
new /obj/item/weapon/dice( src )
new /obj/item/weapon/dice/d8( src )
new /obj/item/weapon/dice/d10( src )
new /obj/item/weapon/dice/d12( src )
new /obj/item/weapon/dice/d20( src )
new /obj/item/weapon/dice/d100( src )
/* /*
* Donut Box * Donut Box
*/ */

View File

@@ -10,6 +10,10 @@
display_name = "dice pack (gaming)" display_name = "dice pack (gaming)"
path = /obj/item/weapon/storage/pill_bottle/dice_nerd path = /obj/item/weapon/storage/pill_bottle/dice_nerd
/datum/gear/dice/cup
display_name = "dice cup and dice"
path = /obj/item/weapon/storage/dicecup/loaded
/datum/gear/cards /datum/gear/cards
display_name = "deck of cards" display_name = "deck of cards"
path = /obj/item/weapon/deck/cards path = /obj/item/weapon/deck/cards

157
code/modules/games/dice.dm Normal file
View File

@@ -0,0 +1,157 @@
/obj/item/weapon/dice
name = "d6"
desc = "A dice with six sides."
icon = 'icons/obj/dice.dmi'
icon_state = "d66"
w_class = ITEMSIZE_TINY
var/sides = 6
var/result = 6
attack_verb = list("diced")
/obj/item/weapon/dice/New()
icon_state = "[name][rand(1,sides)]"
/obj/item/weapon/dice/d4
name = "d4"
desc = "A dice with four sides."
icon_state = "d44"
sides = 4
result = 4
/obj/item/weapon/dice/d8
name = "d8"
desc = "A dice with eight sides."
icon_state = "d88"
sides = 8
result = 8
/obj/item/weapon/dice/d10
name = "d10"
desc = "A dice with ten sides."
icon_state = "d1010"
sides = 10
result = 10
/obj/item/weapon/dice/d12
name = "d12"
desc = "A dice with twelve sides."
icon_state = "d1212"
sides = 12
result = 12
/obj/item/weapon/dice/d20
name = "d20"
desc = "A dice with twenty sides."
icon_state = "d2020"
sides = 20
result = 20
/obj/item/weapon/dice/d100
name = "d100"
desc = "A dice with ten sides. This one is for the tens digit."
icon_state = "d10010"
sides = 10
result = 10
/obj/item/weapon/dice/attack_self(mob/user as mob)
rollDice(user, 0)
/obj/item/weapon/dice/proc/rollDice(mob/user as mob, var/silent = 0)
result = rand(1, sides)
icon_state = "[name][result]"
if(!silent)
var/comment = ""
if(sides == 20 && result == 20)
comment = "Nat 20!"
else if(sides == 20 && result == 1)
comment = "Ouch, bad luck."
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 a [result]. [comment]</span>", \
"<span class='notice'>You hear [src] landing on a [result]. [comment]</span>")
/*
* Dice packs
*/
/obj/item/weapon/storage/pill_bottle/dice //7d6
name = "bag of dice"
desc = "It's a small bag with dice inside."
icon = 'icons/obj/dice.dmi'
icon_state = "dicebag"
/obj/item/weapon/storage/pill_bottle/dice/New()
..()
for(var/i = 1 to 7)
new /obj/item/weapon/dice( src )
/obj/item/weapon/storage/pill_bottle/dice_nerd //DnD dice
name = "bag of gaming dice"
desc = "It's a small bag with gaming dice inside."
icon = 'icons/obj/dice.dmi'
icon_state = "magicdicebag"
/obj/item/weapon/storage/pill_bottle/dice_nerd/New()
..()
new /obj/item/weapon/dice/d4( src )
new /obj/item/weapon/dice( src )
new /obj/item/weapon/dice/d8( src )
new /obj/item/weapon/dice/d10( src )
new /obj/item/weapon/dice/d12( src )
new /obj/item/weapon/dice/d20( src )
new /obj/item/weapon/dice/d100( src )
/*
*Liar's Dice cup
*/
/obj/item/weapon/storage/dicecup
name = "dice cup"
desc = "A cup used to conceal and hold dice."
icon = 'icons/obj/dice.dmi'
icon_state = "dicecup"
w_class = ITEMSIZE_SMALL
storage_slots = 5
can_hold = list(
/obj/item/weapon/dice,
)
/obj/item/weapon/storage/dicecup/attack_self(mob/user as mob)
user.visible_message("<span class='notice'>[user] shakes [src].</span>", \
"<span class='notice'>You shake [src].</span>", \
"<span class='notice'>You hear dice rolling.</span>")
rollCup(user)
/obj/item/weapon/storage/dicecup/proc/rollCup(mob/user as mob)
for(var/obj/item/weapon/dice/I in src.contents)
var/obj/item/weapon/dice/D = I
D.rollDice(user, 1)
/obj/item/weapon/storage/dicecup/proc/revealDice(var/mob/viewer)
for(var/obj/item/weapon/dice/I in src.contents)
var/obj/item/weapon/dice/D = I
to_chat(viewer, "The [D.name] shows a [D.result].")
/obj/item/weapon/storage/dicecup/verb/peekAtDice()
set category = "Object"
set name = "Peek at Dice"
set desc = "Peek at the dice under your cup."
revealDice(usr)
/obj/item/weapon/storage/dicecup/verb/revealDiceHand()
set category = "Object"
set name = "Reveal Dice"
set desc = "Reveal the dice hidden under your cup."
for(var/mob/living/player in viewers(3))
to_chat(player, "[usr] reveals their dice.")
revealDice(player)
/obj/item/weapon/storage/dicecup/loaded/New()
..()
for(var/i = 1 to 5)
new /obj/item/weapon/dice( src )

View File

@@ -0,0 +1,36 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Anewbe
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Adds a cup for dice games, in the loadout."

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -822,7 +822,6 @@
#include "code\game\objects\items\weapons\cigs_lighters.dm" #include "code\game\objects\items\weapons\cigs_lighters.dm"
#include "code\game\objects\items\weapons\clown_items.dm" #include "code\game\objects\items\weapons\clown_items.dm"
#include "code\game\objects\items\weapons\cosmetics.dm" #include "code\game\objects\items\weapons\cosmetics.dm"
#include "code\game\objects\items\weapons\dice.dm"
#include "code\game\objects\items\weapons\dna_injector.dm" #include "code\game\objects\items\weapons\dna_injector.dm"
#include "code\game\objects\items\weapons\explosives.dm" #include "code\game\objects\items\weapons\explosives.dm"
#include "code\game\objects\items\weapons\extinguisher.dm" #include "code\game\objects\items\weapons\extinguisher.dm"
@@ -1399,6 +1398,7 @@
#include "code\modules\games\cah_white_cards.dm" #include "code\modules\games\cah_white_cards.dm"
#include "code\modules\games\cardemon.dm" #include "code\modules\games\cardemon.dm"
#include "code\modules\games\cards.dm" #include "code\modules\games\cards.dm"
#include "code\modules\games\dice.dm"
#include "code\modules\games\spaceball_cards.dm" #include "code\modules\games\spaceball_cards.dm"
#include "code\modules\games\tarot.dm" #include "code\modules\games\tarot.dm"
#include "code\modules\genetics\side_effects.dm" #include "code\modules\genetics\side_effects.dm"