mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Merge pull request #4955 from Unfit/contraband
Adds wizard collectible cards
This commit is contained in:
@@ -258,7 +258,8 @@ var/list/all_supply_groups = list("Supplies","Clothing","Security","Hospitality"
|
||||
contains = list(/obj/item/seeds/bloodtomatoseed,
|
||||
/obj/item/weapon/storage/pill_bottle/zoom,
|
||||
/obj/item/weapon/storage/pill_bottle/happy,
|
||||
/obj/item/weapon/reagent_containers/food/drinks/bottle/absinthe)
|
||||
/obj/item/weapon/reagent_containers/food/drinks/bottle/absinthe,
|
||||
/obj/item/weapon/storage/bag/wiz_cards/frog)
|
||||
|
||||
name = "Contraband crate"
|
||||
cost = 30
|
||||
|
||||
@@ -1167,7 +1167,8 @@
|
||||
/obj/item/clothing/suit/wizrobe/clown = 1,
|
||||
/obj/item/clothing/mask/gas/clown_hat/wiz = 1,
|
||||
/obj/item/clothing/shoes/sandal = 1,
|
||||
/obj/item/weapon/staff = 2)
|
||||
/obj/item/weapon/staff = 2,
|
||||
/obj/item/weapon/storage/bag/wiz_cards/full = 1)
|
||||
contraband = list(/obj/item/weapon/reagent_containers/glass/bottle/wizarditis = 1) //No one can get to the machine to hack it anyways; for the lulz - Microwave
|
||||
|
||||
pack = /obj/structure/vendomatpack/magivend //Who's laughing now? - Deity Link
|
||||
|
||||
@@ -622,271 +622,6 @@
|
||||
w_class = 3
|
||||
attack_verb = list("attacked", "slashed", "stabbed", "sliced")
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Taken from /tg/
|
||||
*/
|
||||
/obj/item/toy/cards
|
||||
name = "deck of cards"
|
||||
desc = "A deck of space-grade playing cards."
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
icon_state = "deck_full"
|
||||
|
||||
var/list/cards = list()
|
||||
|
||||
/obj/item/toy/cards/New()
|
||||
..()
|
||||
for(var/i = 2; i <= 10; i++)
|
||||
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/attack_hand(mob/user as mob)
|
||||
var/choice = null
|
||||
if(!cards.len)
|
||||
src.icon_state = "deck_empty"
|
||||
user << "<span class = 'notice'>There are no more cards to draw.</span>"
|
||||
return
|
||||
var/obj/item/toy/singlecard/H = new/obj/item/toy/singlecard(user.loc)
|
||||
choice = cards[1]
|
||||
H.cardname = choice
|
||||
H.parentdeck = src
|
||||
src.cards -= choice
|
||||
H.pickup(user)
|
||||
user.put_in_active_hand(H)
|
||||
src.visible_message("<span class = 'notice'>[user] draws a card from the deck.</span>",
|
||||
"<span class = 'notice'>You draw a card from the deck.")
|
||||
if(cards.len > 26)
|
||||
src.icon_state = "deck_full"
|
||||
else if(cards.len > 10)
|
||||
src.icon_state = "deck_half"
|
||||
else if(cards.len > 1)
|
||||
src.icon_state = "deck_low"
|
||||
|
||||
/obj/item/toy/cards/attack_self(mob/user as mob)
|
||||
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>")
|
||||
|
||||
/obj/item/toy/cards/attackby(obj/item/toy/singlecard/C, mob/living/user)
|
||||
..()
|
||||
if(istype(C))
|
||||
if(C.parentdeck == src)
|
||||
src.cards += C.cardname
|
||||
user.u_equip(C,0)
|
||||
user.visible_message("<span class = 'notice'>[user] adds a card to the bottom of the deck.</span>",
|
||||
"You add the card to the bottom of the deck.</span>")
|
||||
qdel(C)
|
||||
else
|
||||
user << "<span class = 'warning'>You can't mix cards from other decks.</span>"
|
||||
if(cards.len > 26)
|
||||
src.icon_state = "deck_full"
|
||||
else if(cards.len > 10)
|
||||
src.icon_state = "deck_half"
|
||||
else if(cards.len > 1)
|
||||
src.icon_state = "deck_low"
|
||||
|
||||
/obj/item/toy/cards/attackby(obj/item/toy/cardhand/C, mob/living/user)
|
||||
..()
|
||||
if(istype(C))
|
||||
if(C.parentdeck == src)
|
||||
src.cards += C.currenthand
|
||||
user.u_equip(C,0)
|
||||
user.visible_message("<span class = 'notice'>[user] puts their hand of cards into the deck.</span>",
|
||||
"<span class = 'notice'>You put the hand into the deck.</span>")
|
||||
qdel(C)
|
||||
else
|
||||
user << "<span class = 'warning'>You can't mix cards from other decks.</span>"
|
||||
if(cards.len > 26)
|
||||
src.icon_state = "deck_full"
|
||||
else if(cards.len > 10)
|
||||
src.icon_state = "deck_half"
|
||||
else if(cards.len > 1)
|
||||
src.icon_state = "deck_low"
|
||||
|
||||
/obj/item/toy/cards/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)
|
||||
M.put_in_hands(src)
|
||||
usr << "<span class = 'notice'>You pick up the deck.</span>"
|
||||
else if(istype(over_object, /obj/screen))
|
||||
switch(over_object.name)
|
||||
if("r_hand")
|
||||
M.u_equip(src, 0)
|
||||
M.put_in_r_hand(src)
|
||||
usr << "<span class = 'notice'>You pick up the deck.</span>"
|
||||
if("l_hand")
|
||||
M.u_equip(src, 0)
|
||||
M.put_in_l_hand(src)
|
||||
usr << "<span class = 'notice'>You pick up the deck.</span>"
|
||||
else
|
||||
usr << "<span class = 'warning'>You can't reach it from here.</span>"
|
||||
|
||||
/obj/item/toy/cardhand
|
||||
name = "hand of cards"
|
||||
desc = "A nmber of cards not in a deck, customarily held in ones hand."
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
icon_state = "hand2"
|
||||
var/list/currenthand = list()
|
||||
var/obj/item/toy/cards/parentdeck = null
|
||||
var/choice = null
|
||||
|
||||
/obj/item/toy/cardhand/attack_self(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
|
||||
/obj/item/toy/cardhand/interact(mob/user)
|
||||
var/dat = "You have: <br>"
|
||||
for(var/t in currenthand)
|
||||
dat += "<a href = '?src=\ref[src];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/cardhand/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
if(usr.stat || !ishuman(usr) || !usr.canmove)
|
||||
return
|
||||
var/mob/living/carbon/cardUser = usr
|
||||
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/singlecard/C = new/obj/item/toy/singlecard(cardUser.loc)
|
||||
src.currenthand -= choice
|
||||
C.parentdeck = src.parentdeck
|
||||
C.cardname = choice
|
||||
C.pickup(cardUser)
|
||||
cardUser.put_in_any_hand_if_possible(C)
|
||||
cardUser.visible_message("<span class = 'notice'>[cardUser] draws a card from \his hand.<span>",
|
||||
"<span class = 'notice'>You take the [C.cardname] from your hand.</span>")
|
||||
interact(cardUser)
|
||||
|
||||
if(src.currenthand.len < 3)
|
||||
src.icon_state = "hand2"
|
||||
else if(src.currenthand.len < 4)
|
||||
src.icon_state = "hand3"
|
||||
else if(src.currenthand.len < 5)
|
||||
src.icon_state = "hand4"
|
||||
|
||||
if(src.currenthand.len == 1)
|
||||
var/obj/item/toy/singlecard/N = new/obj/item/toy/singlecard(src.loc)
|
||||
N.parentdeck = src.parentdeck
|
||||
N.cardname = src.currenthand[1]
|
||||
cardUser.u_equip(src,0)
|
||||
N.pickup(cardUser)
|
||||
cardUser.put_in_any_hand_if_possible(N)
|
||||
cardUser << "<span class = 'notice'>You also take [currenthand[1]] and hold it.</span>"
|
||||
cardUser << browse(null, "window=cardhand")
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/toy/cardhand/attackby(obj/item/toy/singlecard/C, mob/living/user)
|
||||
if(istype(C))
|
||||
if(C.parentdeck == src.parentdeck)
|
||||
src.currenthand += C.cardname
|
||||
user.u_equip(C, 0)
|
||||
user.visible_message("<span class = 'notice'>[user] adds a card to their hand.</span>",
|
||||
"<span class = 'notice'>You add the [C.cardname] to your hand.</span>")
|
||||
interact(user)
|
||||
if(currenthand.len > 4)
|
||||
src.icon_state = "hand5"
|
||||
if(currenthand.len > 3)
|
||||
src.icon_state = "hand4"
|
||||
if(currenthand.len > 2)
|
||||
src.icon_state = "hand3"
|
||||
qdel(C)
|
||||
else
|
||||
user << "span class = 'warning'> You can't mix cards from other decks.</span>"
|
||||
|
||||
|
||||
/obj/item/toy/singlecard
|
||||
name = "card"
|
||||
desc = "\a card"
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
icon_state = "singlecard_down"
|
||||
var/cardname = null
|
||||
var/obj/item/toy/cards/parentdeck = null
|
||||
var/flipped = 0
|
||||
pixel_x = -5
|
||||
|
||||
/obj/item/toy/singlecard/examine(mob/user)
|
||||
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 \his card.",
|
||||
"<span class = 'notice'>The card reads: [src.cardname]</span>")
|
||||
else
|
||||
cardUser << "<span class = 'notice'>You need to have the card in your hand to check it.</span>"
|
||||
|
||||
/obj/item/toy/singlecard/verb/Flip()
|
||||
set name = "Flip Card"
|
||||
set category = "Object"
|
||||
set src in range(1)
|
||||
if(usr.stat || !ishuman(usr) || !usr.canmove || usr.restrained() || (usr.status_flags & FAKEDEATH))
|
||||
return
|
||||
if(!flipped)
|
||||
src.flipped = 1
|
||||
if(cardname)
|
||||
src.icon_state = "sc_[cardname]"
|
||||
src.name = src.cardname
|
||||
else
|
||||
src.icon_state = "sc_Ace of Spades"
|
||||
src.name = "What Card"
|
||||
src.pixel_x = 5
|
||||
else if(flipped)
|
||||
src.flipped = 0
|
||||
src.icon_state = "singlecard_down"
|
||||
src.name = "card"
|
||||
src.pixel_x = -5
|
||||
|
||||
/obj/item/toy/singlecard/attackby(obj/item/I, mob/living/user)
|
||||
if(istype(I, /obj/item/toy/singlecard/))
|
||||
var/obj/item/toy/singlecard/C = I
|
||||
if(C.parentdeck == src.parentdeck)
|
||||
var/obj/item/toy/cardhand/H = new/obj/item/toy/cardhand(user.loc)
|
||||
H.currenthand += C.cardname
|
||||
H.currenthand += src.cardname
|
||||
H.parentdeck = C.parentdeck
|
||||
user.u_equip(C,0)
|
||||
H.pickup(user)
|
||||
user.put_in_active_hand(H)
|
||||
user << "<span class = 'notice'>You combine the [C.cardname] and the [src.cardname] into a hand.</span>"
|
||||
qdel(C)
|
||||
qdel(src)
|
||||
else
|
||||
user << "<span class = 'notice'>You can't mix cards from other decks.</span>"
|
||||
|
||||
/obj/item/toy/singlecard/attack_self(mob/user)
|
||||
if(usr.stat || !ishuman(usr) || !usr.canmove || usr.restrained())
|
||||
return
|
||||
Flip()
|
||||
|
||||
/*
|
||||
* OMG THEIF
|
||||
*/
|
||||
|
||||
@@ -115,12 +115,12 @@
|
||||
max_w_class = 3
|
||||
w_class = 3
|
||||
can_hold = list("/obj/item/weapon/reagent_containers/food/snacks")
|
||||
|
||||
|
||||
/obj/item/weapon/storage/bag/food/update_icon()
|
||||
if(contents.len < 1)
|
||||
icon_state = "foodbag0"
|
||||
else icon_state = "foodbag1"
|
||||
|
||||
|
||||
// -----------------------------
|
||||
// Pill Collector
|
||||
// -----------------------------
|
||||
@@ -136,7 +136,6 @@
|
||||
w_class = 1
|
||||
can_hold = list("/obj/item/weapon/reagent_containers/glass/bottle","/obj/item/weapon/reagent_containers/pill","/obj/item/weapon/reagent_containers/syringe")
|
||||
|
||||
|
||||
// -----------------------------
|
||||
// Sheet Snatcher
|
||||
// -----------------------------
|
||||
|
||||
291
code/modules/games/cards/playing_cards.dm
Normal file
291
code/modules/games/cards/playing_cards.dm
Normal file
@@ -0,0 +1,291 @@
|
||||
#define CARD_DISPLACE 9
|
||||
#define CARD_WIDTH 7 //width of the icon
|
||||
|
||||
/*
|
||||
* Taken from /tg/
|
||||
*/
|
||||
|
||||
/datum/context_click/cardhand/return_clicked_id(x_pos, y_pos)
|
||||
var/obj/item/toy/cardhand/hand = holder
|
||||
|
||||
var/card_distance = CARD_DISPLACE - hand.currenthand.len //how far apart each card is
|
||||
var/starting_card_x = hand.currenthand.len * (CARD_DISPLACE - hand.currenthand.len) - CARD_DISPLACE
|
||||
|
||||
if(x_pos < starting_card_x + CARD_WIDTH)
|
||||
return 1
|
||||
else
|
||||
return round( ( x_pos - (starting_card_x + CARD_WIDTH) ) / card_distance ) + 2 //+2, because we floor, and because we skipped the first card
|
||||
|
||||
/datum/context_click/cardhand/action(obj/item/used_item, mob/user, params)
|
||||
var/obj/item/toy/cardhand/hand = holder
|
||||
if(!used_item)
|
||||
var/index = Clamp(return_clicked_id_by_params(params), 1, hand.currenthand.len)
|
||||
var/obj/item/toy/singlecard/card = hand.currenthand[index]
|
||||
hand.currenthand.Remove(card)
|
||||
user.put_in_hands(card)
|
||||
hand.update_icon()
|
||||
else if(istype(used_item, /obj/item/toy/singlecard))
|
||||
var/index = Clamp(return_clicked_id_by_params(params), 1, hand.currenthand.len)
|
||||
hand.currenthand.Insert(index, used_item) //we put it where we specified
|
||||
hand.update_icon()
|
||||
|
||||
|
||||
|
||||
/obj/item/toy/cards
|
||||
name = "deck of cards"
|
||||
desc = "A deck of space-grade playing cards."
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
icon_state = "deck_full"
|
||||
|
||||
var/list/cards = list() //list of the singlecard items we carry
|
||||
var/strict_deck = 1 //if we only accept cards that came from us
|
||||
|
||||
/obj/item/toy/cards/New()
|
||||
..()
|
||||
generate_cards()
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/cards/proc/generate_cards()
|
||||
for(var/i = 2; i <= 10; i++)
|
||||
cards += new/obj/item/toy/singlecard(src, src, "[i] of Hearts")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "[i] of Spades")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "[i] of Clubs")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "[i] of Diamonds")
|
||||
|
||||
cards += new/obj/item/toy/singlecard(src, src, "King of Hearts")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "King of Spades")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "King of Clubs")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "King of Diamonds")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Queen of Hearts")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Queen of Spades")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Queen of Clubs")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Queen of Diamonds")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Jack of Hearts")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Jack of Spades")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Jack of Clubs")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Jack of Diamonds")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Ace of Hearts")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Ace of Spades")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Ace of Clubs")
|
||||
cards += new/obj/item/toy/singlecard(src, src, "Ace of Diamonds")
|
||||
|
||||
/obj/item/toy/cards/attack_hand(mob/user as mob)
|
||||
var/choice = null
|
||||
if(!cards.len)
|
||||
src.icon_state = "deck_empty"
|
||||
user << "<span class = 'notice'>There are no more cards to draw.</span>"
|
||||
return
|
||||
choice = cards[1]
|
||||
src.cards -= choice
|
||||
user.put_in_active_hand(choice)
|
||||
src.visible_message("<span class = 'notice'>[user] draws a card from the deck.</span>",
|
||||
"<span class = 'notice'>You draw a card from the deck.")
|
||||
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/cards/attack_self(mob/user as mob)
|
||||
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>")
|
||||
|
||||
/obj/item/toy/cards/attackby(obj/item/I, mob/living/user)
|
||||
..()
|
||||
if(istype(I, /obj/item/toy/singlecard))
|
||||
var/obj/item/toy/singlecard/C = I
|
||||
if((!C.parentdeck && !strict_deck) || C.parentdeck == src)
|
||||
src.cards += C
|
||||
user.drop_item(C, src)
|
||||
user.visible_message("<span class = 'notice'>[user] adds a card to the bottom of the deck.</span>",
|
||||
"You add the card to the bottom of the deck.</span>")
|
||||
else
|
||||
user << "<span class = 'warning'>You can't mix cards from other decks.</span>"
|
||||
update_icon()
|
||||
|
||||
if(istype(I, /obj/item/toy/cardhand))
|
||||
var/obj/item/toy/cardhand/C = I
|
||||
if((!C.parentdeck && !strict_deck) || C.parentdeck == src)
|
||||
for(var/obj/item/toy/singlecard/card in C.currenthand)
|
||||
card.loc = src
|
||||
cards += card
|
||||
user.drop_item(C)
|
||||
user.visible_message("<span class = 'notice'>[user] puts their hand of cards into the deck.</span>",
|
||||
"<span class = 'notice'>You put the hand into the deck.</span>")
|
||||
qdel(C)
|
||||
else
|
||||
user << "<span class = 'warning'>You can't mix cards from other decks.</span>"
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/cards/update_icon()
|
||||
if(cards.len > 26)
|
||||
src.icon_state = "deck_full"
|
||||
else if(cards.len > 10)
|
||||
src.icon_state = "deck_half"
|
||||
else if(cards.len > 1)
|
||||
src.icon_state = "deck_low"
|
||||
|
||||
/obj/item/toy/cards/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)
|
||||
M.put_in_hands(src)
|
||||
usr << "<span class = 'notice'>You pick up the deck.</span>"
|
||||
else if(istype(over_object, /obj/screen))
|
||||
switch(over_object.name)
|
||||
if("r_hand")
|
||||
M.u_equip(src, 0)
|
||||
M.put_in_r_hand(src)
|
||||
usr << "<span class = 'notice'>You pick up the deck.</span>"
|
||||
if("l_hand")
|
||||
M.u_equip(src, 0)
|
||||
M.put_in_l_hand(src)
|
||||
usr << "<span class = 'notice'>You pick up the deck.</span>"
|
||||
else
|
||||
usr << "<span class = 'warning'>You can't reach it from here.</span>"
|
||||
|
||||
////////////////////////////
|
||||
/////////CARD HANDS/////////
|
||||
////////////////////////////
|
||||
|
||||
/obj/item/toy/cardhand
|
||||
name = "hand of cards"
|
||||
desc = "A nmber of cards not in a deck, customarily held in ones hand."
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
icon_state = "handbase"
|
||||
var/list/currenthand = list()
|
||||
var/obj/item/toy/cards/parentdeck = null
|
||||
var/max_hand_size = 5
|
||||
|
||||
var/datum/context_click/cardhand/hand_click
|
||||
|
||||
/obj/item/toy/cardhand/New()
|
||||
..()
|
||||
hand_click = new(src)
|
||||
|
||||
/obj/item/toy/cardhand/examine(mob/user)
|
||||
..()
|
||||
var/name_list = list()
|
||||
for(var/obj/item/toy/singlecard/card in currenthand)
|
||||
name_list += card.name //we don't use cardname because they might be flipped
|
||||
user.show_message("It holds [english_list(name_list)]", 1)
|
||||
|
||||
/obj/item/toy/cardhand/attackby(obj/item/toy/singlecard/C, mob/living/user, params)
|
||||
if(istype(C))
|
||||
if(!(C.parentdeck || src.parentdeck) || C.parentdeck == src.parentdeck)
|
||||
if(currenthand.len >= max_hand_size)
|
||||
user << "<span class = 'warning'> You can't add any more cards to this hand.</span>"
|
||||
return
|
||||
hand_click.action(C, user, params)
|
||||
user.drop_item(C, src)
|
||||
user.visible_message("<span class = 'notice'>[user] adds a card to their hand.</span>",
|
||||
"<span class = 'notice'>You add the [C.cardname] to your hand.</span>")
|
||||
update_icon()
|
||||
else
|
||||
user << "<span class = 'warning'> You can't mix cards from other decks.</span>"
|
||||
return 1
|
||||
if(istype(C, /obj/item/toy/cards)) //shuffle us in
|
||||
return C.attackby(src, user)
|
||||
return ..()
|
||||
|
||||
/obj/item/toy/cardhand/attack_self(mob/user)
|
||||
for(var/obj/item/toy/singlecard/card in currenthand)
|
||||
card.Flip()
|
||||
update_icon()
|
||||
return ..()
|
||||
|
||||
/obj/item/toy/cardhand/attack_hand(mob/user, params)
|
||||
if(user.get_inactive_hand() == src)
|
||||
return hand_click.action(null, user, params)
|
||||
return ..()
|
||||
|
||||
/obj/item/toy/cardhand/update_icon()
|
||||
overlays.len = 0
|
||||
for(var/i = currenthand.len; i >= 1; i--)
|
||||
var/obj/item/toy/singlecard/card = currenthand[i]
|
||||
if(card)
|
||||
card.layer = FLOAT_LAYER
|
||||
card.pixel_x = i * (CARD_DISPLACE - currenthand.len) - CARD_DISPLACE
|
||||
overlays += card
|
||||
|
||||
/*
|
||||
/obj/item/toy/cardhand/pickup(mob/user)
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/cardhand/dropped(mob/user)
|
||||
update_icon()
|
||||
*/
|
||||
|
||||
///////////////////////////
|
||||
/////////CARD ITEMS////////
|
||||
///////////////////////////
|
||||
|
||||
/obj/item/toy/singlecard
|
||||
name = "card"
|
||||
desc = "\a card"
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
icon_state = "singlecard_down"
|
||||
var/cardname = null
|
||||
var/obj/item/toy/cards/parentdeck = null
|
||||
var/flipped = 0
|
||||
pixel_x = -5
|
||||
|
||||
/obj/item/toy/singlecard/New(NewLoc, cardsource, newcardname)
|
||||
..(NewLoc)
|
||||
if(cardsource)
|
||||
parentdeck = cardsource
|
||||
if(newcardname)
|
||||
cardname = newcardname
|
||||
name = cardname
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/singlecard/update_icon()
|
||||
if(flipped)
|
||||
icon_state = "singlecard_down"
|
||||
pixel_x = -5
|
||||
name = "card"
|
||||
else
|
||||
if(cardname)
|
||||
src.icon_state = "sc_[cardname]"
|
||||
src.name = src.cardname
|
||||
else
|
||||
src.icon_state = "sc_Ace of Spades"
|
||||
src.name = "What Card"
|
||||
src.pixel_x = 5
|
||||
|
||||
/obj/item/toy/singlecard/examine(mob/user)
|
||||
..()
|
||||
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 \his card.",
|
||||
"<span class = 'notice'>The card reads: [src.name]</span>")
|
||||
else
|
||||
cardUser << "<span class = 'notice'>You need to have the card in your hand to check it.</span>"
|
||||
|
||||
/obj/item/toy/singlecard/proc/Flip()
|
||||
flipped = !flipped
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/singlecard/attackby(obj/item/I, mob/living/user)
|
||||
if(istype(I, /obj/item/toy/singlecard))
|
||||
var/obj/item/toy/singlecard/C = I
|
||||
if(!(C.parentdeck || src.parentdeck) || C.parentdeck == src.parentdeck)
|
||||
var/obj/item/toy/cardhand/H = new/obj/item/toy/cardhand(user.loc)
|
||||
H.parentdeck = C.parentdeck
|
||||
user.put_in_active_hand(H)
|
||||
user << "<span class = 'notice'>You combine \the [C] and \the [src] into a hand.</span>"
|
||||
user.drop_item(C, H)
|
||||
user.remove_from_mob(src) //we could be anywhere!
|
||||
src.forceMove(H)
|
||||
H.currenthand += C
|
||||
H.currenthand += src
|
||||
H.update_icon()
|
||||
user.put_in_hands(H)
|
||||
else
|
||||
user << "<span class = 'notice'>You can't mix cards from other decks.</span>"
|
||||
|
||||
/obj/item/toy/singlecard/attack_self(mob/user)
|
||||
Flip()
|
||||
return ..()
|
||||
308
code/modules/games/cards/wizard_cards.dm
Normal file
308
code/modules/games/cards/wizard_cards.dm
Normal file
@@ -0,0 +1,308 @@
|
||||
var/global/list/wizard_cards_rare = list(
|
||||
/obj/item/toy/singlecard/wizard/legendary/honkmother,
|
||||
/obj/item/toy/singlecard/wizard/legendary/singularity,
|
||||
/obj/item/toy/singlecard/wizard/legendary/jew,
|
||||
/obj/item/toy/singlecard/wizard/legendary/narsie,
|
||||
/obj/item/toy/singlecard/wizard/legendary/pomf
|
||||
)
|
||||
|
||||
var/global/list/wizard_cards_normal = list(
|
||||
/obj/item/toy/singlecard/wizard/clown,
|
||||
/obj/item/toy/singlecard/wizard/bomberman,
|
||||
/obj/item/toy/singlecard/wizard/captain,
|
||||
/obj/item/toy/singlecard/wizard/hos,
|
||||
/obj/item/toy/singlecard/wizard/scientist,
|
||||
/obj/item/toy/singlecard/wizard/assistant,
|
||||
/obj/item/toy/singlecard/wizard/secborg,
|
||||
/obj/item/toy/singlecard/wizard/nukeop,
|
||||
/obj/item/toy/singlecard/wizard/engineer,
|
||||
/obj/item/toy/singlecard/wizard/chef,
|
||||
/obj/item/toy/singlecard/wizard/changeling,
|
||||
/obj/item/toy/singlecard/wizard/mime,
|
||||
/obj/item/toy/singlecard/wizard/mommi,
|
||||
/obj/item/toy/singlecard/wizard/AI,
|
||||
/obj/item/toy/singlecard/wizard/vox,
|
||||
/obj/item/toy/singlecard/wizard/doctor,
|
||||
/obj/item/toy/singlecard/wizard/tator,
|
||||
/obj/item/toy/singlecard/wizard/borer,
|
||||
/obj/item/toy/singlecard/wizard/ian
|
||||
)
|
||||
|
||||
#define CARD_PORTRAIT "portrait"
|
||||
#define CARD_FLIP "flip"
|
||||
|
||||
/datum/context_click/wizard_card/return_clicked_id(x_pos, y_pos)
|
||||
if(14 <= x_pos && x_pos <= 19)
|
||||
if(7 <= y_pos && y_pos <= 20)
|
||||
return CARD_PORTRAIT
|
||||
return CARD_FLIP
|
||||
|
||||
/datum/context_click/wizard_card/action(obj/item/used_item, mob/user, params)
|
||||
var/obj/item/toy/singlecard/wizard/card = holder
|
||||
if(!used_item)
|
||||
switch(return_clicked_id_by_params(params))
|
||||
if(CARD_PORTRAIT)
|
||||
return card.special_effect()
|
||||
else
|
||||
return card.Flip()
|
||||
|
||||
|
||||
/obj/item/toy/singlecard/wizard
|
||||
name = "wizard trading card"
|
||||
desc = "A trading card."
|
||||
icon = 'icons/obj/wiz_cards.dmi'
|
||||
icon_state = "card"
|
||||
var/image/char_image
|
||||
var/ability_cd = 0
|
||||
|
||||
var/datum/context_click/wizard_card/card_use
|
||||
|
||||
/obj/item/toy/singlecard/wizard/New()
|
||||
.=..()
|
||||
|
||||
card_use = new(src)
|
||||
|
||||
char_image = image('icons/obj/wiz_cards.dmi',cardname)
|
||||
update_icon()
|
||||
|
||||
/obj/item/toy/singlecard/wizard/update_icon()
|
||||
if(flipped)
|
||||
overlays -= char_image
|
||||
icon_state = "wizcard_down"
|
||||
name = "card"
|
||||
else
|
||||
src.icon_state = initial(icon_state)
|
||||
src.name = initial(src.name)
|
||||
src.overlays += char_image
|
||||
|
||||
/obj/item/toy/singlecard/wizard/attack_self(mob/user, params)
|
||||
return card_use.action(null, user, params)
|
||||
|
||||
/obj/item/toy/singlecard/wizard/proc/special_effect(mob/user)
|
||||
if(!ability_cd)
|
||||
ability_cd = 1
|
||||
spawn(50)
|
||||
ability_cd = 0
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/item/toy/singlecard/wizard/legendary
|
||||
icon_state = "card_legendary"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/legendary/honkmother
|
||||
name = "rare Honkmother wizard card"
|
||||
desc = "Honkmother is a <span class='sinister'>legendary</span> chaos entity. Sweet heavens."
|
||||
icon_state = "card_clown"
|
||||
cardname = "honkmother"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/legendary/honkmother/special_effect(mob/user)
|
||||
if(!..())
|
||||
user << "Honkmother is not ready yet!"
|
||||
return
|
||||
|
||||
playsound(get_turf(src), 'sound/items/AirHorn.ogg', 50, 1)
|
||||
|
||||
/obj/item/toy/singlecard/wizard/legendary/honkmother/pickup(mob/living/user as mob)
|
||||
if(user.mind && user.mind.assigned_role == "Clown")
|
||||
user << "<span class ='notice'>You feel Honkmother's presence as you pick up the card.</span>"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/legendary/singularity
|
||||
name = "rare singularity wizard card"
|
||||
desc = "The singularity is a <span class='sinister'>legendary</span> neutral entity. Gods help you if you fail to contain it."
|
||||
cardname = "singulo"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/legendary/jew
|
||||
name = "rare Agent Aronowicz wizard card"
|
||||
desc = "Agent Aronowicz is a <span class='sinister'>legendary</span> order entity. Never forget the six billion."
|
||||
icon_state = "card_rich"
|
||||
cardname = "jew"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/legendary/narsie
|
||||
name = "rare Nar-Sie wizard card"
|
||||
desc = "Nar-Sie is a <span class='sinister'>legendary</span> destruction entity. It can destroy bluespace itself."
|
||||
icon_state = "card_evil"
|
||||
cardname = "narsie"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/legendary/pomf
|
||||
name = "rare Pomf chicken wizard card"
|
||||
desc = "Pomf chicken is a <span class='sinister'>legendary</span> order entity. Despite holding great power, it is easily intimidated."
|
||||
icon_state = "card_rich"
|
||||
cardname = "chicken"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/clown
|
||||
name = "clown wizard card"
|
||||
desc = "The clown is a strong chaos entity. It's incredibly powerful, but never predictable."
|
||||
cardname = "clown"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/clown/special_effect(mob/user)
|
||||
if(!..())
|
||||
user << "The clown is not ready yet!"
|
||||
return
|
||||
|
||||
playsound(get_turf(src), 'sound/items/bikehorn.ogg', 50, 1)
|
||||
|
||||
/obj/item/toy/singlecard/wizard/bomberman
|
||||
name = "bomberman wizard card"
|
||||
desc = "The bomberman is a strong destruction entity. Nothing can match it in terms of wrecking havoc and carnage, but it is often caught in its own explosions."
|
||||
cardname = "bomberman"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/captain
|
||||
name = "captain wizard card"
|
||||
desc = "The captain is a medium chaos entity. Let the dice decide whether it will be good or bad for you!"
|
||||
cardname = "captain"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/hos
|
||||
name = "HoS wizard card"
|
||||
desc = "The head of security is a medium order entity. It keeps everything under control and in strict order, even when you don't want it to."
|
||||
cardname = "hos"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/scientist
|
||||
name = "scientist wizard card"
|
||||
desc = "The scientist is a medium destruction entity. Give it some time to prepare, and you won't be disappointed."
|
||||
cardname = "scientist"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/assistant
|
||||
name = "assistant wizard card"
|
||||
desc = "The assistant is a weak chaos entity. What side is it even on? Who knows."
|
||||
cardname = "assistant"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/secborg
|
||||
name = "cyborg wizard card"
|
||||
desc = "The cyborg is a weak order entity. While powerful in theory, its asimov lawset often makes it more of a hinderance."
|
||||
cardname = "cyborg"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/nukeop
|
||||
name = "syndicate wizard card"
|
||||
desc = "The syndicate operative is a weak destruction entity. While not really powerful by itself, it is a force to be reckoned with when in large numbers. Explodes on death."
|
||||
cardname = "nukeop"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/engineer
|
||||
name = "engineer wizard card"
|
||||
desc = "The engineer is a weak order entity. It is weak in fights and powercreeped by MoMMIs."
|
||||
cardname = "engineer"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/chef
|
||||
name = "chef wizard card"
|
||||
desc = "The chef is a weak order entity. It has both the ability to be deadly in a fight, and it can keep everybody fed!"
|
||||
cardname = "cook"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/changeling
|
||||
name = "changeling wizard card"
|
||||
desc = "The changeling is a medium destruction entity. It is very hard to get rid of."
|
||||
cardname = "changeling"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/mime
|
||||
name = "mime wizard card"
|
||||
desc = "The mime is a weak chaos entity, and the clown's mortal enemy."
|
||||
cardname = "mime"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/mommi
|
||||
name = "MoMMI wizard card"
|
||||
desc = "The MoMMI is a weak order entity. It can't do anything in fights, but who else can keep an entire space station maintained and powered better than the MoMMI?"
|
||||
cardname = "mommi"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/AI
|
||||
name = "AI wizard card"
|
||||
desc = "The AI is a medium order entity. While useless in fights, it can control the cyborgs and the battlefield's environment."
|
||||
cardname = "ai"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/vox
|
||||
name = "vox wizard card"
|
||||
desc = "The vox is a medium chaos entity. Time to steal the station's engineering department!"
|
||||
cardname = "vox"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/doctor
|
||||
name = "doctor wizard card"
|
||||
desc = "The doctor is a weak order entity. In addition to being robust, the doctor can provide first aid to his injured allies, and even clone the dead ones."
|
||||
cardname = "doc"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/tator
|
||||
name = "traitor wizard card"
|
||||
desc = "The traitor is a weak destruction entity. It grows in power with time, and once it gained enough momentum it is very hard to stop."
|
||||
cardname = "tator"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/borer
|
||||
name = "borer wizard card"
|
||||
desc = "The borer is a weak chaos entity. It can gain control of a human and produce more borers to completely overtake the station."
|
||||
cardname = "borer"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/borer/small
|
||||
name = "borer token card"
|
||||
desc = "The borer is a weak chaos entity. It can gain control of a human, but it can't reproduce."
|
||||
icon_state = "card_gray"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/borer/special_effect(mob/user)
|
||||
if(!..())
|
||||
user << "The borer is not yet ready."
|
||||
return
|
||||
|
||||
new /obj/item/toy/singlecard/wizard/borer/small(get_turf(src.loc))
|
||||
user << "You create a borer token card!"
|
||||
|
||||
/obj/item/toy/singlecard/wizard/borer/small/special_effect()
|
||||
return
|
||||
|
||||
/obj/item/toy/singlecard/wizard/ian
|
||||
name = "Ian wizard card"
|
||||
desc = "Ian is a strong neutral entity. Legends say that the one who kills Ian will forever be cursed."
|
||||
cardname = "ian"
|
||||
|
||||
/obj/item/weapon/storage/bag/wiz_cards
|
||||
icon = 'icons/obj/wiz_cards.dmi'
|
||||
icon_state = "cardpack"
|
||||
name = "Wizard Card Pack"
|
||||
storage_slots = 50
|
||||
max_combined_w_class = 200
|
||||
max_w_class = 3
|
||||
w_class = 1
|
||||
can_hold = list("/obj/item/toy/wizard_card","/obj/item/weapon/reagent_containers/food/snacks/chocofrog")
|
||||
|
||||
/obj/item/weapon/storage/bag/wiz_cards/full/New()
|
||||
..()
|
||||
new /obj/item/toy/cards/wizard/full(src)
|
||||
|
||||
/obj/item/toy/cards/wizard
|
||||
icon = 'icons/obj/wiz_cards.dmi'
|
||||
icon_state = "wizdeck_low"
|
||||
strict_deck = 0
|
||||
|
||||
/obj/item/toy/cards/wizard/generate_cards()
|
||||
return
|
||||
|
||||
/obj/item/toy/cards/update_icon()
|
||||
if(cards.len > 15)
|
||||
src.icon_state = "wizdeck_full"
|
||||
else if(cards.len > 8)
|
||||
src.icon_state = "wizdeck_half"
|
||||
else if(cards.len > 1)
|
||||
src.icon_state = "wizdeck_low"
|
||||
else
|
||||
src.icon_state = "wizdeck_empty"
|
||||
|
||||
/obj/item/toy/cards/wizard/full/generate_cards()
|
||||
for(var/card in wizard_cards_normal)
|
||||
var/newcard = new card(src)
|
||||
cards += newcard
|
||||
for(var/card in wizard_cards_rare)
|
||||
var/newcard = new card(src)
|
||||
cards += newcard
|
||||
|
||||
/obj/item/weapon/storage/bag/wiz_cards/attack_self(mob/user)
|
||||
icon_state = "cardpack_open"
|
||||
.=..()
|
||||
|
||||
/obj/item/weapon/storage/bag/wiz_cards/show_to(mob/user as mob)
|
||||
icon_state = "cardpack_open"
|
||||
.=..()
|
||||
|
||||
/obj/item/weapon/storage/bag/wiz_cards/frog/New()
|
||||
..()
|
||||
contents += new /obj/item/weapon/reagent_containers/food/snacks/chocofrog
|
||||
var/card
|
||||
if(prob(80)) //80% chance for a classic card, 20% for a legendary
|
||||
card=pick(wizard_cards_normal)
|
||||
new card(src)
|
||||
else
|
||||
card=pick(wizard_cards_rare)
|
||||
new card(src)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/obj/item/weapon/deck
|
||||
name = "deck of cards"
|
||||
desc = "A simple deck of playing cards."
|
||||
icon = 'playing_cards.dmi'
|
||||
icon = 'playing_cards_html.dmi'
|
||||
icon_state = "deck"
|
||||
w_class = 2
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
/obj/item/weapon/hand
|
||||
name = "hand of cards"
|
||||
desc = "Some playing cards."
|
||||
icon = 'playing_cards.dmi'
|
||||
icon = 'playing_cards_html.dmi'
|
||||
icon_state = "empty"
|
||||
w_class = 1
|
||||
|
||||
|
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 611 B |
@@ -3427,4 +3427,48 @@
|
||||
reagents.add_reagent("nutriment", 10)
|
||||
if(10)
|
||||
desc += " Just a dollop of garnishes."
|
||||
reagents.add_reagent("nutriment", 10)
|
||||
reagents.add_reagent("nutriment", 10)
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/chocofrog
|
||||
name = "chocolate frog"
|
||||
desc = "An exotic snack originating from the Space Wizard Federation. Very slippery!"
|
||||
icon = 'icons/obj/wiz_cards.dmi'
|
||||
icon_state = "frog"
|
||||
|
||||
var/jump_cd
|
||||
New()
|
||||
..()
|
||||
reagents.add_reagent("nutriment",2)
|
||||
reagents.add_reagent("hyperzine",1)
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/chocofrog/HasProximity(atom/movable/AM as mob|obj)
|
||||
if(!jump_cd)
|
||||
jump()
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/chocofrog/proc/jump()
|
||||
if(!istype(src.loc,/turf)) return
|
||||
jump_cd=1
|
||||
spawn(50)
|
||||
jump_cd=0
|
||||
|
||||
var/list/escape_paths=list()
|
||||
|
||||
for(var/turf/T in view(7,src))
|
||||
escape_paths |= T
|
||||
|
||||
var/turf/T = pick(escape_paths)
|
||||
src.throw_at(T, 10, 2)
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/snacks/chocofrog/pickup(mob/living/user as mob)
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(!H) return 1
|
||||
|
||||
spawn(0)
|
||||
if(((M_CLUMSY in H.mutations)) || prob(25))
|
||||
user.visible_message("<span class='warning'>[src] escapes from [H]'s hands!</span>","<span class='warning'>[src] escapes from your grasp!</span>")
|
||||
H.drop_item()
|
||||
|
||||
jump()
|
||||
return 1
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
BIN
icons/obj/wiz_cards.dmi
Normal file
BIN
icons/obj/wiz_cards.dmi
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -1044,7 +1044,9 @@
|
||||
#include "code\modules\food\customizables.dm"
|
||||
#include "code\modules\food\icecreamvat.dm"
|
||||
#include "code\modules\food\recipes_microwave.dm"
|
||||
#include "code\modules\games\cards.dm"
|
||||
#include "code\modules\games\cards_html.dm"
|
||||
#include "code\modules\games\cards\playing_cards.dm"
|
||||
#include "code\modules\games\cards\wizard_cards.dm"
|
||||
#include "code\modules\genetics\side_effects.dm"
|
||||
#include "code\modules\html_interface\html_interface.dm"
|
||||
#include "code\modules\html_interface\html_interface_client.dm"
|
||||
|
||||
Reference in New Issue
Block a user