# Coverage for thb/meta/characters/reimu.py : 46%

## 103 statements 49 run 54 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 import random

5

6# -- third party --

7# -- own --

8 from thb import actions, characters

9 from thb.cards.base import Card

10 from thb.cards.classes import ExinwanCard, RejectCard

11 from thb.meta.common import ui_meta

12

13

14# -- code --

15

16

17@ui_meta(characters.reimu.Flight)

18 class Flight:

19 # Skill

20 name = '飞行'

21

22

23@ui_meta(characters.reimu.SpiritualAttack)

24 class SpiritualAttack:

25 name = '灵击'

26

27 def clickable(self):

28 me = self.me

29

30 if not (me.cards or me.showncards): return False

31 return self.accept_cards([characters.reimu.SpiritualAttack(me)])

32

33 def is_complete(self, skill):

34 me = self.me

35 assert skill.is_card(characters.reimu.SpiritualAttack)

36 acards = skill.associated_cards

37 if len(acards) != 1:

38 return (False, '请选择1张手牌！')

39

40 c = acards[0]

41

42 if c.resides_in not in (me.cards, me.showncards):

43 return (False, '只能使用手牌发动！')

44 elif not c.color == Card.RED:

45 return (False, '请选择红色手牌！')

46

47 return (True, '反正这条也看不到，偷个懒~~~')

48

49 def is_action_valid(self, sk, tl):

50 return (False, '你不能主动使用灵击')

51

52 def sound_effect(self, act):

53 return 'thb-cv-reimu_sa'

54

55 def effect_string(self, act):

56 return RejectCard.ui_meta.effect_string(act)

57

58

59@ui_meta(characters.reimu.TributeTarget)

60 class TributeTarget:

61 # Skill

62 name = '纳奉'

63 description = '|BBOSS技|r，其他角色的出牌阶段限一次，若你的手牌数小于体力上限，其可以将一张手牌置入你的明牌区。'

64

65

66@ui_meta(characters.reimu.Tribute)

67 class Tribute:

68 # Skill

69 name = '赛钱'

70 description = '出牌阶段限一次，若灵梦的手牌数小于体力上限，你可以将一张手牌置入灵梦的明牌区。'

71

72 def clickable(self):

73 g = self.game

74 me = self.me

75

76 if self.limit1_skill_used('tribute_tag'):

77 return False

78

79 try:

80 act = g.action_stack[-1]

81 except IndexError:

82 return False

83

84 if isinstance(act, actions.ActionStage) and (me.cards or me.showncards or me.equips):

85 return True

86

87 return False

88

89 def is_action_valid(self, sk, tl):

90 cl = sk.associated_cards

91 if not cl: return (False, '请选择要给出的牌')

92 if len(cl) != 1: return (False, '只能选择一张手牌')

93

94 if not cl[0].resides_in.type in ('cards', 'showncards'):

95 return (False, '只能选择手牌！')

96

97 if len(tl) != 1 or not tl[0].has_skill(characters.reimu.TributeTarget):

98 return (False, '请选择一只灵梦')

99

100 if len(tl[0].cards) + len(tl[0].showncards) >= tl[0].maxlife:

101 return (False, '灵梦的赛钱箱满了')

102

103 return (True, '投进去……会发生什么呢？')

104

105 def effect_string(self, act):

106 # for LaunchCard.ui_meta.effect_string

107 return (

108 '|G【%s】|r向|G【%s】|r的赛钱箱里放了一张%s… 会发生什么呢？'

109 ) % (

110 act.source.ui_meta.name,

111 act.target.ui_meta.name,

112 self.card_desc(act.card.associated_cards[0]),

113 )

114

115 def sound_effect(self, act):

116 c = act.card.associated_cards[0]

117 if c.is_card(ExinwanCard):

118 return 'thb-cv-reimu_tribute_exinwan'

119 else:

120 return random.choice([

121 'thb-cv-reimu_tribute1',

122 'thb-cv-reimu_tribute2',

123 ])

124

125

126# ----------------------

127

128@ui_meta(characters.reimu.ReimuExterminate)

129 class ReimuExterminate:

130 # Skill

131 name = '退治'

132 description = (

133 '其他角色的回合内，你可以于以下时机无视距离对其使用一张弹幕：\n'

134 '|B|R>> |r出牌阶段，你受到伤害后。\n'

135 '|B|R>> |r回合结束阶段，且该角色本回合对其他角色造成过伤害。'

136 )

137

138

139@ui_meta(characters.reimu.ReimuExterminateAction)

140 class ReimuExterminateAction:

141 # choose_card

142 def choose_card_text(self, act, cards):

143 if act.cond(cards):

144 return (True, '代表幻想乡消灭你！')

145 else:

146 return (False, '退治：选择一张弹幕对%s使用（否则不发动）' % act.victim.ui_meta.name)

147

148

149@ui_meta(characters.reimu.ReimuExterminateLaunchCard)

150 class ReimuExterminateLaunchCard:

151 def effect_string_before(self, act):

152 if act.cause == 'damage':

153 return '|G【%s】|r： (╯‵□′)╯︵ ┻━┻ ！！！' % act.source.ui_meta.name

154 else:

155 return '听说异变的元凶是|G【%s】|r，|G【%s】|r马上就出现了！' % (

156 act.target.ui_meta.name,

157 act.source.ui_meta.name,

158 )

159

160 def sound_effect(self, act):

161 if act.cause == 'damage':

162 return 'thb-cv-reimu_exterminate_damage'

163 else:

164 return 'thb-cv-reimu_exterminate_active'

165

166

167@ui_meta(characters.reimu.ReimuClear)

168 class ReimuClear:

169 # Skill

170 name = '快晴'

171 description = '你对一名其他角色造成伤害后，你可以与其各摸一张牌，若此时位于其它角色的出牌阶段，停止当前结算并结束出牌阶段。'

172

173

174@ui_meta(characters.reimu.ReimuClearAction)

175 class ReimuClearAction:

176 def effect_string_before(self, act):

177 return '异变解决啦！|G【%s】|r和|G【%s】|r一起去吃饭了！' % (

178 act.source.ui_meta.name,

179 act.target.ui_meta.name,

180 )

181

182 def sound_effect(self, act):

183 return 'thb-cv-reimu_clear'

184

185

186@ui_meta(characters.reimu.ReimuClearHandler)

187 class ReimuClearHandler:

188 choose_option_prompt = '要发动【快晴】吗？'

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

190

191

192@ui_meta(characters.reimu.Reimu)

193 class Reimu:

194 # Character

195 name = '博丽灵梦'

196 title = '节操满地跑的城管'

197 illustrator = '和茶'

198 cv = 'shourei小N'

199

200 port_image = 'thb-portrait-reimu'

201 figure_image = 'thb-figure-reimu'

202 miss_sound_effect = 'thb-cv-reimu_miss'