# Coverage for thb/meta/characters/kanako.py : 65%

## 87 statements 55 run 32 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# -- third party --

5# -- own --

6 from thb import actions, characters

7 from thb.meta.common import ui_meta

8

9

10# -- code --

11

12

13@ui_meta(characters.kanako.Kanako)

14 class Kanako:

15 # Character

16 name = '八坂神奈子'

17 title = '山丘与湖泊的化身'

18 illustrator = '和茶'

19 cv = '北斗夜/VV'

20

21 port_image = 'thb-portrait-kanako'

22 figure_image = 'thb-figure-kanako'

23 miss_sound_effect = 'thb-cv-kanako_miss'

24

25 notes = '|RKOF模式不可用|r'

26

27

28@ui_meta(characters.kanako.KanakoKOF)

29 class KanakoKOF:

30 # Character

31 name = '八坂神奈子'

32 title = '山丘与湖泊的化身'

33 illustrator = '和茶'

34 cv = '北斗夜/VV'

35

36 port_image = 'thb-portrait-kanako'

37 figure_image = 'thb-figure-kanako'

38 miss_sound_effect = 'thb-cv-kanako_miss'

39

40 notes = '|RKOF修正角色|r'

41

42

43@ui_meta(characters.kanako.KanakoFaith)

44 class KanakoFaith:

45 # Skill

46 name = '信仰'

47 description = (

48 '|B限定技|r，出牌阶段，你可以令你攻击范围内的所有其他角色依次选择一项：\n'

49 '|B|R>> |r令你摸一张牌。\n'

50 '|B|R>> |r弃置你一张牌，然后你视为对其使用了一张|G弹幕|r或|G弹幕战|r（按此法使用的弹幕不消耗干劲）。'

51 )

52

53 def clickable(self):

54 g = self.game

55 me = self.me

56 if me.tags['kanako_faith']:

57 return False

58

59 try:

60 act = g.action_stack[-1]

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

62 return True

63

64 except IndexError:

65 pass

66

67 return False

68

69 def is_action_valid(self, sk, tl):

70 cl = sk.associated_cards

71 if cl:

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

73

74 if not tl:

75 return (False, '没有符合条件的角色')

76 else:

77 return (True, '发动【信仰】')

78

79 def effect_string(self, act):

80 return '|G【%s】|r打开神社大门，开始收集|G信仰|r！%s表示很感兴趣。' % (

81 act.source.ui_meta.name,

82 '、'.join(['|G【%s】|r' % p.ui_meta.name for p in act.target_list]),

83 )

84

85 def sound_effect(self, act):

86 return 'thb-cv-kanako_faith'

87

88

89@ui_meta(characters.kanako.KanakoFaithCheers)

90 class KanakoFaithCheers:

91 def effect_string_before(self, act):

92 return '|G【%s】|r献上了信仰！' % (

93 act.source.ui_meta.name,

94 )

95

96

97@ui_meta(characters.kanako.KanakoFaithCounteract)

98 class KanakoFaithCounteract:

99 def effect_string_before(self, act):

100 return '|G【%s】|r决定要拆台！' % (

101 act.source.ui_meta.name,

102 )

103

104

105@ui_meta(characters.kanako.KanakoFaithCounteractPart1)

106 class KanakoFaithCounteractPart1:

107 def effect_string(self, act):

108 return '|G【%s】|r弃置了|G【%s】|r的%s。' % (

109 act.source.ui_meta.name,

110 act.target.ui_meta.name,

111 self.card_desc(act.card),

112 )

113

114

115@ui_meta(characters.kanako.KanakoFaithCounteractPart2)

116 class KanakoFaithCounteractPart2:

117 # choose_option meta

118 choose_option_buttons = (('弹幕战', 'duel'), ('弹幕', 'attack'))

119 choose_option_prompt = '信仰：请选择希望的效果'

120

121

122@ui_meta(characters.kanako.KanakoFaithEffect)

123 class KanakoFaithEffect:

124 # choose_option meta

125 choose_option_buttons = (('弃置对方的牌', 'drop'), ('对方摸牌', 'draw'))

126 choose_option_prompt = '信仰：请选择希望的效果'

127

128

129@ui_meta(characters.kanako.Virtue)

130 class Virtue:

131 # Skill

132 name = '神德'

133 description = '摸牌阶段，你可以放弃摸牌，改为令一名其他角色摸两张牌，然后其须展示并交给你一张牌，若交给你的牌为红桃牌，你摸一张牌。'

134

135

136@ui_meta(characters.kanako.VirtueHandler)

137 class VirtueHandler:

138 def target(self, pl):

139 if not pl:

140 return (False, '神德：请选择1名玩家')

141

142 return (True, '神德：放弃摸牌，选定的目标摸2张牌')

143

144

145@ui_meta(characters.kanako.VirtueAction)

146 class VirtueAction:

147 def choose_card_text(self, act, cards):

148 prompt = '神德：交给对方一张牌'

149 return act.cond(cards), prompt

150

151 def effect_string_before(self, act):

152 return '|G【%s】|r对|G【%s】|r发动了|G神德|r。' % (

153 act.source.ui_meta.name,

154 act.target.ui_meta.name,

155 )

156

157 def effect_string(self, act):

158 return '|G【%s】|r归还了%s。' % (

159 act.target.ui_meta.name,

160 self.card_desc(act.card_shadow),

161 )

162

163 def sound_effect(self, act):

164 return 'thb-cv-kanako_virtue'

165

166

167@ui_meta(characters.kanako.KanakoFaithKOF)

168 class KanakoFaithKOF:

169 # Skill

170 name = '信仰'

171 description = (

172 '|B锁定技|r，结束阶段开始时，若你满足以下条件之一，将你的手牌补至X张（X为你的当前体力值）：\n'

173 '|B|R>> |r你的体力值大于对方。\n'

174 '|B|R>> |r你曾于出牌阶段对对方造成过伤害。'

175

176 )

177

178

179@ui_meta(characters.kanako.KanakoFaithKOFAction)

180 class KanakoFaithKOFAction:

181 def effect_string_before(self, act):

182 return '|G【%s】|r又收到的%s张香火钱，比博丽神社不知道高到哪里去了！' % (

183 act.target.ui_meta.name,

184 act.amount,

185 )

186

187 def sound_effect(self, act):

188 return 'thb-cv-kanako_faith'