Exemplo n.º 1
0
	def special_action_click(self,player):
		#We must ensure that we are doing this on our turn
		if player.pid == globe.boss.whose_turn:
			for c in self.player.hand.contents:
				if c.name == "Punch" and self.action in self.player.played.special_options:
					self.player.discard_a_card(c)

					assemble = []
					for i in range(3):
						to_add = player.reveal_card(public = False)
						if to_add != None:
							assemble.append(to_add)
							player.deck.contents.pop()

					equipment_assemble = []
					for c in assemble:
						if c.ctype_eq(cardtype.EQUIPMENT):
							equipment_assemble.append(c)
					effects.reveal(f"These were the top 3 cards on {player.persona.name}'s deck",player,assemble)
					if len(equipment_assemble) > 0:
						result = effects.choose_one_of("Choose one of these to draw.",player,assemble,ai_hint.BEST)
						#must be there to be drawn
						player.deck.contents.append(result)
						player.draw_card(from_card = False)
						assemble.remove(result)
					total_times = len(assemble)
					while len(assemble) > 0:
						result = effects.choose_one_of(f"Place card back on top of your deck ({total_times - len(assemble) + 1}/{total_times})?",player,assemble,ai_hint.WORST)
						assemble.remove(result)
						player.deck.contents.append(result)

					self.player.played.special_options.remove(self.action)
					return True
		return False
Exemplo n.º 2
0
    def play_action(self, player):
        player.played.plus_power(2)
        assemble = []
        for i in range(2):
            to_add = player.reveal_card(public=False)
            if to_add != None:
                assemble.append(to_add)
                player.deck.contents.pop()
        if len(assemble) > 0:
            result = effects.choose_however_many(
                "Choose any number to discard", player, assemble,
                ai_hint.IFBAD)
            if result != None:
                for c in result:
                    player.deck.contents.append(c)
                    player.discard_a_card(c)
                    assemble.remove(c)

        total_times = len(assemble)
        while len(assemble) > 0:
            result = effects.choose_one_of(
                f"Place card back on top of your deck ({total_times - len(assemble) + 1}/{total_times})?",
                player, assemble, ai_hint.WORST)
            assemble.remove(result)
            player.deck.contents.append(result)
        return 0
Exemplo n.º 3
0
    def play_action(self, player):
        player.played.plus_power(3)
        assemble_names = set()
        assemble = []
        grand_assemble = []
        for p in globe.boss.players:
            if p != player:
                grand_assemble.extend(p.deck.contents)
                grand_assemble.extend(p.under_superhero.contents)
                grand_assemble.extend(p.over_superhero.contents)
                grand_assemble.extend(p.discard.contents)
                grand_assemble.extend(p.hand.contents)
        for c in grand_assemble:
            if not c.name in assemble_names:
                assemble_names.add(c.name)
                assemble.append(c)
        chosen_name = ""
        if len(assemble) > 0:
            result = effects.choose_one_of(
                "Choose a card name.\nThen choose a foe and gain a card with that name\nfrom under their Super Hero.",
                player, assemble, ai_hint.RANDOM)
            chosen_name = result.name

        instruction_text = f"Choose a player that you think has a {chosen_name}\nunder their super hero that you can gain."
        result = effects.choose_a_player(instruction_text,
                                         player,
                                         includes_self=False,
                                         hint=ai_hint.BEST)
        for c in result.under_superhero.contents:
            if c.name == chosen_name:
                player.gain(c)
                #dont want to get multiple
                return 0
        return 0
Exemplo n.º 4
0
    def first_apearance(self):
        for p in globe.boss.players:
            if effects.attack(p, self):
                top_cards = []
                for i in range(2):
                    next_card = p.reveal_card(public=False)
                    if next_card != None:
                        next_card.pop_self()
                        top_cards.append(next_card)
                if len(top_cards) > 0:
                    effects.reveal("There were what {} drew.", p, top_cards)
                    to_left = None
                    if p.pid + 1 == len(globe.boss.players):
                        to_left = globe.boss.players[0]
                    else:
                        to_left = globe.boss.players[p.pid + 1]

                    instruction_text = f"Choose one to put under your Super Hero,\nthe other will go under {to_left.persona.name}'s Super Hero."
                    result = effects.choose_one_of(instruction_text, p,
                                                   top_cards, ai_hint.BEST)
                    p.under_superhero.contents.append(result)
                    top_cards.remove(result)
                if len(top_cards) > 0:
                    result = top_cards[0]
                    result.set_owner(to_left)
                    to_left.under_superhero.contents.append(result)
        return
Exemplo n.º 5
0
 def attack_action(self, by_player):
     did_not_reveal_costly_card = False
     for p in globe.boss.players:
         if p != by_player and effects.attack(p, self, by_player):
             if len(p.hand.contents) > 0:
                 instruction_text = f"Reveal a card to put under your Super Hero.\nIf one or more foes does not reveal a card with cost 1 or\ngreater, {by_player.persona.name} will draw two cards."
                 result = effects.choose_one_of(instruction_text, p,
                                                p.hand.contents,
                                                ai_hint.WORST)
                 if not result.cost >= 1:
                     did_not_reveal_costly_card = True
                 effects.reveal(
                     f"This {result.name} will be under {p.persona.name}'s super hero",
                     p, [result])
                 result.pop_self()
                 p.under_superhero.contents.append(result)
             else:
                 did_not_reveal_costly_card = True
         #This is a rulebook specific ruling.  I had guessed that avoiding that attack did
         #not count towards not revealing a costly card, but the rulebook says it does
         else:
             did_not_reveal_costly_card = True
     if did_not_reveal_costly_card:
         by_player.draw_card(2)
     return
Exemplo n.º 6
0
 def first_apearance(self):
     for p in globe.boss.players:
         if effects.attack(p, self):
             revealed = []
             for i in range(5):
                 to_reveal = p.reveal_card(public=False)
                 if to_reveal != None:
                     revealed.append(to_reveal)
                     to_reveal.pop_self()
             effects.reveal(
                 f"These were on the top of {p.persona.name}'s deck.", p,
                 revealed)
             for c in revealed.copy():
                 if c.cost >= 1:
                     #put back into deck so that it is  discarded from a place
                     p.deck.contents.append(c)
                     p.discard_a_card(c)
                     revealed.remove(c)
             while len(revealed) > 0:
                 result = effects.choose_one_of(
                     "Put cards back on top of your deck", p, revealed,
                     ai_hint.WORST)
                 p.deck.contents.append(result)
                 revealed.remove(result)
     return
Exemplo n.º 7
0
 def play_action(self, player):
     player.draw_card(4)
     for i in range(2):
         instruction_text = f"Discard a card. ({i+1}/2)"
         result = effects.choose_one_of(instruction_text, player,
                                        player.hand.contents, ai_hint.WORST)
         player.discard_a_card(result)
     return 0
Exemplo n.º 8
0
 def play_action(self, player):
     drawn_cards = player.draw_card(3)
     if len(drawn_cards) > 0:
         instruction_text = "Put one of there under your super hero."
         result = effects.choose_one_of(instruction_text, player,
                                        drawn_cards, ai_hint.WORST)
         result.pop_self()
         player.under_superhero.contents.append(result)
     return 0
Exemplo n.º 9
0
    def play_action(self, player):
        player.played.plus_power(2)
        assemble_names = set()
        assemble = []
        grand_assemble = []
        grand_assemble.extend(player.deck.contents)
        grand_assemble.extend(player.under_superhero.contents)
        grand_assemble.extend(player.over_superhero.contents)
        grand_assemble.extend(player.discard.contents)
        grand_assemble.extend(player.hand.contents)
        grand_assemble.extend(player.played.contents)
        for c in grand_assemble:
            if not c.name in assemble_names:
                assemble_names.add(c.name)
                assemble.append(c)
        chosen_name = ""
        if len(assemble) > 0:
            result = effects.choose_one_of(
                "Choose a card name.\nReveal the top three cards of your deck\nand put any cards with that name into\nyour hand.",
                player, assemble, ai_hint.RANDOM)
            chosen_name = result.name

        revealed = []
        for i in range(3):
            revealing = player.reveal_card(public=False)
            if revealing != None:
                revealing.pop_self()
                revealed.append(revealing)
        if len(revealed) > 0:
            effects.reveal(
                f"These were on top of {player.persona.name}'s deck", player,
                revealed)
        for c in revealed.copy():
            if c.name == chosen_name:
                player.hand.contents.append(c)
                revealed.remove(c)
        while len(revealed) > 0:
            result = effects.choose_one_of(
                "Put one of the revealed cards on top of your deck", player,
                revealed, ai_hint.WORST)
            player.deck.contents.append(result)
            revealed.remove(result)
        return 0
Exemplo n.º 10
0
 def defend(self, attacker=None, defender=None):
     self.owner.discard_a_card(self)
     self.owner.draw_card(3)
     for i in range(2):
         instruction_text = f"Choose a card to put on top your deck ({i+1}/2)."
         if len(self.owner.hand.contents) > 0:
             result = effects.choose_one_of(instruction_text, self.owner,
                                            self.owner.hand.contents,
                                            ai_hint.WORST)
             result.pop_self()
             self.owner.deck.contents.append(result)
     return
Exemplo n.º 11
0
 def play_action(self, player):
     assemble = []
     for c in player.played.contents:
         if c.cost <= 6 and c != self:
             assemble.append(c)
     if len(assemble) > 0:
         result = effects.choose_one_of(
             "Choose a card to have in your hand next turn.", player,
             assemble, ai_hint.BEST)
         self.played_by = player
         self.card_choosen = result
     return 0
Exemplo n.º 12
0
 def first_apearance(self):
     for p in globe.boss.players:
         if effects.attack(p, self):
             #effects.reveal(f"This was {p.persona.name}'s hand",p,p.hand.contents)
             num_heros = p.hand.get_count(cardtype.VILLAIN)
             for i in range(num_heros):
                 instruction_text = f"You had {num_heros} heros in you hand.  Choose a card to discard ({i+1}/{num_heros})"
                 if p.hand.size() > 0:
                     choose = effects.choose_one_of(instruction_text, p,
                                                    p.hand.contents,
                                                    ai_hint.WORST)
                     p.discard_a_card(choose)
     return
Exemplo n.º 13
0
 def first_apearance(self):
     for p in globe.boss.players:
         if effects.attack(p, self):
             assemble = []
             for c in p.hand.contents:
                 if c.cost >= 3:
                     assemble.append(c)
             if len(assemble) > 0:
                 result = effects.choose_one_of(
                     "Choose a card with cost 3 or greater to discard", p,
                     assemble, ai_hint.WORST)
                 p.discard_a_card(result)
     return
Exemplo n.º 14
0
 def attack_action(self, by_player):
     p = effects.choose_a_player(
         "Choose a player.\nYou will put a card from under their Super Hero, under your Super Hero",
         by_player,
         includes_self=False,
         hint=ai_hint.BEST)
     if effects.attack(p, self, by_player):
         if len(p.under_superhero.contents) > 0:
             result = effects.choose_one_of(
                 f"Put one of these cards from {p.persona.name} under your Super Hero.",
                 by_player, p.under_superhero.contents, ai_hint.BEST)
             result.pop_self()
             result.set_owner(by_player)
             by_player.under_superhero.contents.append(result)
Exemplo n.º 15
0
 def attack_action(self, by_player):
     p = effects.choose_a_player(
         "Choose a player.\nYou will destory a card under that players Super Hero.",
         by_player,
         includes_self=False,
         hint=ai_hint.BEST)
     if effects.attack(p, self, by_player):
         if len(p.under_superhero.contents) > 0:
             result = effects.choose_one_of(
                 f"Choose a card to destory from uder {p.persona.name}'s Superhero",
                 by_player, p.under_superhero.contents, ai_hint.BEST)
             result.destroy(p)
         self.pop_self()
         by_player.under_superhero.contents.append(self)
Exemplo n.º 16
0
    def first_apearance(self):
        for p in globe.boss.players:
            if effects.attack(p, self):
                assemble = []
                for c in p.discard.contents:
                    if c.cost >= 1:
                        assemble.append(c)
                if len(assemble) > 0:
                    instruction_text = "Destory a card with cost 1 or greater in your discard pile (1/2)."
                    result = effects.choose_one_of(instruction_text, p,
                                                   assemble, ai_hint.WORST)
                    result.destroy(p)
                    assemble = []
                    for c in p.discard.contents:
                        #two different cards?
                        if c.cost >= 1 and c.name != result.name:
                            assemble.append(c)
                    if len(assemble) > 0:
                        instruction_text = "Destory a card with cost 1 or greater in your discard pile (2/2)."
                        result = effects.choose_one_of(instruction_text, p,
                                                       assemble, ai_hint.WORST)
                        result.destroy(p)

        return
Exemplo n.º 17
0
 def first_apearance(self):
     for p in globe.boss.players:
         #Do i still want to trigger the attack function that may trigger other things?
         #if effects.attack(p,self):
         destroyed_types = set()
         for i in range(6):
             assemble = []
             for c in p.under_superhero.contents:
                 #If there are overlaps, this card cant be included
                 if len(destroyed_types.intersection(set(
                         c.get_ctype()))) == 0:
                     assemble.append(c)
             if len(assemble) > 0:
                 instruction_text = f"Destroy six cards with different\ncard types under your Super Hero. ({i+1}/6)"
                 result = effects.choose_one_of(instruction_text, p,
                                                assemble, ai_hint.WORST)
                 result.destroy(p)
             elif len(p.hand.contents) > 0:
                 instruction_text = f"Discard a card because you ran out of\nvalid cards to destroy under your super hero. ({i+1}/6)"
                 result = effects.choose_one_of(instruction_text, p,
                                                p.hand.contents,
                                                ai_hint.WORST)
                 p.discard_a_card(result)
     return
Exemplo n.º 18
0
 def play_action(self, player):
     instruction_text = "Choose a player to gain a card from under their Super Hero"
     result = effects.choose_a_player(instruction_text,
                                      player,
                                      includes_self=True,
                                      hint=ai_hint.RANDOM)
     if len(result.under_superhero.contents) > 0:
         instruction_text = f"Gain a card from under {result.persona.name}'s Super Hero"
         result = effects.choose_one_of(instruction_text, player,
                                        result.under_superhero.contents,
                                        ai_hint.BEST)
         player.gain(result)
         result.pop_self()
         player.hand.contents.append(result)
     return 0
Exemplo n.º 19
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.º 20
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].defence) \
				or (trigger.test(not immediate,\
						trigger.AVOIDED_ATTACK, \
						self.trigger, \
						player,ttype,active)):
			if globe.DEBUG:
				print("active",self.name,flush=True)
			player.draw_card(from_card = False)
			result = effects.choose_one_of("Discard a card",player,player.hand.contents,ai_hint.WORST)
			player.discard_a_card(result)
Exemplo n.º 21
0
    def ready(self):
        if self.active:
            if len(self.player.under_superhero.contents) >= 4:
                self.player.played.plus_power(2)
                if len(self.player.under_superhero.contents) > 4:
                    for i in range(4):
                        instruction_text = f"Choose a card to destroy from under your super hero ({i+1}/4)"
                        result = effects.choose_one_of(
                            instruction_text, self.player,
                            self.player.under_superhero.contents)
                        result.destroy(self.player)
                else:
                    for c in self.player.under_superhero.contents.copy():
                        c.destroy(self.player)

            self.action = actions.special_action("Roy Harper",
                                                 self.special_action_click)
            self.player.played.special_options.append(self.action)
Exemplo n.º 22
0
 def first_apearance(self):
     for p in globe.boss.players:
         if effects.attack(p, self):
             highest_costs = []
             cost = -1
             for c in p.hand.contents:
                 if c.cost > cost:
                     cost = c.cost
                     highest_costs = [c]
                 elif c.cost == cost:
                     highest_costs.append(c)
             #Hand is not empty
             if len(highest_costs) > 1:
                 instruction_text = "Choose a highest cost to put under your Super Hero."
                 result = effects.choose_one_of(instruction_text, p,
                                                highest_costs,
                                                ai_hint.WORST)
                 result.pop_self()
                 p.under_superhero.contents.append(result)
     return
Exemplo n.º 23
0
 def first_apearance(self):
     for p in globe.boss.players:
         if effects.attack(p, self):
             top_card = globe.boss.main_deck.draw()
             effects.reveal(
                 f"This will be under {p.persona.name}'s Super Hero.", p,
                 [top_card])
             top_card.set_owner(p)
             p.under_superhero.contents.append(top_card)
             if not top_card.ctype_eq(cardtype.VILLAIN):
                 assemble = []
                 for c in p.hand.contents:
                     if c.cost <= 3:
                         assemble.append(c)
                 for c in p.discard.contents:
                     if c.cost <= 3:
                         assemble.append(c)
                 if len(assemble) > 0:
                     result = effects.choose_one_of(
                         "Choose a card with cost 3 or less to discard.", p,
                         assemble, ai_hint.WORST)
                     result.destroy(p)
     return