mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Rework toy card decks into standard decks (#17925)
* Go fish * Keep forgetting about the map * Forgot about the sprites for the double deck * Cleaned things up * Fix icon conflict * Update cards.dm * Improper tweaks * Update cards.dm * Axing the popup from the toy version entirely, that was a little jank * Meta remap was merged * Huh. \improper was the issue. * Update cards.dm * Few changes and a fix * More changes * Update cards.dm * Update cards.dm * Update cards.dm * Merge branch 'master' into go-fish * Update cards.dm
This commit is contained in:
@@ -154,7 +154,7 @@
|
||||
/obj/item/storage/box/syndie_kit/space = 2,
|
||||
/obj/item/multitool/ai_detect = 2,
|
||||
/obj/item/implanter/storage = 1,
|
||||
/obj/item/toy/cards/deck/syndicate = 2,
|
||||
/obj/item/deck/cards/syndicate = 2,
|
||||
/obj/item/storage/secure/briefcase/syndie = 2,
|
||||
/obj/item/storage/fancy/cigarettes/cigpack_syndicate = 2,
|
||||
/obj/item/storage/pill_bottle/fakedeath = 2,
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
result = list(/datum/nothing = 13,
|
||||
/obj/item/storage/toolbox/syndicate = 1,
|
||||
/obj/item/storage/fancy/cigarettes/cigpack_syndicate = 1,
|
||||
/obj/item/toy/cards/deck/syndicate = 1,
|
||||
/obj/item/deck/cards/syndicate = 1,
|
||||
/obj/item/storage/secure/briefcase/syndie = 1,
|
||||
/obj/item/toy/syndicateballoon = 1,
|
||||
/obj/item/soap/syndie = 1,
|
||||
|
||||
@@ -310,373 +310,6 @@
|
||||
new /obj/item/toy/snappop/phoenix(get_turf(src))
|
||||
qdel(src)
|
||||
|
||||
/*
|
||||
|| A Deck of Cards for playing various games of chance ||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/obj/item/toy/cards
|
||||
resistance_flags = FLAMMABLE
|
||||
max_integrity = 50
|
||||
var/parentdeck = null
|
||||
var/deckstyle = "nanotrasen"
|
||||
var/card_hitsound = null
|
||||
var/card_force = 0
|
||||
var/card_throwforce = 0
|
||||
var/card_throw_speed = 4
|
||||
var/card_throw_range = 20
|
||||
var/list/card_attack_verb = list("attacked")
|
||||
|
||||
/obj/item/toy/cards/New()
|
||||
..()
|
||||
|
||||
/obj/item/toy/cards/proc/apply_card_vars(obj/item/toy/cards/newobj, obj/item/toy/cards/sourceobj) // Applies variables for supporting multiple types of card deck
|
||||
if(!istype(sourceobj))
|
||||
return
|
||||
|
||||
/obj/item/toy/cards/deck
|
||||
name = "deck of cards"
|
||||
desc = "A deck of space-grade playing cards."
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
deckstyle = "nanotrasen"
|
||||
icon_state = "deck_nanotrasen_full"
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
var/cooldown = 0
|
||||
var/list/cards = list()
|
||||
|
||||
/obj/item/toy/cards/deck/New()
|
||||
..()
|
||||
icon_state = "deck_[deckstyle]_full"
|
||||
for(var/i in 2 to 10)
|
||||
cards += "[i] of Hearts"
|
||||
cards += "[i] of Spades"
|
||||
cards += "[i] of Clubs"
|
||||
cards += "[i] of Diamonds"
|
||||
cards += "King of Hearts"
|
||||
cards += "King of Spades"
|
||||
cards += "King of Clubs"
|
||||
cards += "King of Diamonds"
|
||||
cards += "Queen of Hearts"
|
||||
cards += "Queen of Spades"
|
||||
cards += "Queen of Clubs"
|
||||
cards += "Queen of Diamonds"
|
||||
cards += "Jack of Hearts"
|
||||
cards += "Jack of Spades"
|
||||
cards += "Jack of Clubs"
|
||||
cards += "Jack of Diamonds"
|
||||
cards += "Ace of Hearts"
|
||||
cards += "Ace of Spades"
|
||||
cards += "Ace of Clubs"
|
||||
cards += "Ace of Diamonds"
|
||||
|
||||
/obj/item/toy/cards/deck/attack_hand(mob/user as mob)
|
||||
var/choice = null
|
||||
if(cards.len == 0)
|
||||
icon_state = "deck_[deckstyle]_empty"
|
||||
to_chat(user, "<span class='notice'>There are no more cards to draw.</span>")
|
||||
return
|
||||
var/obj/item/toy/cards/singlecard/H = new/obj/item/toy/cards/singlecard(user.loc)
|
||||
choice = cards[1]
|
||||
H.cardname = choice
|
||||
H.parentdeck = src
|
||||
var/O = src
|
||||
H.apply_card_vars(H,O)
|
||||
cards -= choice
|
||||
H.pickup(user)
|
||||
user.put_in_active_hand(H)
|
||||
visible_message("<span class='notice'>[user] draws a card from the deck.</span>", "<span class='notice'>You draw a card from the deck.</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/cards/deck/attack_self(mob/user as mob)
|
||||
if(cooldown < world.time - 50)
|
||||
cards = shuffle(cards)
|
||||
playsound(user, 'sound/items/cardshuffle.ogg', 50, 1)
|
||||
user.visible_message("<span class='notice'>[user] shuffles the deck.</span>", "<span class='notice'>You shuffle the deck.</span>")
|
||||
cooldown = world.time
|
||||
|
||||
/obj/item/toy/cards/deck/attackby(obj/item/toy/cards/singlecard/C, mob/living/user, params)
|
||||
..()
|
||||
if(istype(C))
|
||||
if(C.parentdeck == src)
|
||||
if(!user.unEquip(C))
|
||||
to_chat(user, "<span class='notice'>The card is stuck to your hand, you can't add it to the deck!</span>")
|
||||
return
|
||||
cards += C.cardname
|
||||
user.visible_message("<span class='notice'>[user] adds a card to the bottom of the deck.</span>","<span class='notice'>You add the card to the bottom of the deck.</span>")
|
||||
qdel(C)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You can't mix cards from other decks.</span>")
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/toy/cards/deck/attackby(obj/item/toy/cards/cardhand/C, mob/living/user, params)
|
||||
..()
|
||||
if(istype(C))
|
||||
if(C.parentdeck == src)
|
||||
if(!user.unEquip(C))
|
||||
to_chat(user, "<span class='notice'>The hand of cards is stuck to your hand, you can't add it to the deck!</span>")
|
||||
return
|
||||
cards += C.currenthand
|
||||
user.visible_message("<span class='notice'>[user] puts [user.p_their()] hand of cards in the deck.</span>", "<span class='notice'>You put the hand of cards in the deck.</span>")
|
||||
qdel(C)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You can't mix cards from other decks.</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/cards/deck/MouseDrop(atom/over_object)
|
||||
var/mob/M = usr
|
||||
if(usr.stat || !ishuman(usr) || !usr.canmove || usr.restrained())
|
||||
return
|
||||
if(Adjacent(usr))
|
||||
if(over_object == M && loc != M)
|
||||
M.put_in_hands(src)
|
||||
to_chat(usr, "<span class='notice'>You pick up the deck.</span>")
|
||||
|
||||
else if(istype(over_object, /obj/screen))
|
||||
switch(over_object.name)
|
||||
if("l_hand")
|
||||
if(!remove_item_from_storage(M))
|
||||
M.unEquip(src)
|
||||
M.put_in_l_hand(src)
|
||||
to_chat(usr, "<span class='notice'>You pick up the deck.</span>")
|
||||
if("r_hand")
|
||||
if(!remove_item_from_storage(M))
|
||||
M.unEquip(src)
|
||||
M.put_in_r_hand(src)
|
||||
to_chat(usr, "<span class='notice'>You pick up the deck.</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>You can't reach it from here.</span>")
|
||||
|
||||
/obj/item/toy/cards/deck/update_icon()
|
||||
switch(cards.len)
|
||||
if(0)
|
||||
icon_state = "deck_[deckstyle]_empty"
|
||||
if(1 to 10)
|
||||
icon_state = "deck_[deckstyle]_low"
|
||||
if(11 to 26)
|
||||
icon_state = "deck_[deckstyle]_half"
|
||||
else
|
||||
icon_state = "deck_[deckstyle]_full"
|
||||
|
||||
/obj/item/toy/cards/cardhand
|
||||
name = "hand of cards"
|
||||
desc = "A number of cards not in a deck, customarily held in ones hand."
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
icon_state = "nanotrasen_hand2"
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
var/list/currenthand = list()
|
||||
var/choice = null
|
||||
|
||||
|
||||
/obj/item/toy/cards/cardhand/attack_self(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
|
||||
/obj/item/toy/cards/cardhand/interact(mob/user)
|
||||
var/dat = "You have:<BR>"
|
||||
for(var/t in currenthand)
|
||||
dat += "<A href='?src=[UID()];pick=[t]'>A [t].</A><BR>"
|
||||
dat += "Which card will you remove next?"
|
||||
var/datum/browser/popup = new(user, "cardhand", "Hand of Cards", 400, 240)
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
|
||||
/obj/item/toy/cards/cardhand/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
if(usr.stat || !ishuman(usr) || !usr.canmove)
|
||||
return
|
||||
var/mob/living/carbon/human/cardUser = usr
|
||||
var/O = src
|
||||
if(href_list["pick"])
|
||||
if(cardUser.get_item_by_slot(slot_l_hand) == src || cardUser.get_item_by_slot(slot_r_hand) == src)
|
||||
var/choice = href_list["pick"]
|
||||
var/obj/item/toy/cards/singlecard/C = new/obj/item/toy/cards/singlecard(cardUser.loc)
|
||||
currenthand -= choice
|
||||
C.parentdeck = src.parentdeck
|
||||
C.cardname = choice
|
||||
C.apply_card_vars(C,O)
|
||||
C.pickup(cardUser)
|
||||
cardUser.put_in_any_hand_if_possible(C)
|
||||
cardUser.visible_message("<span class='notice'>[cardUser] draws a card from [cardUser.p_their()] hand.</span>", "<span class='notice'>You take the [C.cardname] from your hand.</span>")
|
||||
|
||||
interact(cardUser)
|
||||
update_icon()
|
||||
if(currenthand.len == 1)
|
||||
var/obj/item/toy/cards/singlecard/N = new/obj/item/toy/cards/singlecard(src.loc)
|
||||
N.parentdeck = src.parentdeck
|
||||
N.cardname = src.currenthand[1]
|
||||
N.apply_card_vars(N,O)
|
||||
cardUser.unEquip(src)
|
||||
N.pickup(cardUser)
|
||||
cardUser.put_in_any_hand_if_possible(N)
|
||||
to_chat(cardUser, "<span class='notice'>You also take [currenthand[1]] and hold it.</span>")
|
||||
cardUser << browse(null, "window=cardhand")
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/toy/cards/cardhand/attackby(obj/item/toy/cards/singlecard/C, mob/living/user, params)
|
||||
if(istype(C))
|
||||
if(C.parentdeck == parentdeck)
|
||||
currenthand += C.cardname
|
||||
user.unEquip(C)
|
||||
user.visible_message("<span class='notice'>[user] adds a card to [user.p_their()] hand.</span>", "<span class='notice'>You add the [C.cardname] to your hand.</span>")
|
||||
interact(user)
|
||||
update_icon()
|
||||
qdel(C)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You can't mix cards from other decks.</span>")
|
||||
|
||||
/obj/item/toy/cards/cardhand/apply_card_vars(obj/item/toy/cards/newobj,obj/item/toy/cards/sourceobj)
|
||||
..()
|
||||
newobj.deckstyle = sourceobj.deckstyle
|
||||
newobj.icon_state = "[deckstyle]_hand2" // Another dumb hack, without this the hand is invisible (or has the default deckstyle) until another card is added.
|
||||
newobj.card_hitsound = sourceobj.card_hitsound
|
||||
newobj.card_force = sourceobj.card_force
|
||||
newobj.card_throwforce = sourceobj.card_throwforce
|
||||
newobj.card_throw_speed = sourceobj.card_throw_speed
|
||||
newobj.card_throw_range = sourceobj.card_throw_range
|
||||
newobj.card_attack_verb = sourceobj.card_attack_verb
|
||||
newobj.resistance_flags = sourceobj.resistance_flags
|
||||
|
||||
|
||||
/obj/item/toy/cards/singlecard
|
||||
name = "card"
|
||||
desc = "a card"
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
icon_state = "singlecard_nanotrasen_down"
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
var/cardname = null
|
||||
var/flipped = 0
|
||||
pixel_x = -5
|
||||
|
||||
|
||||
/obj/item/toy/cards/singlecard/examine(mob/user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 0)
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/cardUser = user
|
||||
if(cardUser.get_item_by_slot(slot_l_hand) == src || cardUser.get_item_by_slot(slot_r_hand) == src)
|
||||
cardUser.visible_message("<span class='notice'>[cardUser] checks [cardUser.p_their()] card.</span>", "<span class='notice'>The card reads: [src.cardname]</span>")
|
||||
else
|
||||
. += "<span class='notice'>You need to have the card in your hand to check it.</span>"
|
||||
|
||||
|
||||
/obj/item/toy/cards/singlecard/verb/Flip()
|
||||
set name = "Flip Card"
|
||||
set category = "Object"
|
||||
set src in range(1)
|
||||
if(usr.stat || !ishuman(usr) || !usr.canmove || usr.restrained())
|
||||
return
|
||||
if(!flipped)
|
||||
flipped = 1
|
||||
if(cardname)
|
||||
icon_state = "sc_[cardname]_[deckstyle]"
|
||||
name = cardname
|
||||
else
|
||||
icon_state = "sc_Ace of Spades_[deckstyle]"
|
||||
name = "What Card"
|
||||
pixel_x = 5
|
||||
else
|
||||
flipped = 0
|
||||
icon_state = "singlecard_down_[deckstyle]"
|
||||
name = "card"
|
||||
pixel_x = -5
|
||||
|
||||
/obj/item/toy/cards/singlecard/attackby(obj/item/I, mob/living/user, params)
|
||||
if(istype(I, /obj/item/toy/cards/singlecard/))
|
||||
var/obj/item/toy/cards/singlecard/C = I
|
||||
if(C.parentdeck == parentdeck)
|
||||
var/obj/item/toy/cards/cardhand/H = new/obj/item/toy/cards/cardhand(user.loc)
|
||||
H.currenthand += C.cardname
|
||||
H.currenthand += cardname
|
||||
H.parentdeck = C.parentdeck
|
||||
H.apply_card_vars(H,C)
|
||||
user.unEquip(C)
|
||||
H.pickup(user)
|
||||
user.put_in_active_hand(H)
|
||||
to_chat(user, "<span class='notice'>You combine the [C.cardname] and the [cardname] into a hand.</span>")
|
||||
qdel(C)
|
||||
qdel(src)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You can't mix cards from other decks.</span>")
|
||||
|
||||
if(istype(I, /obj/item/toy/cards/cardhand/))
|
||||
var/obj/item/toy/cards/cardhand/H = I
|
||||
if(H.parentdeck == parentdeck)
|
||||
H.currenthand += cardname
|
||||
user.unEquip(src)
|
||||
user.visible_message("<span class='notice'>[user] adds a card to [user.p_their()] hand.</span>", "<span class='notice'>You add the [cardname] to your hand.</span>")
|
||||
H.interact(user)
|
||||
H.update_icon()
|
||||
qdel(src)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You can't mix cards from other decks.</span>")
|
||||
|
||||
/obj/item/toy/cards/cardhand/update_icon()
|
||||
switch(currenthand.len)
|
||||
if(0 to 1)
|
||||
return
|
||||
if(2)
|
||||
icon_state = "[deckstyle]_hand2"
|
||||
if(3)
|
||||
icon_state = "[deckstyle]_hand3"
|
||||
if(4)
|
||||
icon_state = "[deckstyle]_hand4"
|
||||
else
|
||||
icon_state = "[deckstyle]_hand5"
|
||||
|
||||
|
||||
/obj/item/toy/cards/singlecard/attack_self(mob/user)
|
||||
if(usr.stat || !ishuman(usr) || !usr.canmove || usr.restrained())
|
||||
return
|
||||
Flip()
|
||||
|
||||
/obj/item/toy/cards/singlecard/apply_card_vars(obj/item/toy/cards/singlecard/newobj,obj/item/toy/cards/sourceobj)
|
||||
..()
|
||||
newobj.deckstyle = sourceobj.deckstyle
|
||||
newobj.icon_state = "singlecard_down_[deckstyle]" // Without this the card is invisible until flipped. It's an ugly hack, but it works.
|
||||
newobj.card_hitsound = sourceobj.card_hitsound
|
||||
newobj.hitsound = newobj.card_hitsound
|
||||
newobj.card_force = sourceobj.card_force
|
||||
newobj.force = newobj.card_force
|
||||
newobj.card_throwforce = sourceobj.card_throwforce
|
||||
newobj.throwforce = newobj.card_throwforce
|
||||
newobj.card_throw_speed = sourceobj.card_throw_speed
|
||||
newobj.throw_speed = newobj.card_throw_speed
|
||||
newobj.card_throw_range = sourceobj.card_throw_range
|
||||
newobj.throw_range = newobj.card_throw_range
|
||||
newobj.card_attack_verb = sourceobj.card_attack_verb
|
||||
newobj.attack_verb = newobj.card_attack_verb
|
||||
|
||||
|
||||
/*
|
||||
|| Syndicate playing cards, for pretending you're Gambit and playing poker for the nuke disk. ||
|
||||
*/
|
||||
|
||||
/obj/item/toy/cards/deck/syndicate
|
||||
name = "suspicious looking deck of cards"
|
||||
desc = "A deck of space-grade playing cards. They seem unusually rigid."
|
||||
deckstyle = "syndicate"
|
||||
card_hitsound = 'sound/weapons/bladeslice.ogg'
|
||||
card_force = 5
|
||||
card_throwforce = 10
|
||||
card_throw_speed = 3
|
||||
card_throw_range = 20
|
||||
card_attack_verb = list("attacked", "sliced", "diced", "slashed", "cut")
|
||||
resistance_flags = NONE
|
||||
|
||||
/*
|
||||
|| Custom card decks ||
|
||||
*/
|
||||
/obj/item/toy/cards/deck/black
|
||||
deckstyle = "black"
|
||||
|
||||
/obj/item/toy/cards/deck/syndicate/black
|
||||
deckstyle = "black"
|
||||
|
||||
/obj/item/toy/nuke
|
||||
name = "\improper Nuclear Fission Explosive toy"
|
||||
|
||||
@@ -89,6 +89,8 @@
|
||||
/obj/random/carp_plushie,
|
||||
/obj/random/plushie,
|
||||
/obj/random/figure,
|
||||
/obj/item/deck/cards,
|
||||
/obj/item/deck/cards/tiny,
|
||||
/obj/item/toy/minimeteor,
|
||||
/obj/item/toy/redbutton,
|
||||
/obj/item/toy/figure/owl,
|
||||
@@ -104,7 +106,6 @@
|
||||
/obj/item/toy/flash,
|
||||
/obj/item/toy/minigibber,
|
||||
/obj/item/toy/nuke,
|
||||
/obj/item/toy/cards/deck,
|
||||
/obj/item/toy/AI,
|
||||
/obj/item/clothing/under/syndicate/tacticool,
|
||||
/obj/item/storage/box/fakesyndiesuit,
|
||||
|
||||
Reference in New Issue
Block a user