1. Alexander Schremmer
  2. domination

Commits

Alexander Schremmer  committed 053210a

Fix transmute, fix card counter.

  • Participants
  • Parent commits 759a10c
  • Branches default

Comments (0)

Files changed (3)

File domination/cards/alchemy.py

View file
  • Ignore whitespace
     desc = _("Trash a card from your hand. If it is an Action Card, gain a Duchy. If it is a Treasure card, gain a Transmute. If it is a Victory Card, gain a Gold.")
 
     def activate_action(self, game, player):
+        if not player.hand:
+            return
         cards = yield SelectHandCards(game, player, count_lower=1, count_upper=1,
                 msg=_("Which card do you want to trash?"))
         if cards:
                     player.discard_pile.append(new_card)
                     for info_player in game.following_participants(player):
                         yield InfoRequest(game, info_player,
-                            _("%s gains:") % (other_player.name, ), [new_card])
+                            _("%s gains:") % (player.name, ), [new_card])
             if isinstance(card, TreasureCard):
                 with fetch_card_from_supply(game, Transmute) as new_card:
                     player.discard_pile.append(new_card)
                     for info_player in game.following_participants(player):
                         yield InfoRequest(game, info_player,
-                                _("%s gains:") % (other_player.name, ), [new_card])
+                                _("%s gains:") % (player.name, ), [new_card])
             if isinstance(card, VictoryCard):
                 with fetch_card_from_supply(game, Gold) as new_card:
                     player.discard_pile.append(new_card)
                     for info_player in game.following_participants(player):
                         yield InfoRequest(game, info_player,
-                                _("%s gains:") % (other_player.name, ), [new_card])
+                                _("%s gains:") % (player.name, ), [new_card])
 
 
 class University(ActionCard):

File domination/gameengine.py

View file
  • Ignore whitespace
                         player.remaining_actions -= 1
                         card = action_cards[0]
                         player.hand.remove(card)
-                        gen = self.play_action_card(player, card)
-                        generator_forward(gen)
                         if card.trash_after_playing:
                             self.trash_pile.append(card)
                         else:
                             player.aux_cards.append(card)
+                        gen = self.play_action_card(player, card)
+                        generator_forward(gen)
 
                     # deal
                     break_selection = False

File domination/templates/game.html

View file
  • Ignore whitespace
     <h3>Players</h3>
     <ul>
       {% for p in game.players %}
-      <li class="{% if p.current %}activeplayer{% endif %}">{{ p.name }} ({{ p.hand | count }} of {{ (p.hand + p.deck + p.discard_pile) | count }} cards in hand)
+      <li class="{% if p.current %}activeplayer{% endif %}">{{ p.name }} ({{ p.hand | count }} of {{ p.total_cards | count }} cards in hand)
       {% if runner.waiting_for == p %} (waiting for this player)
       {% if player == runner.owner and p != player and game.players | count > 2 %}
         <form action="{{ url_for("kick_player", name=game.name, playername=p.name) }}" method="post">