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

## 110 statements 56 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 g = self.game

29 me = self.me

30

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

32

33 try:

34 act = g.hybrid_stack[-1]

35 if act.cond([characters.reimu.SpiritualAttack(me)]):

36 return True

37

38 except (IndexError, AttributeError):

39 pass

40

41 return False

42

43 def is_complete(self, skill):

44 me = self.me

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

46 acards = skill.associated_cards

47 if len(acards) != 1:

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

49

50 c = acards[0]

51

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

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

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

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

56

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

58

59 def is_action_valid(self, sk, tl):

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

61

62 def sound_effect(self, act):

63 return 'thb-cv-reimu_sa'

64

65 def effect_string(self, act):

66 return RejectCard.ui_meta.effect_string(act)

67

68

69@ui_meta(characters.reimu.TributeTarget)

70 class TributeTarget:

71 # Skill

72 name = '纳奉'

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

74

75

76@ui_meta(characters.reimu.Tribute)

77 class Tribute:

78 # Skill

79 name = '赛钱'

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

81

82 def clickable(self):

83 g = self.game

84 me = self.me

85

86 if self.limit1_skill_used('tribute_tag'):

87 return False

88

89 try:

90 act = g.action_stack[-1]

91 except IndexError:

92 return False

93

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

95 return True

96

97 return False

98

99 def is_action_valid(self, sk, tl):

100 cl = sk.associated_cards

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

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

103

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

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

106

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

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

109

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

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

112

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

114

115 def effect_string(self, act):

116 # for LaunchCard.ui_meta.effect_string

117 return (

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

119 ) % (

120 act.source.ui_meta.name,

121 act.target.ui_meta.name,

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

123 )

124

125 def sound_effect(self, act):

126 c = act.card.associated_cards[0]

127 if c.is_card(ExinwanCard):

128 return 'thb-cv-reimu_tribute_exinwan'

129 else:

130 return random.choice([

131 'thb-cv-reimu_tribute1',

132 'thb-cv-reimu_tribute2',

133 ])

134

135

136# ----------------------

137

138@ui_meta(characters.reimu.ReimuExterminate)

139 class ReimuExterminate:

140 # Skill

141 name = '退治'

142 description = (

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

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

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

146 )

147

148

149@ui_meta(characters.reimu.ReimuExterminateAction)

150 class ReimuExterminateAction:

151 # choose_card

152 def choose_card_text(self, act, cards):

153 if act.cond(cards):

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

155 else:

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

157

158

159@ui_meta(characters.reimu.ReimuExterminateLaunchCard)

160 class ReimuExterminateLaunchCard:

161 def effect_string_before(self, act):

162 if act.cause == 'damage':

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

164 else:

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

166 act.target.ui_meta.name,

167 act.source.ui_meta.name,

168 )

169

170 def sound_effect(self, act):

171 if act.cause == 'damage':

172 return 'thb-cv-reimu_exterminate_damage'

173 else:

174 return 'thb-cv-reimu_exterminate_active'

175

176

177@ui_meta(characters.reimu.ReimuClear)

178 class ReimuClear:

179 # Skill

180 name = '快晴'

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

182

183

184@ui_meta(characters.reimu.ReimuClearAction)

185 class ReimuClearAction:

186 def effect_string_before(self, act):

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

188 act.source.ui_meta.name,

189 act.target.ui_meta.name,

190 )

191

192 def sound_effect(self, act):

193 return 'thb-cv-reimu_clear'

194

195

196@ui_meta(characters.reimu.ReimuClearHandler)

197 class ReimuClearHandler:

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

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

200

201

202@ui_meta(characters.reimu.Reimu)

203 class Reimu:

204 # Character

205 name = '博丽灵梦'

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

207 illustrator = '和茶'

208 cv = 'shourei小N'

209

210 port_image = 'thb-portrait-reimu'

211 figure_image = 'thb-figure-reimu'

212 miss_sound_effect = 'thb-cv-reimu_miss'