# Coverage for thb/meta/characters/yukari.py : 97%

## 42 statements 40 run 2 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

3# -- stdlib --

4 import random

5

6# -- third party --

7# -- own --

8 from thb import actions, characters

9 from thb.meta.common import ui_meta

10

11# -- code --

12

13

14@ui_meta(characters.yukari.SpiritingAway)

15 class SpiritingAway:

16 # Skill

17 name = '神隐'

18 description = '出牌阶段限两次，你可以将场上的一张牌暂时移出游戏。你可以观看以此法移出游戏的牌。任何角色被紫暂时移出的牌，会在紫的结束阶段后归还回该角色的手牌中。'

19

20 def clickable(self):

21 g = self.game

22 me = self.me

23 if me.tags['spirit_away_tag'] >= 2: return False

24 try:

25 act = g.action_stack[-1]

26 if isinstance(act, actions.ActionStage) and act.target is me:

27 return True

28 except IndexError:

29 pass

30 return False

31

32 def is_action_valid(self, sk, tl):

33 cl = sk.associated_cards

34 if cl:

35 return (False, '请不要选择牌')

36

37 if not tl:

38 return (False, '请选择一名玩家')

39

40 tgt = tl[0]

41 catnames = ['cards', 'showncards', 'equips', 'fatetell']

42 if not any(getattr(tgt, i) for i in catnames):

43 return (False, '这货已经没有牌了')

44

45 return (True, '发动【神隐】')

46

47

48@ui_meta(characters.yukari.SpiritingAwayAction)

49 class SpiritingAwayAction:

50

51 def effect_string(self, act):

52 words = (

53 '17岁就是17岁，后面没有零几个月！',

54 '叫紫妹就对了，紫妈算什么！',

55 )

56 # return u'|G【{source}】|r：“{word}”（|G{target}|r的{card}不见了）'.format(

57 return '|G【{source}】|r：“{word}”（|G{target}|r的一张牌不见了）'.format(

58 source=act.source.ui_meta.name,

59 target=act.target.ui_meta.name,

60 word=random.choice(words),

61 # card=card_desc(act.card),

62 )

63

64 def sound_effect(self, act):

65 return random.choice([

66 'thb-cv-yukari_spiritaway1',

67 'thb-cv-yukari_spiritaway2',

68 ])

69

70

71@ui_meta(characters.yukari.Yukari)

72 class Yukari:

73 # Character

74 name = '八云紫'

75 title = '永远17岁'

76 illustrator = 'Vivicat@幻想梦斗符'

77 cv = 'VV'

78

79 port_image = 'thb-portrait-yukari'

80 figure_image = 'thb-figure-yukari'

81 miss_sound_effect = 'thb-cv-yukari_miss'