def decorate(g, p): from thb.cards import CardList p.cards = CardList(p, 'cards') # Cards in hand p.showncards = CardList( p, 'showncards' ) # Cards which are shown to the others, treated as 'Cards in hand' p.equips = CardList(p, 'equips') # Equipments p.fatetell = CardList(p, 'fatetell') # Cards in the Fatetell Zone p.special = CardList(p, 'special') # used on special purpose p.showncardlists = [p.showncards, p.fatetell] p.tags = defaultdict(int)
def apply_action(self): tgt = self.target src = self.source catnames = ('cards', 'showncards', 'equips', 'fatetell') cats = [getattr(tgt, i) for i in catnames] card = user_input([src], ChoosePeerCardInputlet(self, tgt, catnames)) card = card or random_choose_card(cats) if not card: return False self.card = card src.reveal(card) src.tags['spirit_away_tag'] += 1 cl = getattr(tgt, 'yukari_dimension', None) if cl is None: cl = CardList(tgt, 'yukari_dimension') tgt.yukari_dimension = cl tgt.showncardlists.append(cl) migrate_cards([card], cl) return True
def apply_action(self): tgt = self.target cl = getattr(tgt, 'momiji_sentry_cl', None) if cl is None: cl = CardList(tgt, 'momiji_sentry_cl') tgt.momiji_sentry_cl = cl tgt.showncardlists.append(cl) migrate_cards(self.cards, cl) return True
def apply_action(self): tgt = self.target cl = tgt.support_cl = CardList(tgt, 'support') with MigrateCardsTransaction(self) as trans: migrate_cards(tgt.cards, cl, unwrap=True, trans=trans) migrate_cards(tgt.showncards, cl, unwrap=True, trans=trans) migrate_cards(tgt.equips, cl, unwrap=True, trans=trans) return True
def apply_action(self): tgt = self.target lc = self.action assert isinstance(lc, ActionStageLaunchCard) cl = getattr(tgt, 'momiji_sentry_cl', None) if cl is None: cl = CardList(tgt, 'momiji_sentry_cl') tgt.momiji_sentry_cl = cl tgt.showncardlists.append(cl) migrate_cards([lc.card], cl, unwrap=True) lc.cancelled = True return True
def apply_action(self): tgt = self.target ttags(tgt)['qiliao'] = True g = Game.getgame() cl = getattr(tgt, 'meirin_qiliao', None) if cl is None: cl = CardList(tgt, 'meirin_qiliao') tgt.meirin_qiliao = cl tgt.showncardlists.append(cl) migrate_cards([self.associated_card], cl, unwrap=True) g.deck.shuffle(cl) return True
def makeGame(self): from game import autoenv from thb.thb3v3 import THBattle from thb.cards import Deck, CardList from thb.characters.eirin import FirstAid, Medic from utils import BatchList autoenv.init('Server') g = THBattle() g.IS_DEBUG = True g.random = random hook_game(g) deck = Deck() g.deck = deck g.action_stack = [autoenv.Action(None, None)] g.gr_groups = WeakSet() pl = [create_mock_player([]) for i in xrange(6)] for p in pl: p.skills = [FirstAid, Medic] p.cards = CardList(p, 'cards') # Cards in hand p.showncards = CardList( p, 'showncard' ) # Cards which are shown to the others, treated as 'Cards in hand' p.equips = CardList(p, 'equips') # Equipments p.fatetell = CardList(p, 'fatetell') # Cards in the Fatetell Zone p.faiths = CardList(p, 'faiths') # Cards in the Fatetell Zone p.special = CardList(p, 'special') # used on special purpose p.showncardlists = [p.showncards, p.fatetell] p.tags = defaultdict(int) p.dead = False p = pl[0] p.client.gdevent.set() g.players = BatchList(pl) return g, p
def build_handcard(cardcls, p=None): from thb.cards import CardList cl = CardList(p or G().me, 'cards') c = cardcls() c.move_to(cl) return c