diff --git a/code/modules/cards/cards.dm b/code/modules/cards/cards.dm index 046c3e47906..7fcb19da6bb 100644 --- a/code/modules/cards/cards.dm +++ b/code/modules/cards/cards.dm @@ -131,13 +131,18 @@ var/list/cards = fetch_card_atoms() - card = card || cards[1] //draw the card on top + card ||= pick_card(user, cards) cards -= card update_appearance() playsound(src, 'sound/items/cards/cardflip.ogg', 50, TRUE) return card +/// Picks what card the user draws from the deck +/obj/item/toy/cards/proc/pick_card(mob/living/user, list/obj/item/toy/singlecard/cards) + // By default just pick the top card + return cards[1] + /// Returns the cards in this deck. /// Lazily generates the cards if they haven't already been made. /obj/item/toy/cards/proc/fetch_card_atoms() diff --git a/code/modules/cards/deck/tarot.dm b/code/modules/cards/deck/tarot.dm index 5fa7f25e61e..a408b04a6cf 100644 --- a/code/modules/cards/deck/tarot.dm +++ b/code/modules/cards/deck/tarot.dm @@ -28,6 +28,23 @@ M.Turn(180) card.transform = M +/obj/item/toy/cards/deck/tarot/pick_card(mob/living/user, list/obj/item/toy/singlecard/cards) + // If the user is cursed they have increase chance of drawing Death or The Tower + if(!HAS_TRAIT(user, TRAIT_CURSED)) + return ..() + + var/total_card = length(cards) + // give a boosted chance if they're using the full deck + var/chance_modifier = total_card >= 56 ? 24 : 4 + if(!prob(min(33, chance_modifier / total_card * 100))) + return ..() + + for(var/obj/item/toy/singlecard/card as anything in cards) + if(card.cardname == "Death" || card.cardname == "The Tower") + return card + + return ..() + /obj/item/toy/cards/deck/tarot/haunted name = "haunted tarot game deck" desc = "A spooky looking tarot deck. You can sense a supernatural presence linked to the cards..."