Stacking Die (#12929)

This commit is contained in:
Geeves
2022-02-02 18:13:06 +02:00
committed by GitHub
parent a32ce7644e
commit d75c99fbdf
11 changed files with 87 additions and 64 deletions
+1 -1
View File
@@ -39,7 +39,7 @@
/obj/item/board = TRADER_THIS_TYPE,
/obj/item/deck = TRADER_SUBTYPES_ONLY,
/obj/item/pack = TRADER_SUBTYPES_ONLY,
/obj/item/dice = TRADER_ALL,
/obj/item/stack/dice = TRADER_ALL,
/obj/item/eightball = TRADER_ALL,
/obj/item/gun/energy/wand/toy = TRADER_THIS_TYPE,
/obj/item/spirit_board = TRADER_ALL
+4 -4
View File
@@ -232,14 +232,14 @@
add_fingerprint(user)
/obj/item/dice/tajara
/obj/item/stack/dice/tajara
name = "adhomian dice"
desc = "An adhomian dice made out of wood. Commonly used to play Suns and Moon."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "brother1"
base_icon = "brother"
/obj/item/dice/tajara/alt
/obj/item/stack/dice/tajara/alt
icon_state = "sister1"
base_icon = "sister"
@@ -251,6 +251,6 @@
of the rules has garnered it quite the reputation. Die will usually have an image of Rredouane fixed upon them. Parks will commonly have designated spots for people to play Suns and Moon. Disputes are \
also solved through this game."
starts_with = list(
/obj/item/dice/tajara = 3,
/obj/item/dice/tajara/alt = 3
/obj/item/stack/dice/tajara = 3,
/obj/item/stack/dice/tajara/alt = 3
)
+44 -25
View File
@@ -1,77 +1,96 @@
/obj/item/dice
/obj/item/stack/dice
name = "d6"
desc = "A dice with six sides."
icon = 'icons/obj/dice.dmi'
icon_state = "d66"
w_class = ITEMSIZE_TINY
attack_verb = list("diced")
max_amount = 6
var/base_icon = "d6"
var/side_mult = 1 // Used for d100s.
var/sides = 6
var/weighted = FALSE //if this dice can cheat or something
var/weight_roll = 0 // chance of the dice falling on its favored number
var/favored_number = 1 //related to the var above
var/weighted_value = 70 //what is the chance of falling on the favored number
attack_verb = list("diced")
/obj/item/dice/Initialize()
/obj/item/stack/dice/Initialize()
. = ..()
icon_state = "[base_icon][rand(1,sides)]"
/obj/item/dice/update_icon(var/result)
/obj/item/stack/dice/update_icon(var/result)
check_maptext(SMALL_FONTS(7, get_amount()))
if(result)
icon_state = "[base_icon][result]"
/obj/item/dice/throw_impact(atom/hit_atom)
..()
var/result
if((weighted) && (prob(weighted_value)))
result = favored_number
/obj/item/stack/dice/attack_self(mob/user)
if(amount > 1)
user.visible_message("<b>[user]</b> shakes the die in their hand...", SPAN_NOTICE("You shake the die in your hands..."))
else
result = rand(1, sides)
user.visible_message("<b>[user]</b> raises the dice to their mouth and blows on it...", SPAN_NOTICE("You raise the dice to your mouth and blow on it..."))
var/comment = ""
if(sides == 20 && result == 20)
comment = "Nat 20!"
else if(sides == 20 && result == 1)
comment = "Ouch, bad luck."
update_icon(result)
src.visible_message("<span class='notice'>\The [name] lands on [result * side_mult]. [comment]</span>")
/obj/item/stack/dice/throw_impact(atom/hit_atom)
..()
/obj/item/dice/d4
var/total_result = 0
var/list/results = list()
for(var/i = 1 to amount)
if(weight_roll && prob(weight_roll))
message_admins("hit weight roll")
results += favored_number
else
results += rand(1, sides)
total_result += results[i]
if(amount > 1)
visible_message(SPAN_NOTICE("The die rolls, revealing... <b>[total_result * side_mult]</b>! ([english_list(results, "", " + ", " + ", "")])"))
update_icon(results[length(results)])
else
visible_message(SPAN_NOTICE("\The [name] lands on <b>[total_result * side_mult]</b>.[get_comment(total_result)]"))
update_icon(total_result)
/obj/item/stack/dice/proc/get_comment(var/result)
if(sides == result)
return " Nat [sides * side_mult]!"
if(result == 1)
return " Ouch, bad luck."
return ""
/obj/item/stack/dice/d4
name = "d4"
desc = "A dice with four sides."
icon_state = "d44"
sides = 4
base_icon = "d4"
/obj/item/dice/d8
/obj/item/stack/dice/d8
name = "d8"
desc = "A dice with eight sides."
icon_state = "d88"
sides = 8
base_icon = "d8"
/obj/item/dice/d10
/obj/item/stack/dice/d10
name = "d10"
desc = "A dice with ten sides."
icon_state = "d1010"
sides = 10
base_icon = "d10"
/obj/item/dice/d12
/obj/item/stack/dice/d12
name = "d12"
desc = "A dice with twelve sides."
icon_state = "d1212"
sides = 12
base_icon = "d12"
/obj/item/dice/d20
/obj/item/stack/dice/d20
name = "d20"
desc = "A dice with twenty sides."
icon_state = "d2020"
sides = 20
base_icon = "d20"
/obj/item/dice/d100
/obj/item/stack/dice/d100
name = "d100"
desc = "A dice with ten sides. This one is for the tens digit."
icon_state = "d10010"
@@ -157,7 +157,7 @@
item_state = "pill_canister"
center_of_mass = list("x" = 16,"y" = 12)
w_class = ITEMSIZE_SMALL
can_hold = list(/obj/item/reagent_containers/pill,/obj/item/dice,/obj/item/paper)
can_hold = list(/obj/item/reagent_containers/pill,/obj/item/stack/dice,/obj/item/paper)
allow_quick_gather = 1
use_to_pickup = 1
use_sound = 'sound/items/storage/pillbottle.ogg'
@@ -286,4 +286,4 @@ obj/item/storage/pill_bottle/butazoline
/obj/item/storage/pill_bottle/parvosil
name = "bottle of 2u Parvosil pills"
desc = "Contains pills used to treat anxiety disorders such as phobias and social anxiety."
starts_with = list(/obj/item/reagent_containers/pill/parvosil = 3)
starts_with = list(/obj/item/reagent_containers/pill/parvosil = 3)
@@ -7,8 +7,8 @@
drop_sound = 'sound/items/drop/hat.ogg'
pickup_sound = 'sound/items/pickup/hat.ogg'
starts_with = list(
/obj/item/dice = 1,
/obj/item/dice/d20 = 1
/obj/item/stack/dice = 12,
/obj/item/stack/dice/d20 = 4
)
/obj/item/storage/pill_bottle/dice/gaming
@@ -16,11 +16,11 @@
desc = "It's a small container with gaming dice inside."
icon_state = "magicdicebag"
starts_with = list(
/obj/item/dice/d4 = 1,
/obj/item/dice/d8 = 1,
/obj/item/dice/d10 = 1,
/obj/item/dice/d12 = 1,
/obj/item/dice/d100 = 1
/obj/item/stack/dice/d4 = 4,
/obj/item/stack/dice/d8 = 4,
/obj/item/stack/dice/d10 = 4,
/obj/item/stack/dice/d12 = 4,
/obj/item/stack/dice/d100 = 4
)
/obj/item/storage/card
@@ -16,7 +16,7 @@
/obj/item/seeds,
/obj/item/stack/medical,
/obj/item/coin,
/obj/item/dice,
/obj/item/stack/dice,
/obj/item/disk,
/obj/item/implanter,
/obj/item/flame/lighter,
@@ -228,4 +228,4 @@
if(!plastic_film)
plastic_film = image('icons/mob/lanyard_overlays.dmi', icon_state = "plasticfilm")
I.add_overlay(plastic_film)
return I
return I
+13 -15
View File
@@ -547,8 +547,8 @@ All custom items with worn sprites must follow the contained sprite system: http
w_class = ITEMSIZE_NORMAL
/obj/item/dice/fluff/baron_dice //BARON's Dice - BARON - iamcrystalclear
weighted = TRUE
/obj/item/stack/dice/fluff/baron_dice //BARON's Dice - BARON - iamcrystalclear
weight_roll = 70
favored_number = 2
@@ -2039,11 +2039,11 @@ All custom items with worn sprites must follow the contained sprite system: http
item_state = "sur_dbag"
starts_with = list(
/obj/item/dice/fluff/suraya_dice = 3,
/obj/item/dice/fluff/suraya_dice/alt = 3
/obj/item/stack/dice/fluff/suraya_dice = 3,
/obj/item/stack/dice/fluff/suraya_dice/alt = 3
)
/obj/item/dice/fluff/suraya_dice
/obj/item/stack/dice/fluff/suraya_dice
name = "blue adhomian die"
desc = "A blue-and-gold wooden die with six sides, beautifully carved and delicately painted. The single dot on the number one side is, on closer inspection, a miniature image of the god Rredouane."
icon = 'icons/obj/custom_items/suraya_dice.dmi'
@@ -2051,19 +2051,17 @@ All custom items with worn sprites must follow the contained sprite system: http
icon_state = "sur_b_d1"
base_icon = "sur_b_d"
favored_number = 1
weighted_value = 22
weight_roll = 22
/obj/item/dice/fluff/suraya_dice/AltClick(mob/user)
weighted = !weighted
if(!weighted)
to_chat(user, SPAN_NOTICE("You jiggle the die rapidly in your hand, resetting the internal weighting."))
/obj/item/stack/dice/fluff/suraya_dice/AltClick(mob/user)
if(!weight_roll)
user.visible_message("<b>\The [user]</b> jiggles \the [src] around in their hand for a second.", SPAN_NOTICE("You jiggle the die rapidly in your hand, resetting the internal weighting."))
weight_roll = 0
else
to_chat(user, SPAN_NOTICE("You carefully jiggle the die one way, then the other, allowing its internal weighting to lock into place."))
user.visible_message("<b>\The [user]</b> jiggles \the [src] around in their hand for a second.", SPAN_NOTICE("You carefully jiggle the die one way, then the other, allowing its internal weighting to lock into place."))
weight_roll = initial(weight_roll)
user.visible_message("<b>\The [user]</b> jiggles \the [src] around in their hand for a second.")
/obj/item/dice/fluff/suraya_dice/alt
/obj/item/stack/dice/fluff/suraya_dice/alt
name = "green adhomian die"
desc = "A green-and-silver wooden die with six sides, beautifully carved and delicately painted. The single dot on the number one side is, on closer inspection, a miniature image of the god Rredouane."
icon_state = "sur_g_d1"
+6
View File
@@ -0,0 +1,6 @@
author: Geeves
delete-after: True
changes:
- rscadd: "You can now combine dice of the same type into a die stack."
+1 -1
View File
@@ -20767,7 +20767,7 @@
/area/security/prison)
"aJV" = (
/obj/structure/table/standard,
/obj/item/dice,
/obj/item/stack/dice,
/obj/machinery/atmospherics/pipe/simple/hidden/supply{
dir = 4
},
+4 -4
View File
@@ -9141,7 +9141,7 @@
/area/security/prison)
"aqN" = (
/obj/structure/table/standard,
/obj/item/dice,
/obj/item/stack/dice,
/turf/simulated/floor/tiled,
/area/security/prison)
"aqO" = (
@@ -17590,8 +17590,8 @@
pixel_y = 25
},
/obj/structure/table/wood,
/obj/item/dice/d20,
/obj/item/dice,
/obj/item/stack/dice/d20,
/obj/item/stack/dice,
/turf/simulated/floor/wood,
/area/library)
"aHD" = (
@@ -53008,7 +53008,7 @@
/area/engineering/break_room)
"bWB" = (
/obj/structure/table/wood,
/obj/item/dice,
/obj/item/stack/dice,
/turf/simulated/floor/carpet,
/area/engineering/break_room)
"bWC" = (
+3 -3
View File
@@ -7329,7 +7329,7 @@
"aBV" = (
/obj/structure/table/wood,
/obj/effect/decal/cleanable/dirt,
/obj/item/dice,
/obj/item/stack/dice,
/turf/unsimulated/floor{
dir = 8;
icon_state = "wood"
@@ -9626,7 +9626,7 @@
/area/antag/wizard)
"aKq" = (
/obj/structure/table/wood,
/obj/item/dice/d20,
/obj/item/stack/dice/d20,
/turf/unsimulated/floor{
dir = 8;
icon_state = "wood"
@@ -9701,7 +9701,7 @@
/area/antag/wizard)
"aKA" = (
/obj/structure/table/wood,
/obj/item/dice,
/obj/item/stack/dice,
/turf/unsimulated/floor{
dir = 8;
icon_state = "wood"