Esempio n. 1
0
def fight(hero, foe, death):

    if foe.hp <= 0:
        print(f"\n\t\t\tYOU DEFEAT {foe.name}")
        return 1

    elif hero.hp <= 0:
        death.enter()
        exit(1)

    else:
        pass

    print(f"\n\t\t\t{hero.name}: {hero.hp} HP VS {foe.hp} HP :{foe.name}\n")
    battle = suit()

    if battle == "lose":
        hero.hp = hero.hp - foe.atk
        fight(hero, foe, death)

    elif battle == "win":
        foe.hp = foe.hp - hero.atk
        fight(hero, foe, death)

    else:
        print("something wrong")
Esempio n. 2
0
    def __init__(self, p_suit, p_rank):
        r = rank()
        valid_rank = r.validate(p_rank)

        s = suit()
        valid_suit = s.validate(p_suit)

        if (valid_rank and valid_suit):
            self.suit = p_suit
            self.rank = p_rank
        else:
            raise ValueError("Invalid Rank or Suit")
Esempio n. 3
0
    def __init__(self, new_deck=False, cards=None):
        if (cards is None):
            cards = []

        self.cards = cards
        if (new_deck):
            ranks = rank()
            suits = suit()
            for s in suits.values:
                for r in ranks.values:
                    c = card(s, r)
                    self.cards.append(c)
Esempio n. 4
0
    def __init__(self, parameter_suit, parameter_rank):
        r = rank()
        valid_rank = r.validate(parameter_rank)

        s = suit()
        valid_suit = s.validate(parameter_suit)

        if (valid_rank and valid_suit):
            self.suit = parameter_rank
            self.rank = parameter_rank
        else:
            raise ValueError("Ivalid Rank or Suit")
            self.suit = "invalid"
            self.rank = "invalid"