Esempio n. 1
0
def maingame():
    x = input("press y/n")
    if x == "Y" or x == "Yes" or x == "yes" or x == "y":
        card = []
        card.append(Card(random.randint(1, 13), random.choice(suits)))
        card.append(Card(random.randint(1, 13), random.choice(suits)))
        hand.resethand()
        i = 0
        while (i < len(card)):
            hand.addCard(card[i].bjValue())
            print(card[i].bjValue())
            i += 1
        if sum(hand.hand) == 11 and (hand.hand[0] == 1 or hand.hand[1] == 1):
            print("BLACKJACK", "\n************"
                  "\n  You Win!", "\n************")
            exit()
        while True:
            print("you are at: \n", sum(hand.hand))
            option = input("1) Hit \n2) Stay\n")
            if option == "1":
                card.append(Card(random.randint(1, 11), random.choice(suits)))
                hand.addCard(card[i].bjValue())
                j = 0
                while (j < len(card)):
                    print(card[j].bjValue())
                    j += 1
                if (sum(hand.hand) > 21):
                    print("You lose sucker")
                    break

            if option == "2":
                while (sum(dhand.hand) < 17):
                    dhand.addCard(
                        Card(random.randint(1, 11),
                             random.choice(suits)).bjValue())
                print("Dealer has: \n", sum(dhand.hand))
                if (sum(dhand.hand) > 21):
                    print("Dealer Bust\nYou win")
                    break
                elif (sum(hand.hand) > sum(dhand.hand)
                      and sum(hand.hand) <= 21):
                    print("You win")
                    break
                elif (sum(hand.hand) == sum(dhand.hand)):
                    print("Draw")
                    break
                else:
                    print("You lose")
                    break
    else:
        exit()
Esempio n. 2
0
def RitualStone(self, board, player, enemies, tag, relics):
    for x in range(5):
        card = cards['demonic seal']
        player.stackCards.append(
            Card(0, 0, 0, 0, card[0], card[1], card[2], card[3], card[4],
                 card[5], card[6], card[7]))
    player.stackCards = shuffle(player.stackCards)
    return board, player, enemies
Esempio n. 3
0
class TestCard(unittest.TestCase):

    def setUp(self):
        random.seed(42)
        self.card = Card("Max")
        self.leo = Card("Leo")

    def tearDown(self):
        del self.card
        del self.leo

    def test_init(self):
        self.assertEqual(self.card.name, "Max")
        self.assertFalse(self.card.is_keg)
        self.assertEqual(self.card.comp_cross_out_nb, False)

    def test_str(self):
        self.assertNotEqual(self.card.__str__(), self.leo.__str__())

    def test_len(self):
        self.assertEqual(len(self.card), 3)

    def test_eq(self):
        self.assertEqual(len(self.card), len(self.leo))

    def test_rt(self):
        self.assertTrue(self.card > self.leo)

    def test_check_keg(self):
        self.card.check_keg(25)
        self.assertTrue(self.card.is_keg)

    def test_cross_out_nb(self):
        self.card.cross_out_nb(25)
        self.assertFalse(self.card.is_keg)

    def test_calc_sum(self):
        self.assertGreaterEqual(self.card.calc_sum(), 0)
Esempio n. 4
0
from Classes.Attack import *
from Classes.Card import *
from Classes.CardType import *
from Classes.Element import *
from Classes.Energy import *
from Classes.Pokemon import *
from Classes.Set import *
from Classes.Subset import *

#Testing Constructors and Displays are working for all Classes
atk1 = Attack('1', 'Quick Attack',
              'Flip a coin, if heads, this attack does 10 more damage.', '20',
              'CC')
card1 = Card('1', 'Pikachu', 'Eletric Mouse', '4', 'Kioko', '1',
             'http/artlink.here', '4', '2', '1')
cardType1 = CardType('1', 'Trainer', 'So mad')
element1 = Element('1', 'Fire', 'FireLogoLink.com')
energy1 = Energy('1', 'false')
pokemon1 = Pokemon('1', 'Basic', '60', 'CC', 'Water', 'Grass', '2', '', '2',
                   '1', '', '1', '2', '')
set1 = Set('1', 'Sun & Moon', '2017', '600', 'Use GX Powers!')
subset1 = Subset('1', 'Base Set', '2017', '130', 'Solgaleo and Lunala GX', '1')

print(atk1.display())
print(card1.display())
print(cardType1.display())
print(element1.display())
print(energy1.display())
print(pokemon1.display())
print(set1.display())
print(subset1.display())
Esempio n. 5
0
cards = []
# base for adding in the dictionaries for the cards and the root of where the images are
blankCard = {'used': False, 'image': False, 'name': False, 'description': False, 'ichorCost': False, 'exhaust': False}
cardRoot = 'Images\\Cards\\'

# cards


def LuckOfTheDice(enemy, board, blankBoard):
    newBoard = deepcopy(blankBoard)
    for row in board:
        for card in row:
            for type in card:
                while not card[type]:
                    cords = (randint(1, 5), randint(1, 5))
                    if not newBoard[cords[0]][cords[1]][type]:
                        newBoard[cords[0]][cords[1]][type] = card[type]
                        card[type] = False
    return newBoard


cards.append(Card(False, False, False, False, LuckOfTheDice, False, 'luck of the dice', 'usable once a combat which randomly moves all cards, playable positions and where the enemies will attack, for no ichor', 0, True))


def StrikeAtTheHeart(enemy, board, blankBoard):
    enemy.crippling += 2
    enemy.hp -= 15


cards.append([False, False, False, False, StrikeAtTheHeart, pygame.image.load(cardRoot+'StrikeAtTheHeart.png'), 'strike at the heart', 'high cost, medium damage, status effect, single target', 3, False])
Esempio n. 6
0
from pip._vendor.colorama import init
init()
from pip._vendor.colorama import Back, Fore, Style

# list of variables
player_1 = None
player_2 = None
player_3 = None
player_4 = None
Dealer = Player('Dealer', ' ')
hand_1 = Hand()
hand_2 = Hand()
hand_3 = Hand()
hand_4 = Hand()
dealer = Hand()
dealer_hid_card = Card(' ',' ')
hid_card = []
new_deck = Deck()
player_list = [player_1,player_2,player_3,player_4]
hand_list = [hand_1,hand_2,hand_3,hand_4,dealer]
ply_option = {'H':'Hit', 'S':'Stand', 'D':'Double Down'}


# functions for the game

def table(player_list):
    '''
    Some sort of GUI
    :param player_list:
    :return:
    '''
Esempio n. 7
0
    def __init__(self):
        self.deck = []

        for suit in Variables.suits:
            for rank in Variables.ranks:
                self.deck.append(Card.Card(suit, rank))
Esempio n. 8
0
 def setUp(self):
     random.seed(42)
     self.card = Card("Max")
     self.leo = Card("Leo")
Esempio n. 9
0
from random import randint
from Classes import Hand
from Classes import Card
from Functions import deal
from Functions import bust_check
from Functions import table
from Functions import table_win

# FUNCTIONS #

# CARDS #

twospades = Card("Two of Spades", 2)
twohearts = Card("Two of Hearts", 2)
twodiamonds = Card("Two of Diamonds", 2)
twoclubs = Card("Two of Clubs", 2)

threespades = Card("Three of Spades", 3)
threehearts = Card("Three of Hearts", 3)
threediamonds = Card("Three of Diamonds", 3)
threeclubs = Card("Three of Clubs", 3)

fourspades = Card("Four of Spades", 4)
fourhearts = Card("Four of Hearts", 4)
fourdiamonds = Card("Four of Diamonds", 4)
fourclubs = Card("Four of Clubs", 4)

fivespades = Card("Five of Spades", 5)
fivehearts = Card("Five of Hearts", 5)
fivediamonds = Card("Five of Diamonds", 5)
fiveclubs = Card("Five of Clubs", 5)
Esempio n. 10
0
'''c1=Card(x,y)
hand=Hand()
dhand=Hand()
def drawcard():
    suits="cdsh"
    Card(random.randint(1,13),random.choice(suits))
'''
print("Welcome to Serendipity")
hand = Hand()
dhand = Hand()
suits = "cdsh"
x = input("Play BJ?\n Y/N\n").upper()

if x == "Y":
    card = []
    card.append(Card(random.randint(1, 13), random.choice(suits)))
    card.append(Card(random.randint(1, 13), random.choice(suits)))
    i = 0
    while (i < len(card)):
        hand.addCard(card[i].bjValue())
        print(card[i].bjValue())
        i += 1
    if sum(hand.hand) == 11 and (hand.hand[0] == 1 or hand.hand[1] == 1):
        print("BLACKJACK", "\n************" "\n  You Win!", "\n************")
        exit()
    while True:
        print("you are at: \n", sum(hand.hand))
        option = input("1) Hit \n2) Stay\n")
        if option == "1":
            card.append(Card(random.randint(1, 11), random.choice(suits)))
            hand.addCard(card[i].bjValue())