# Coverage for thb/meta/characters/koakuma.py : 44%

## 38 statements 19 run 19 missing 0 excluded 0 partial

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 -*-

2 from __future__ import annotations

3

4# -- stdlib --

5# -- third party --

6# -- own --

7 from thb import characters

8 from thb.actions import ttags

9 from thb.meta.common import ui_meta

10

11

12# -- code --

13@ui_meta(characters.koakuma.Koakuma)

14 class Koakuma:

15 # Character

16 name = '小恶魔'

17 title = '图书管理员'

18 illustrator = '渚FUN/Takibi'

19 cv = 'VV'

20

21 port_image = 'thb-portrait-koakuma'

22 figure_image = 'thb-figure-koakuma'

23 miss_sound_effect = 'thb-cv-koakuma_miss'

24

25

26@ui_meta(characters.koakuma.Find)

27 class Find:

28 # Skill

29 name = '寻找'

30 description = '出牌阶段限一次，你可以弃置至多X张牌，然后摸等量的牌。（X为场上存活角色数）'

31

32 def clickable(self):

33 me = self.me

34 if ttags(me)['find']:

35 return False

36

37 if self.my_turn() and (me.cards or me.showncards or me.equips):

38 return True

39

40 return False

41

42 def is_action_valid(self, sk, tl):

43 g = self.game

44 assert sk.is_card(characters.koakuma.Find)

45 n = len([i for i in g.players if not i.dead])

46

47 if not 0 < len(sk.associated_cards) <= n:

48 return (False, '请选择需要换掉的牌（至多%s张）！' % n)

49

50 if not [self.me] == tl:

51 return (False, 'BUG!!')

52

53 return (True, '换掉这些牌')

54

55 def effect_string(self, act):

56 # for LaunchCard.ui_meta.effect_string

57 source = act.source

58 card = act.card

59 s = '|G【%s】|r发动了寻找技能，换掉了%d张牌。' % (

60 source.ui_meta.name,

61 len(card.associated_cards),

62 )

63 return s

64

65 def sound_effect(self, act):

66 return 'thb-cv-koakuma_find'