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

## 97 statements 59 run 38 missing 2 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 from __future__ import annotations

3

4# -- stdlib --

5 from typing import TYPE_CHECKING

6

7# -- third party --

8# -- own --

9 from thb import characters

10 from thb.cards.base import Skill

11 from thb.meta.common import ui_meta

12

13# -- typing --

14 if TYPE_CHECKING:

15 from thb.thbkof import THBattleKOF # noqa: F401

16

17

18# -- code --

19@ui_meta(characters.seiga.Seiga)

20 class Seiga:

21 # Character

22 name = '霍青娥'

23 title = '僵尸别跑'

24 illustrator = '和茶'

25 cv = '小羽'

26

27 port_image = 'thb-portrait-seiga'

28 figure_image = 'thb-figure-seiga'

29 miss_sound_effect = 'thb-cv-seiga_miss'

30

31

32@ui_meta(characters.seiga.SeigaKOF)

33 class SeigaKOF:

34 # Character

35 name = '霍青娥'

36 title = '僵尸别跑'

37 illustrator = '和茶'

38 cv = '小羽'

39

40 port_image = 'thb-portrait-seiga'

41 figure_image = 'thb-figure-seiga'

42 miss_sound_effect = 'thb-cv-seiga_miss'

43

44 notes = '|RKOF修正角色'

45

46

47@ui_meta(characters.seiga.HeterodoxyHandler)

48 class HeterodoxyHandler:

49 # choose_option meta

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

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

52

53

54@ui_meta(characters.seiga.HeterodoxySkipAction)

55 class HeterodoxySkipAction:

56 def effect_string(self, act):

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

58 act.source.ui_meta.name,

59 )

60

61

62@ui_meta(characters.seiga.HeterodoxyAction)

63 class HeterodoxyAction:

64 def ray(self, act):

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

66

67

68@ui_meta(characters.seiga.Heterodoxy)

69 class Heterodoxy:

70 # Skill

71 name = '邪仙'

72 description = (

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

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

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

76 )

77 custom_ray = True

78

79 def clickable(self):

80 if not self.my_turn(): return False

81 me = self.me

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

83

84 def effect_string(self, act):

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

86 act.source.ui_meta.name,

87 act.target.ui_meta.name,

88 )

89

90 def is_action_valid(self, sk, tl):

91 acards = sk.associated_cards

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

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

94

95 card = acards[0]

96

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

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

99

100 if card.is_card(Skill):

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

102

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

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

105

106 if not tl:

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

108

109 victim = tl[0]

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

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

112

113 # can't reach here

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

115 # orig

116

117 def sound_effect(self, act):

118 return 'thb-cv-seiga_heterodoxy'

119

120

121@ui_meta(characters.seiga.Summon)

122 class Summon:

123 # Skill

124 name = '通灵'

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

126

127

128@ui_meta(characters.seiga.SummonAction)

129 class SummonAction:

130 # choose_option meta

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

132

133 def choose_option_buttons(self, act):

134 return [

135 (s.ui_meta.name, n)

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

137 ]

138

139 def ray(self, act):

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

141

142 def effect_string(self, act):

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

144 act.source.ui_meta.name,

145 act.target.ui_meta.name,

146 act.choice.ui_meta.name,

147 )

148

149

150@ui_meta(characters.seiga.SummonHandler)

151 class SummonHandler:

152 # choose_option meta

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

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

155

156

157@ui_meta(characters.seiga.SummonKOF)

158 class SummonKOF:

159 game: THBattleKOF

160

161 # Skill

162 name = '通灵'

163 description = (

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

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

166 )

167

168 def clickable(self):

169 return self.my_turn()

170

171 def is_action_valid(self, sk, tl):

172 g = self.game

173 me = self.me

174 cl = sk.associated_cards

175 if len(cl) != 0:

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

177

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

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

180

181 def effect_string(self, act):

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

183 act.source.ui_meta.name,

184 )

185

186

187@ui_meta(characters.seiga.SummonKOFAction)

188 class SummonKOFAction:

189

190 def effect_string(self, act):

191 old, new = act.transition

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

193 old.ui_meta.name,

194 new.ui_meta.name,

195 )

196

197

198@ui_meta(characters.seiga.SummonKOFCollect)

199 class SummonKOFCollect:

200

201 def effect_string_before(self, act):

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

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

204 src.ui_meta.name,

205 tgt.ui_meta.name,

206 )