# Coverage for thb/meta/characters/seiga.py : 95%

## 95 statements 91 run 4 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 characters

8 from thb.cards.base import Skill

9 from thb.meta.common import ui_meta

10

11

12# -- code --

13@ui_meta(characters.seiga.Seiga)

14 class Seiga:

15 # Character

16 name = '霍青娥'

17 title = '僵尸别跑'

18 illustrator = '和茶'

19 cv = '小羽'

20

21 port_image = 'thb-portrait-seiga'

22 figure_image = 'thb-figure-seiga'

23 miss_sound_effect = 'thb-cv-seiga_miss'

24

25

26@ui_meta(characters.seiga.SeigaKOF)

27 class SeigaKOF:

28 # Character

29 name = '霍青娥'

30 title = '僵尸别跑'

31 illustrator = '和茶'

32 cv = '小羽'

33

34 port_image = 'thb-portrait-seiga'

35 figure_image = 'thb-figure-seiga'

36 miss_sound_effect = 'thb-cv-seiga_miss'

37

38 notes = '|RKOF修正角色'

39

40

41@ui_meta(characters.seiga.HeterodoxyHandler)

42 class HeterodoxyHandler:

43 # choose_option meta

44 choose_option_buttons = (('跳过结算', True), ('正常结算', False))

45 choose_option_prompt = '你要跳过当前的卡牌结算吗？'

46

47

48@ui_meta(characters.seiga.HeterodoxySkipAction)

49 class HeterodoxySkipAction:

50 def effect_string(self, act):

51 return '|G【%s】|r跳过了卡牌效果的结算' % (

52 act.source.ui_meta.name,

53 )

54

55

56@ui_meta(characters.seiga.HeterodoxyAction)

57 class HeterodoxyAction:

58 def ray(self, act):

59 return [(act.source, act.target_list[0])]

60

61

62@ui_meta(characters.seiga.Heterodoxy)

63 class Heterodoxy:

64 # Skill

65 name = '邪仙'

66 description = (

67 '出牌阶段，你可以将一张手牌以一名其他角色的身份使用。\n'

68 '|B|R>> |r以此法使用|G弹幕|r消耗你的干劲。\n'

69 '|B|R>> |r你成为此法使用的群体符卡的目标后，可以跳过此次结算。'

70 )

71 custom_ray = True

72

73 def clickable(self):

74 if not self.my_turn(): return False

75 me = self.me

76 return bool(me.cards or me.showncards or me.equips)

77

78 def effect_string(self, act):

79 return '|G【%s】|r发动了邪仙技能，以|G【%s】|r的身份使用了卡牌' % (

80 act.source.ui_meta.name,

81 act.target.ui_meta.name,

82 )

83

84 def is_action_valid(self, sk, tl):

85 acards = sk.associated_cards

86 if (not acards) or len(acards) != 1:

87 return (False, '请选择一张手牌')

88

89 card = acards[0]

90

91 if card.resides_in.type not in ('cards', 'showncards'):

92 return (False, '请选择一张手牌!')

93

94 if card.is_card(Skill): 94 ↛ 95 line 94 didn't jump to line 95, because the condition on line 94 was never true

95 return (False, '你不可以像这样组合技能')

96

97 if not getattr(card, 'associated_action', None):

98 return (False, '请的选择可以主动发动的卡牌！')

99

100 if not tl:

101 return (False, '请选择一名玩家作为卡牌发起者')

102

103 victim = tl[0]

104 _tl, valid = card.target(victim, tl[1:])

105 return card.ui_meta.is_action_valid([card], _tl)

106

107 # can't reach here

108 # return (True, u'僵尸什么的最萌了！')

109 # orig

110

111 def sound_effect(self, act):

112 return 'thb-cv-seiga_heterodoxy'

113

114

115@ui_meta(characters.seiga.Summon)

116 class Summon:

117 # Skill

118 name = '通灵'

119 description = '|B限定技|r，你的回合内，当有角色被击坠时，你可以获得其一个技能。（不包括限定技，觉醒技）'

120

121

122@ui_meta(characters.seiga.SummonAction)

123 class SummonAction:

124 # choose_option meta

125 choose_option_prompt = '请选择想要获得的技能：'

126

127 def choose_option_buttons(self, act):

128 return [

129 (s.ui_meta.name, n)

130 for n, s in act.mapping.items()

131 ]

132

133 def ray(self, act):

134 return [(act.source, act.target)]

135

136 def effect_string(self, act):

137 return '|G【%s】|r发动了|G通灵|r，获得了|G【%s】|r的|G%s|r技能。' % (

138 act.source.ui_meta.name,

139 act.target.ui_meta.name,

140 act.choice.ui_meta.name,

141 )

142

143

144@ui_meta(characters.seiga.SummonHandler)

145 class SummonHandler:

146 # choose_option meta

147 choose_option_buttons = (('发动', True), ('不发动', False))

148 choose_option_prompt = '你要发动【通灵】吗？'

149

150

151@ui_meta(characters.seiga.SummonKOF)

152 class SummonKOF:

153 # Skill

154 name = '通灵'

155 description = (

156 '你可以将击坠角色的角色牌加入你的备选角色；出牌阶段，你可以和你的备选角色交换角色牌，然后结束出牌阶段。\n'

157 '|B|R>> |r你的体力值保留，体力上限会调整到与新角色一致。'

158 )

159

160 def clickable(self):

161 return self.my_turn()

162

163 def is_action_valid(self, sk, tl):

164 g = self.game

165 me = self.me

166 cl = sk.associated_cards

167 if len(cl) != 0:

168 return False, '请不要选择牌'

169

170 rest = '、'.join([c.char_cls.ui_meta.name for c in g.chosen[me.player]])

171 return True, f'通灵：后备角色：{rest}'

172

173 def effect_string(self, act):

174 return '|G【%s】|r发动了|G通灵|r！' % (

175 act.source.ui_meta.name,

176 )

177

178

179@ui_meta(characters.seiga.SummonKOFAction)

180 class SummonKOFAction:

181

182 def effect_string(self, act):

183 old, new = act.transition

184 return '|G【%s】|r召唤了|G【%s】|r，自己退居幕后！' % (

185 old.ui_meta.name,

186 new.ui_meta.name,

187 )

188

189

190@ui_meta(characters.seiga.SummonKOFCollect)

191 class SummonKOFCollect:

192

193 def effect_string_before(self, act):

194 src, tgt = act.source, act.target

195 return '|G【%s】|r把|G【%s】|r做成了僵尸宠物！' % (

196 src.ui_meta.name,

197 tgt.ui_meta.name,

198 )