Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# -*- coding: utf-8 -*- 

2from __future__ import annotations 

3 

4# -- stdlib -- 

5# -- third party -- 

6# -- own -- 

7from thb.actions import DrawCards, UserAction, ttags 

8from thb.cards.base import Skill 

9from thb.cards.classes import t_Self 

10from thb.characters.base import Character, register_character_to 

11 

12 

13# -- code -- 

14class FindAction(UserAction): 

15 def apply_action(self): 

16 g = self.game 

17 cards = self.associated_card.associated_cards 

18 n = len(cards) 

19 # card will be dropped at LaunchCard 

20 # g.process_action(DropCards(tgt, tgt, cards)) 

21 tgt = self.target 

22 g.process_action(DrawCards(tgt, n)) 

23 ttags(tgt)['find'] = True 

24 return True 

25 

26 def is_valid(self): 

27 try: 

28 p = self.target 

29 if ttags(p)['find']: 

30 return False 

31 

32 g = self.game 

33 cards = self.associated_card.associated_cards 

34 if not 0 < len(cards) <= len([i for i in g.players if not i.dead]): 

35 return False 

36 

37 return True 

38 

39 except AttributeError: # well, some cards are skill? 

40 return False 

41 

42 

43class Find(Skill): 

44 associated_action = FindAction 

45 skill_category = ['character', 'active'] 

46 target = t_Self() 

47 usage = 'drop' 

48 

49 def check(self): 

50 cl = self.associated_cards 

51 return cl and all( 

52 c.resides_in is not None and 

53 c.resides_in.type in ( 

54 'cards', 'showncards', 'equips' 

55 ) for c in self.associated_cards 

56 ) 

57 

58 

59@register_character_to('common') 

60class Koakuma(Character): 

61 skills = [Find] 

62 maxlife = 4