Hat the artist! mmmmmm

This commit is contained in:
nemunaire 2020-03-05 00:06:22 +01:00
parent da29b8fc1b
commit 36318c7d70
3 changed files with 121 additions and 16 deletions

View File

@ -6,8 +6,10 @@ Created on Wed Mar 4 22:23:56 2020
@author: AlexandreMouchel
"""
from opale.carte import *
class Board():
def __init__(self):
self.chasseresse = []
self.dragonCorail = []
@ -20,7 +22,81 @@ class Board():
self.city = []
self.underTheBoard = []
self.roundCity = 0
def isFinished(self):
return self.roundCity >= 3
def play_card(self, *cards):
ret = []
for card in cards:
if type(card) == Chasseresse:
self.chasseresse.append(card)
if len(self.chasseresse) >= 3:
self.underTheBoard += self.chasseresse
self.chasseresse = []
ret += self.dragonCorail
self.dragonCorail = []
elif type(card) == DragonCorail:
self.dragonCorail.append(card)
ret += self.pearl
self.pearl = []
elif type(card) == Pearl:
self.pearl.append(card)
elif type(card) == Witch:
self.witch.append(card)
ret += self.pearl
self.pearl = []
ret += self.dragonPetrified
self.dragonPetrified = []
elif type(card) == DragonPetrified:
self.dragonPetrified.append(card)
elif type(card) == Golem:
self.golem.append(card)
ret += self.witch
self.witch = []
elif type(card) == Guardian:
self.guardian.append(card)
if len(self.guardian) >= 4:
ret += self.guardian
self.guardian = []
elif type(card) == Horser:
self.horser.append(card)
if len(self.horser) >= 2:
ret += self.witch
ret += self.golem
self.witch = []
self.golem = []
self.underTheBoard += self.horser
self.horser = []
elif type(card) == City:
self.city.append(card)
if len(self.city) >= 3:
self.roundCity += 1
self.city = []
ret += self.underTheBoard
self.underTheBoard = []
else:
raise Exception("Unknown card type " + type(card).__name__)
return ret

View File

@ -6,10 +6,30 @@ Created on Wed Mar 4 22:20:15 2020
@author: AlexandreMouchel
"""
from board import Board
from player import Player
class Game():
def __init__(self):
self.board = Board()
self.player1 = Player()
self.player2 = Player()
self.round = 0
self.round = 0
from carte import *
c1 = Pearl(2)
c2 = Pearl(1)
game = Game()
print(game.board.play_card(c1, c2))
c3 = DragonCorail(2)
print(game.board.play_card(c3))
c4 = City()
print(game.board.play_card(c4, c4, c4))
print(game.board.play_card(c4, c4, c4))
print(game.board.play_card(c4, c4, c4))
print(game.board.isFinished())

View File

@ -11,12 +11,13 @@ from carte import *
class Player():
def __init__(self):
self.pioche = []
self.défausse = []
self.main = []
self.dragonPetrified = False
self.dragonPetrified = False
# we are creating the deck
self.pioche += [City() for i in range(6)]
self.pioche += [Chasseresse(1 if i % 3 else 2) for i in range(6)]
@ -30,18 +31,26 @@ class Player():
self.pioche += [Guardian(2) for i in range(3)]
self.pioche += [Guardian(3) for i in range(1)]
random.shuffle(self.pioche)
def pick(self):
for i in range((6 if self.dragonPetrified else 5) - len(self.main)):
self.main.append(self.pioche.pop())
def lose_dragon(self):
self.dragonPetrified = False
nde = Player()
print(len(nde.pioche))
nde.pick()
nde.dragonPetrified = True
nde.pick()
print(len(nde.pioche))
print(nde.main)
random.shuffle(self.main)
for i in range(len(self.main)):
self.pioche.append(self.main.pop())
self.pick()
def take_dragon(self):
self.dragonPetrified = True
def push_défausse(self, *cards):
self.défausse += cards
def play_card(self, *cards):
for card in cards:
self.main.remove(card)