# Coverage for thb/meta/characters/sanae.py : 63%

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

4# -- stdlib --

5 import random

6

7# -- third party --

8# -- own --

9 from thb import characters

10 from thb.actions import ttags

11 from thb.meta.common import ui_meta

12

13

14# -- code --

15

16

17@ui_meta(characters.sanae.Sanae)

18 class Sanae:

19 # Character

20 name = '东风谷早苗'

21 title = '常识满满的现人神'

22 illustrator = '小D@星の妄想乡'

23 cv = 'VV'

24

25 port_image = 'thb-portrait-sanae'

26 figure_image = 'thb-figure-sanae'

27 miss_sound_effect = 'thb-cv-sanae_miss'

28

29

30@ui_meta(characters.sanae.SanaeKOF)

31 class SanaeKOF:

32 # Character

33 name = '东风谷早苗'

34 title = '常识满满的现人神'

35 illustrator = '小D@星の妄想乡'

36 cv = 'VV'

37

38 port_image = 'thb-portrait-sanae'

39 figure_image = 'thb-figure-sanae'

40 miss_sound_effect = 'thb-cv-sanae_miss'

41

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

43

44

45@ui_meta(characters.sanae.Miracle)

46 class Miracle:

47 name = '奇迹'

48 description = '出牌阶段，你可以弃置X张牌并摸一张牌；若X为3，你可以令一名角色回复1点体力。（X为你此阶段使用奇迹的次数）'

49

50 def clickable(self):

51 return self.my_turn()

52

53 def effect_string(self, act):

54 return '|G【%s】|r发动了|G奇迹|r，弃置了%d张牌。' % (

55 act.source.ui_meta.name,

56 len(act.card.associated_cards),

57 )

58

59 def is_action_valid(self, sk, tl):

60 cards = sk.associated_cards

61

62 expected = ttags(self.me)['miracle_times'] + 1

63 if len(cards) != expected:

64 return (False, '奇迹：请选择%d张牌！' % expected)

65

66 return (True, '奇迹是存在的！')

67

68 def sound_effect(self, act):

69 return 'thb-cv-sanae_miracle'

70

71

72@ui_meta(characters.sanae.MiracleAction)

73 class MiracleAction:

74

75 def target(self, pl):

76 if not pl:

77 return (False, '奇迹：请选择1名受伤的玩家，回复一点体力（否则不发动）')

78

79 return (True, '奇迹：回复1点体力')

80

81

82@ui_meta(characters.sanae.SanaeFaith)

83 class SanaeFaith:

84 name = '信仰'

85 description = '出牌阶段限一次，你可以令至多两名其他角色各交给你一张手牌，然后你交给其各一张牌。'

86

87 def clickable(self):

88 me = self.me

89 return self.my_turn() and not ttags(me)['faith']

90

91 def effect_string(self, act):

92 return '|G【%s】|r的|G信仰|r大作战！向%s收集了信仰！' % (

93 act.source.ui_meta.name,

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

95 )

96

97 def is_action_valid(self, sk, tl):

98 cards = sk.associated_cards

99 if cards:

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

101

102 return (True, '团队需要信仰！')

103

104 def sound_effect(self, act):

105 return 'thb-cv-sanae_faith'

106

107

108@ui_meta(characters.sanae.SanaeFaithKOF)

109 class SanaeFaithKOF:

110 name = '信仰'

111 description = '|B锁定技|r，对方的出牌阶段，每当其获得牌时，你摸一张牌。'

112

113

114@ui_meta(characters.sanae.SanaeFaithKOFDrawCards)

115 class SanaeFaithKOFDrawCards:

116 def effect_string(self, act):

117 return '|G【%s】|r向牌堆收集了1点|G信仰|r。' % (

118 act.source.ui_meta.name,

119 )

120

121 def sound_effect(self, act):

122 return 'thb-cv-sanae_faith'

123

124

125@ui_meta(characters.sanae.SanaeFaithCollectCardAction)

126 class SanaeFaithCollectCardAction:

127 # choose_card meta

128 def choose_card_text(self, act, cards):

129 if act.cond(cards):

130 return (True, '信仰：交出这一张手牌，然后收回一张牌')

131 else:

132 return (False, '信仰：请交出一张手牌')

133

134

135@ui_meta(characters.sanae.SanaeFaithReturnCardAction)

136 class SanaeFaithReturnCardAction:

137 # choose_card meta

138 def choose_card_text(self, act, cards):

139 if act.cond(cards):

140 return (True, '信仰：将这一张牌返还给%s' % act.target.ui_meta.name)

141 else:

142 return (False, '信仰：选择一张牌返还给%s' % act.target.ui_meta.name)

143

144

145@ui_meta(characters.sanae.GodDescendant)

146 class GodDescendant:

147 name = '神裔'

148 description = '每当你成为群体符卡的目标后，你可以重铸一张牌并跳过此次结算。'

149

150

151@ui_meta(characters.sanae.GodDescendantAction)

152 class GodDescendantAction:

153 # choose_card

154 def choose_card_text(self, act, cards):

155 if act.cond(cards):

156 return (True, '神裔：重铸并跳过结算')

157 else:

158 return (False, '神裔：请选择要重铸的牌并跳过结算（否则不发动）')

159

160

161@ui_meta(characters.sanae.GodDescendantEffect)

162 class GodDescendantEffect:

163

164 def effect_string_before(self, act):

165 return '|G【%s】|r发动了|G神裔|r，重铸了一张牌并跳过了结算。' % (

166 act.target.ui_meta.name,

167 )

168

169 def sound_effect(self, act):

170 return random.choice([

171 'thb-cv-sanae_goddescendant1',

172 'thb-cv-sanae_goddescendant2',

173 ])