Hide keyboard shortcuts

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

4import random 

5 

6# -- third party -- 

7# -- own -- 

8from thb import actions, characters 

9from thb.cards.base import Card 

10from thb.cards.classes import ExinwanCard, RejectCard 

11from thb.meta.common import ui_meta 

12 

13 

14# -- code -- 

15 

16 

17@ui_meta(characters.reimu.Flight) 

18class Flight: 

19 # Skill 

20 name = '飞行' 

21 

22 

23@ui_meta(characters.reimu.SpiritualAttack) 

24class SpiritualAttack: 

25 name = '灵击' 

26 

27 def clickable(self, g): 

28 me = g.me 

29 

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

31 

32 try: 

33 act = g.hybrid_stack[-1] 

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

35 return True 

36 

37 except (IndexError, AttributeError): 

38 pass 

39 

40 return False 

41 

42 def is_complete(self, skill): 

43 me = self.me 

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

45 acards = skill.associated_cards 

46 if len(acards) != 1: 

47 return (False, '请选择1张手牌!') 

48 

49 c = acards[0] 

50 

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

52 return (False, '只能使用手牌发动!') 

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

54 return (False, '请选择红色手牌!') 

55 

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

57 

58 def is_action_valid(self, sk, tl): 

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

60 

61 def sound_effect(self, act): 

62 return 'thb-cv-reimu_sa' 

63 

64 def effect_string(self, act): 

65 return RejectCard.ui_meta.effect_string(act) 

66 

67 

68@ui_meta(characters.reimu.TributeTarget) 

69class TributeTarget: 

70 # Skill 

71 name = '纳奉' 

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

73 

74 

75@ui_meta(characters.reimu.Tribute) 

76class Tribute: 

77 # Skill 

78 name = '赛钱' 

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

80 

81 def clickable(self): 

82 g = self.game 

83 me = self.me 

84 

85 if self.limit1_skill_used('tribute_tag'): 

86 return False 

87 

88 try: 

89 act = g.action_stack[-1] 

90 except IndexError: 

91 return False 

92 

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

94 return True 

95 

96 return False 

97 

98 def is_action_valid(self, sk, tl): 

99 cl = sk.associated_cards 

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

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

102 

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

104 return (False, '只能选择手牌!') 

105 

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

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

108 

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

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

111 

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

113 

114 def effect_string(self, act): 

115 # for LaunchCard.ui_meta.effect_string 

116 return ( 

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

118 ) % ( 

119 act.source.ui_meta.name, 

120 act.target.ui_meta.name, 

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

122 ) 

123 

124 def sound_effect(self, act): 

125 c = act.card.associated_cards[0] 

126 if c.is_card(ExinwanCard): 

127 return 'thb-cv-reimu_tribute_exinwan' 

128 else: 

129 return random.choice([ 

130 'thb-cv-reimu_tribute1', 

131 'thb-cv-reimu_tribute2', 

132 ]) 

133 

134 

135# ---------------------- 

136 

137@ui_meta(characters.reimu.ReimuExterminate) 

138class ReimuExterminate: 

139 # Skill 

140 name = '退治' 

141 description = ( 

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

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

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

145 ) 

146 

147 

148@ui_meta(characters.reimu.ReimuExterminateAction) 

149class ReimuExterminateAction: 

150 # choose_card 

151 def choose_card_text(self, g, act, cards): 

152 if act.cond(cards): 

153 return (True, '代表幻想乡消灭你!') 

154 else: 

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

156 

157 

158@ui_meta(characters.reimu.ReimuExterminateLaunchCard) 

159class ReimuExterminateLaunchCard: 

160 def effect_string_before(self, act): 

161 if act.cause == 'damage': 

162 return '|G【%s】|r: (╯‵□′)╯︵ ┻━┻ !!!' % act.source.ui_meta.name 

163 else: 

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

165 act.target.ui_meta.name, 

166 act.source.ui_meta.name, 

167 ) 

168 

169 def sound_effect(self, act): 

170 if act.cause == 'damage': 

171 return 'thb-cv-reimu_exterminate_damage' 

172 else: 

173 return 'thb-cv-reimu_exterminate_active' 

174 

175 

176@ui_meta(characters.reimu.ReimuClear) 

177class ReimuClear: 

178 # Skill 

179 name = '快晴' 

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

181 

182 

183@ui_meta(characters.reimu.ReimuClearAction) 

184class ReimuClearAction: 

185 def effect_string_before(self, act): 

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

187 act.source.ui_meta.name, 

188 act.target.ui_meta.name, 

189 ) 

190 

191 def sound_effect(self, act): 

192 return 'thb-cv-reimu_clear' 

193 

194 

195@ui_meta(characters.reimu.ReimuClearHandler) 

196class ReimuClearHandler: 

197 choose_option_prompt = '要发动【快晴】吗?' 

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

199 

200 

201@ui_meta(characters.reimu.Reimu) 

202class Reimu: 

203 # Character 

204 name = '博丽灵梦' 

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

206 illustrator = '和茶' 

207 cv = 'shourei小N' 

208 

209 port_image = 'thb-portrait-reimu' 

210 figure_image = 'thb-figure-reimu' 

211 miss_sound_effect = 'thb-cv-reimu_miss'