Exemplo n.º 1
0
    def play_action(self, player):
        player.played.plus_power(1)
        instruction_text = "Put up to two cards each with cost 5 or less and\neach with a different cost from your discard pile\ninto your hand. (1/2)"
        assemble = []
        for c in player.discard.contents:
            if c.cost <= 5:
                assemble.append(c)

        if len(assemble) > 0:
            result = effects.may_choose_one_of(instruction_text, player,
                                               assemble, ai_hint.BEST)
            if result != None:
                result.pop_self()
                player.hand.contents.append(result)
                assemble = []
                for c in player.discard.contents:
                    if c.cost <= 5 and c.cost != result.cost:
                        assemble.append(c)
                if len(assemble) > 0:
                    instruction_text = "Put up to two cards each with cost 5 or less and\neach with a different cost from your discard pile\ninto your hand. (2/2)"
                    result = effects.may_choose_one_of(instruction_text,
                                                       player, assemble,
                                                       ai_hint.BEST)
                    if result != None:
                        result.pop_self()
                        player.hand.contents.append(result)
        return 0
Exemplo n.º 2
0
 def trigger(self, ttype, data, player, active, immediate):
     if globe.DEBUG:
         print("test", self.name, flush=True)
     if trigger.test(not immediate,\
         trigger.PLAY, \
         self.trigger, \
         player,ttype,active) \
       and data[0].ctype_eq(cardtype.HERO):
         hero_count = 0
         for c in self.player.played.played_this_turn:
             if c.ctype_eq(cardtype.HERO):
                 hero_count += 1
         if hero_count == 2:
             instruction_text = "Would you like to put a card from the main deck under Felicity Smoak?"
             hint = ai_hint.ALWAYS
             if len(player.under_superhero.contents) > 0:
                 hint = ai_hint.NEVER
                 instruction_text += "\nif not, put a card from under your superhero\ninto your hand"
             if effects.ok_or_no(instruction_text, player, None, hint):
                 top_card = globe.boss.main_deck.draw()
                 top_card.set_owner(player)
                 player.under_superhero.contents.append(top_card)
             elif len(player.under_superhero.contents) > 0:
                 instruction_text = "You may put a card from under your superhero into your hand."
                 result = effects.may_choose_one_of(
                     instruction_text, player,
                     player.under_superhero.contents, ai_hint.BEST)
Exemplo n.º 3
0
 def play_action(self, player):
     if len(player.hand.contents) > 0:
         result = effects.may_choose_one_of(self.text, player,
                                            player.hand.contents,
                                            ai_hint.IFBAD)
         if result != None:
             result.pop_self()
             player.under_superhero.contents.append(result)
         else:
             if len(player.under_superhero.contents) > 0:
                 instruction_text = "You may put a card from under your suprhero into your hand."
                 result = effects.may_choose_one_of(
                     instruction_text, player,
                     player.under_superhero.contents, ai_hint.BEST)
                 if result != None:
                     result.pop_self()
                     player.hand.contents.append(result)
     return 0
Exemplo n.º 4
0
 def play_action(self, player):
     player.played.plus_power(3)
     assemble = []
     assemble.extend(player.hand.contents)
     assemble.extend(player.discard.contents)
     if len(assemble) > 0:
         instruction_text = "You may destroy a card in your hand or discard pile"
         result = effects.may_choose_one_of(instruction_text, player,
                                            assemble, ai_hint.IFBAD)
         if result != None:
             result.destroy(player)
     return 0
Exemplo n.º 5
0
 def trigger(self, ttype, data, player, active, immediate):
     if trigger.test(not immediate,\
         trigger.DRAW, \
         self.trigger, \
         player,ttype) \
       and data[1]:
         player.triggers.remove(self.trigger)
         instruction_text = "Would you like to put one drawn cards under your Super Hero?"
         result = effects.may_choose_one_of(instruction_text, player,
                                            data[2])
         if result != None:
             result.pop_self()
             player.under_superhero.contents.append(result)
Exemplo n.º 6
0
 def play_action(self, player):
     if not self in player.ongoing.contents:
         player.ongoing.add(self.pop_self())
     elif len(player.hand.contents) > 0:
         instruction_text = "You may put a card from your hand under your superhero.\nIf you do, draw a card."
         result = effects.may_choose_one_of(instruction_text, player,
                                            player.hand.contents,
                                            ai_hint.IFBAD)
         if result != None:
             result.pop_self()
             player.under_superhero.contents.append(result)
             player.draw_card()
     return 0
Exemplo n.º 7
0
 def defend(self, attacker=None, defender=None):
     self.pop_self()
     self.owner.under_superhero.contents.append(self)
     self.owner.draw_card(2)
     if len(self.owner.hand.contents) > 0:
         instruction_text = "You may put a card from your hand under your superhero."
         result = effects.may_choose_one_of(instruction_text, self.owner,
                                            self.owner.hand.contents,
                                            ai_hint.IFBAD)
         if result != None:
             result.pop_self()
             self.owner.under_superhero.contents.append(result)
     return
Exemplo n.º 8
0
 def special_action_click(self, player):
     #if len(self.discarded_cards) > 0:
     result = False
     while result != None and len(self.discarded_cards) > 0:
         result = effects.may_choose_one_of("Choose a card to play", player,
                                            self.discarded_cards,
                                            ai_hint.BEST)
         if result != None:
             save_place = result.find_self()[0]
             result.pop_self()
             player.play_and_return(result, save_place)
             self.discarded_cards.remove(result)
     if len(self.discarded_cards) == 0:
         player.played.special_options.remove(self.action)
Exemplo n.º 9
0
 def trigger(self, ttype, data, player, active, immediate):
     if trigger.test(not immediate,\
         trigger.GAIN_CARD, \
         self.trigger, \
         player,ttype) \
       and data[1].ctype_eq(cardtype.VILLAIN):
         assemble = []
         assemble.extend(player.discard.contents)
         assemble.extend(player.hand.contents)
         if len(assemble) > 0:
             result = effects.may_choose_one_of(
                 "You may destory a card in your hand or disscard pile.",
                 player, assemble, ai_hint.IFBAD)
             if result != None:
                 result.destroy(player)
Exemplo n.º 10
0
 def special_action_click(self, player):
     assemble = []
     for c in player.under_superhero.contents:
         if c.defence:
             assemble.append(c)
     if len(assemble) > 0:
         instruction_text = "Would you like to put a defence from under your\nsuper hero, on top of your deck?"
         result = effects.may_choose_one_of(instruction_text, player,
                                            assemble, ai_hint.BEST)
         if result != None:
             result.pop_self()
             player.deck.contents.append(result)
             self.player.played.special_options.remove(self.action)
             return True
     return False
Exemplo n.º 11
0
 def special_action_click(self, player):
     assemble = []
     for c in player.under_superhero.contents:
         if c.ctype_eq(cardtype.VILLAIN):
             assemble.append(c)
     if len(assemble) > 0:
         instruction_text = "Would you like to put a Villain from under\nyour super hero on the bottom of your deck?"
         result = effects.may_choose_one_of(instruction_text, player,
                                            assemble, ai_hint.BEST)
         if result != None:
             result.pop_self()
             player.deck.contents.insert(0, result)
             self.player.played.special_options.remove(self.action)
             return True
     return False
Exemplo n.º 12
0
 def special_action_click(self, player):
     assemble = []
     for c in globe.boss.lineup.contents:
         if c.ctype_eq(cardtype.SUPERPOWER):
             assemble.append(c)
     if len(assemble) > 0:
         instruction_text = "Would you like to put a Super Power from the line up under your persona?"
         result = effects.may_choose_one_of(instruction_text, player,
                                            assemble, ai_hint.BEST)
         if result != None:
             result.pop_self()
             result.set_owner(player)
             player.under_superhero.contents.append(result)
             player.played.special_options.remove(self.action)
     return False
Exemplo n.º 13
0
    def stack_ongoing(self, player):
        destroyed_a_card = False
        if len(player.discard.contents) > 0:
            instruction_text = "Stack Ongoing: You may destroy a card in your discard pile.\n(If you do not, you will discard a card)."
            result = effects.may_choose_one_of(instruction_text, player,
                                               player.discard.contents,
                                               ai_hint.IFBAD)
            if result != None:
                result.destroy(player)
                destroyed_a_card = True

        if not destroyed_a_card:
            if len(player.hand.contents) > 0:
                result = effects.choose_one_of(
                    "Stack Ongoing: Discard a card.", player,
                    player.hand.contents, ai_hint.WORST)
                player.discard_a_card(result)
Exemplo n.º 14
0
 def ready(self):
     if self.active:
         if len(self.player.hand.contents) > 0:
             instruction_text = "You may discard a card from your hand]\n. If it's an Equipment, you may put it under your Super Hero. if it's\nnot, put a random card from under your Super Hero into your hand."
             result = effects.may_choose_one_of(instruction_text,
                                                self.player,
                                                self.player.hand.contents,
                                                ai_hint.IFBAD)
             if result != None:
                 if result.ctype_eq(cardtype.EQUIPMENT):
                     result.pop_self()
                     self.player.under_superhero.contents.append(result)
                 else:
                     if len(self.player.under_superhero.contents) > 0:
                         self.player.hand.contents.append(
                             random.choice(self.player.under_superhero.
                                           contents).pop_self())
Exemplo n.º 15
0
 def special_action_click(self, player):
     instruction_text = "You may destory one of the villains you\nhave played this turn.  If you do, draw a card and Attack::\nEach foes gains a Weakness."
     assemble = []
     for c in player.played.played_this_turn:
         if c.ctype_eq(cardtype.VILLAIN):
             assemble.append(c)
     result = effects.may_choose_one_of(instruction_text, player, assemble,
                                        ai_hint.IFBAD)
     if result != None:
         result.destroy(player)
         player.draw_card(from_card=False)
         for p in globe.boss.players:
             if p != player:
                 if effects.attack(p, self, player):
                     p.gain_a_weakness()
         self.player.played.special_options.remove(self.action)
         return True
     return False
Exemplo n.º 16
0
    def play_action(self, player):
        for c in player.discard.contents.copy():
            if c.cost == 0:
                c.pop_self()
                player.hand.contents.append(c)

        for p in globe.boss.players:
            if p != player:
                if len(player.hand.contents) > 0:
                    instruction_text = f"You may pass a card from your hand into the discard of {p.persona.name}"
                    result = effects.may_choose_one_of(instruction_text,
                                                       player,
                                                       player.hand.contents,
                                                       ai_hint.IFBAD)
                    if result != None:
                        result.pop_self()
                        result.set_owner(p)
                        p.discard.contents.append(result)

        return 0