# Coverage for thb/meta/characters/eirin.py : 96%

## 70 statements 67 run 3 missing 0 excluded 1 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 actions, characters

8 from thb.meta.common import ui_meta

9

10

11# -- code --

12@ui_meta(characters.eirin.SkySilk)

13 class SkySilk:

14 # Skill

15 name = '天丝'

16 description = (

17 '出牌阶段限一次，你可以弃置一名角色的一张牌，并令其选择一项：\n'

18 '|B|R>> |r回复1点体力。\n'

19 '|B|R>> |r展示牌堆底的3张牌，获得其中的非基本牌，并弃置其他的牌。'

20 )

21

22 def clickable(self):

23 me = self.me

24 if not self.my_turn() or actions.ttags(me)['sky_silk']:

25 return False

26

27 return True

28

29 def is_action_valid(g, sk, tl):

30 cl = sk.associated_cards

31 if cl:

32 return False, '请不要选择牌！'

33

34 return True, '发动「天丝」'

35

36 def effect_string(self, act):

37 # for LaunchCard.ui_meta.effect_string

38 return (

39 '|G【%s】|r对|G【%s】|r发动了「天丝」。'

40 ) % (

41 act.source.ui_meta.name,

42 act.target.ui_meta.name,

43 )

44

45 def sound_effect(self, act):

46 return 'thb-cv-eirin_medic'

47

48

49@ui_meta(characters.eirin.SkySilkAction)

50 class SkySilkAction:

51 # choose_option

52 choose_option_buttons = (('回复', 'heal'), ('摸牌', 'draw'))

53 choose_option_prompt = '选择你要发动的效果'

54

55

56@ui_meta(characters.eirin.LunaString)

57 class LunaString:

58 name = '月弦'

59 description = '你可以将一张手牌置于牌堆顶或牌堆底底，视为使用或打出了一张|G弹幕|r。'

60

61 def clickable(self):

62 g = self.game

63 me = self.me

64 try:

65 act = g.hybrid_stack[-1]

66 if act.cond and act.cond([characters.eirin.LunaString(me)]):

67 return True

68

69 except (IndexError, AttributeError):

70 pass

71

72 return False

73

74 def is_complete(self, sk):

75 from thb.cards.base import VirtualCard

76

77 acards = sk.associated_cards

78 if len(acards) != 1:

79 return False, '请选择一张手牌'

80

81 c = acards[0]

82

83 if c.resides_in.type not in ('cards', 'showncards'):

84 return False, '请选择一张手牌'

85

86 if c.is_card(VirtualCard): 86 ↛ 87 line 86 didn't jump to line 87, because the condition on line 86 was never true

87 return False, '「月弦」不允许组合使用'

88

89 return True, '发动「月弦」'

90

91 def is_action_valid(self, sk, tl):

92 from thb.cards.classes import AttackCard

93

94 isc, t = self.is_complete(sk)

95 if not isc:

96 return isc, t

97 c = sk.associated_cards[0]

98 return AttackCard().ui_meta.is_action_valid(c, tl)

99

100

101@ui_meta(characters.eirin.LunaStringPlaceCard)

102 class LunaStringPlaceCard:

103 # choose_option

104 choose_option_buttons = (('牌堆顶↑', 'front'), ('牌堆底↓', 'back'))

105 choose_option_prompt = '你要把牌放到哪里'

106

107 def effect_string(self, act):

108 if act.direction == 'front':

109 return '阴谋！有人注意到牌堆上面的牌变了吗？'

110 else:

111 return '阴谋！有人注意到牌堆好像比原来高了一点吗？'

112

113

114@ui_meta(characters.eirin.Eirin)

115 class Eirin:

116 # Character

117 name = '八意永琳'

118 title = '伪月主谋'

119 illustrator = '渚FUN'

120 cv = 'VV'

121

122 port_image = 'thb-portrait-eirin'

123 figure_image = 'thb-figure-eirin'

124 miss_sound_effect = 'thb-cv-eirin_miss'

125

126 notes = u'|RKOF不平衡角色|r'