mirror of
https://github.com/neogeek23/Dominion-Strategy-Simulator.git
synced 2026-02-04 19:18:18 +00:00
Add files via upload
This commit is contained in:
parent
159839dbc4
commit
1102ad7de1
12
game.py
12
game.py
@ -19,10 +19,14 @@ def setup_new_game(game_list, parameter, card_info):
|
|||||||
index = 0
|
index = 0
|
||||||
for p in parameter[2:]:
|
for p in parameter[2:]:
|
||||||
if p:
|
if p:
|
||||||
card = card_info[index][8](card_info[index][0], card_info[index][1], card_info[index][2],
|
for i in range(card_info[index][9]):
|
||||||
card_info[index][3], card_info[index][4], card_info[index][5],
|
card = card_info[index][8](card_info[index][0], card_info[index][1], card_info[index][2],
|
||||||
card_info[index][6], card_info[index][7], None)
|
card_info[index][3], card_info[index][4], card_info[index][5],
|
||||||
t.add_pile(card, card_info[index][9])
|
card_info[index][6], card_info[index][7], None)
|
||||||
|
if i ==0:
|
||||||
|
t.add_pile(card, 1)
|
||||||
|
else:
|
||||||
|
t.get_pile(t.get_pile_index_of_card(card_info[index][0])).add_card(card)
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
for i in range(humans):
|
for i in range(humans):
|
||||||
|
|||||||
20
militia.py
20
militia.py
@ -4,29 +4,29 @@ from random import randint
|
|||||||
|
|
||||||
class Militia(Card):
|
class Militia(Card):
|
||||||
def effect(self):
|
def effect(self):
|
||||||
print("Who am I: " + str(self._Card__owner.get_table().get_players().index(self._Card__owner)) + " " + str(self._Card__owner))
|
|
||||||
for player in self._Card__owner.get_table().get_players():
|
for player in self._Card__owner.get_table().get_players():
|
||||||
print("player before if: " + str(self._Card__owner.get_table().get_players().index(player)) + " " + str(player))
|
|
||||||
if self._Card__owner != player:
|
if self._Card__owner != player:
|
||||||
print(str(self._Card__owner) + " " + str(player))
|
|
||||||
print("self._Card__owner: " + str(self._Card__owner.get_table().get_players().index(self._Card__owner)))
|
|
||||||
print("Player: " + str(self._Card__owner.get_table().get_players().index(player)))
|
|
||||||
player.print_hand()
|
player.print_hand()
|
||||||
print("Player " + str(self._Card__owner.get_table().get_players().index(player)) + ", you MUST discard "
|
print("Player " + str(self._Card__owner.get_table().get_players().index(player)) + ", you MUST discard "
|
||||||
"down to 3 cards.")
|
"down to 3 cards.")
|
||||||
self.__force_discard(self._Card__owner.get_std_chances(), player)
|
self.__force_discard(self._Card__owner.get_std_chances(), player)
|
||||||
|
|
||||||
def __force_discard(self, chances, player):
|
def __force_discard(self, chances, player):
|
||||||
if self._Card__owner.get_hand().get_remaining() > 3 and chances > 0:
|
if player.get_hand().get_remaining() > 3 and chances > 0:
|
||||||
hand_index = int(input("\nPlease identify a card from hand you would like to discard by providing "
|
hand_index = int(input("\nPlease identify a card from hand you would like to discard by providing "
|
||||||
"its index: "))
|
"its index 0 to " + str(player.get_hand().get_remaining() - 1) + ": "))
|
||||||
|
|
||||||
if 0 > hand_index >= self.__hand.get_remaining() and chances > 0:
|
if chances <= 0:
|
||||||
print("Acceptable inputs range from 0 to " + str(self.__hand.get_remaining() - 1) + ". 1 chance lost.")
|
print("Somehow chances ran out, you'll randomly discard a card now.")
|
||||||
self.__force_discard(chances - 1)
|
self.__force_discard(chances, player)
|
||||||
|
elif 0 > hand_index or hand_index >= self._Card__owner.get_hand().get_remaining():
|
||||||
|
print("Acceptable inputs range from 0 to " + str(player.get_hand().get_remaining() - 1) +
|
||||||
|
". 1 chance lost.")
|
||||||
|
self.__force_discard(chances - 1, player)
|
||||||
else:
|
else:
|
||||||
print("Discarding " + player.get_hand().get_card(hand_index).get_name() + ".")
|
print("Discarding " + player.get_hand().get_card(hand_index).get_name() + ".")
|
||||||
player.discard_from_hand(hand_index)
|
player.discard_from_hand(hand_index)
|
||||||
|
player.print_hand()
|
||||||
self.__force_discard(chances, player)
|
self.__force_discard(chances, player)
|
||||||
elif self._Card__owner.get_hand().get_remaining() > 3 and chances < 0:
|
elif self._Card__owner.get_hand().get_remaining() > 3 and chances < 0:
|
||||||
print("You're out of chances to select a valid card to discard, randomly selecting for you.")
|
print("You're out of chances to select a valid card to discard, randomly selecting for you.")
|
||||||
|
|||||||
@ -71,7 +71,6 @@ class Player:
|
|||||||
for i in range(ds[1]):
|
for i in range(ds[1]):
|
||||||
table.get_pile(index).transfer_top_card(self.__deck)
|
table.get_pile(index).transfer_top_card(self.__deck)
|
||||||
self.__claim_top_card(self.__deck)
|
self.__claim_top_card(self.__deck)
|
||||||
print("Top card: " + str(self.__deck.get_top_card().get_owner()) + " " + str(self.__deck.get_top_card().get_name()))
|
|
||||||
self.__deck.shuffle()
|
self.__deck.shuffle()
|
||||||
|
|
||||||
def draw_hand(self):
|
def draw_hand(self):
|
||||||
@ -144,7 +143,8 @@ class Player:
|
|||||||
print("You do not have enough coin. Try again.")
|
print("You do not have enough coin. Try again.")
|
||||||
chances -= 1
|
chances -= 1
|
||||||
else:
|
else:
|
||||||
print("Buying card " + self.__table.get_pile(pile_index).get_card_group().get_name())
|
print("Player " + str(self.get_table().get_players().index(self)) + " buying card " +
|
||||||
|
self.__table.get_pile(pile_index).get_card_group().get_name())
|
||||||
self.__table.get_pile(pile_index).transfer_top_card(self.__discard)
|
self.__table.get_pile(pile_index).transfer_top_card(self.__discard)
|
||||||
self.__claim_top_card(self.__discard)
|
self.__claim_top_card(self.__discard)
|
||||||
self.__buys -= 1
|
self.__buys -= 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user