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

2from __future__ import annotations 

3 

4# -- stdlib -- 

5# -- third party -- 

6# -- own -- 

7from thb import actions 

8from thb.actions import PlayerTurn, ttags 

9from thb.cards import basic, definition 

10from thb.meta.common import ui_meta 

11 

12 

13# -- code -- 

14@ui_meta(definition.AttackCard) 

15class AttackCard: 

16 # action_stage meta 

17 image = 'thb-card-attack' 

18 name = '弹幕' 

19 description = ( 

20 '|R弹幕|r\n\n' 

21 '出牌阶段,消耗1点干劲,对你攻击范围内的一名其他角色使用,对该角色造成1点伤害。\n' 

22 '|B|R>> |r默认情况下,你的攻击范围是1。\n' 

23 '|B|R>> |r干劲在出牌阶段开始时恢复成1点。\n' 

24 '\n' 

25 '|DB(画师:霏茶,CV:VV)|r' 

26 ) 

27 

28 def is_action_valid(self, c, tl): 

29 if not tl: 

30 return (False, '请选择弹幕的目标') 

31 

32 return (True, '来一发!') 

33 

34 def sound_effect(self, act): 

35 if not isinstance(act, actions.ActionStageLaunchCard): 

36 return 'thb-cv-card_attack1' 

37 

38 g = self.game 

39 current = PlayerTurn.get_current(g).target 

40 

41 if act.source is not current: 

42 return 'thb-cv-card_attack1' 

43 

44 ttags(current)['__attack_graze_count'] += 1 

45 

46 return [ 

47 'thb-cv-card_attack1', 

48 'thb-cv-card_attack2', 

49 'thb-cv-card_attack3', 

50 'thb-cv-card_attack4', 

51 ][ttags(current)['__attack_graze_count'] % 4 - 1] 

52 

53 

54@ui_meta(definition.GrazeCard) 

55class GrazeCard: 

56 # action_stage meta 

57 name = '擦弹' 

58 image = 'thb-card-graze' 

59 description = ( 

60 '|R擦弹|r\n\n' 

61 '当你受到|G弹幕|r的攻击时,你可以使用一张|G擦弹|r来抵消|G弹幕|r的效果。\n' 

62 '|B|R>> |r默认情况下,|G擦弹|r只能在回合外使用或打出。\n\n' 

63 '|DB(画师:霏茶,CV:小羽)|r' 

64 ) 

65 

66 def is_action_valid(self, c, tl): 

67 return (False, '你不能主动使用擦弹') 

68 

69 def effect_string(self, act): 

70 return '|G【%s】|r使用了|G%s|r。' % ( 

71 act.source.ui_meta.name, 

72 act.card.ui_meta.name 

73 ) 

74 

75 def sound_effect(self, act): 

76 if not isinstance(act, actions.LaunchCard): 

77 return 'thb-cv-card_graze1' 

78 

79 g = self.game 

80 current = PlayerTurn.get_current(g).target 

81 

82 if act.source is not current: 

83 return 'thb-cv-card_graze1' 

84 

85 return [ 

86 'thb-cv-card_graze1', 

87 'thb-cv-card_graze2', 

88 'thb-cv-card_graze3', 

89 'thb-cv-card_graze4', 

90 ][ttags(current)['__attack_graze_count'] % 4 - 1] 

91 

92 

93@ui_meta(definition.WineCard) 

94class WineCard: 

95 # action_stage meta 

96 name = '酒' 

97 image = 'thb-card-wine' 

98 description = ( 

99 '|R酒|r\n\n' 

100 '出牌阶段,对自己使用。使用后获得|B喝醉|r状态。\n' 

101 '|B喝醉|r状态下,使用【弹幕】造成的伤害+1,受到致命伤害时伤害-1。\n' 

102 '|B|R>> |r 效果触发或者到了自己的准备阶段开始时须弃掉|B喝醉|r状态。\n' 

103 '|B|R>> |r 你可以于喝醉状态下继续使用酒,但效果不叠加。\n\n' 

104 '|DB(画师:霏茶,CV:shourei小N)|r' 

105 ) 

106 

107 def is_action_valid(self, c, tl): 

108 me = self.me 

109 if me.tags.get('wine', False): 109 ↛ 110line 109 didn't jump to line 110, because the condition on line 109 was never true

110 return (True, '你已经醉了,还要再喝吗?') 

111 return (True, '青岛啤酒,神主也爱喝!') 

112 

113 def sound_effect(self, act): 

114 return 'thb-cv-card_wine' 

115 

116 

117@ui_meta(basic.Wine) 

118class Wine: 

119 def effect_string(self, act): 

120 return '|G【%s】|r喝醉了…' % act.target.ui_meta.name 

121 

122 

123@ui_meta(basic.WineRevive) 

124class WineRevive: 

125 def effect_string(self, act): 

126 return '|G【%s】|r醒酒了。' % act.target.ui_meta.name 

127 

128 

129@ui_meta(definition.ExinwanCard) 

130class ExinwanCard: 

131 # action_stage meta 

132 name = '恶心丸' 

133 image = 'thb-card-exinwan' 

134 description = ( 

135 '|R恶心丸|r\n' 

136 '\n' 

137 '出牌阶段,对自己使用。使用时没有额外效果。当此牌以任意的方式进入弃牌堆时,引发弃牌动作的角色需选择其中一项执行:\n' 

138 '|B|R>> |r受到1点无来源伤害。\n' 

139 '|B|R>> |r弃置两张牌。\n' 

140 '\n' 

141 '|B|R! |r 当你因为其他角色装备效果(如他人发动白楼剑特效)或技能效果(如正邪挑拨,秦心暗黑能乐)而将恶心丸主动置入弃牌堆时,恶心丸的弃置者视为该角色。\n' 

142 '\n' 

143 '|DB(画师:霏茶,CV:shourei小N)|r' 

144 ) 

145 

146 def is_action_valid(self, c, tl): 

147 return (True, '哼,哼,哼哼……') 

148 

149 

150@ui_meta(basic.ExinwanEffect) 

151class ExinwanEffect: 

152 # choose_card meta 

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

154 if act.cond(cards): 

155 return (True, '节操给你,离我远点!') 

156 else: 

157 return (False, '请选择两张牌(不选则受到一点无源伤害)') 

158 

159 def effect_string_before(self, act): 

160 return '|G【%s】|r被恶心到了!' % act.target.ui_meta.name 

161 

162 def sound_effect(self, act): 

163 return 'thb-cv-card_exinwan' 

164 

165 

166@ui_meta(basic.UseGraze) 

167class UseGraze: 

168 # choose_card meta 

169 

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

171 if act.cond(cards): 

172 return (True, '我闪!') 

173 else: 

174 return (False, '请打出一张【擦弹】…') 

175 

176 def effect_string(self, act): 

177 if not act.succeeded: return None 

178 t = act.target 

179 return '|G【%s】|r打出了|G%s|r。' % ( 

180 t.ui_meta.name, 

181 act.card.ui_meta.name, 

182 ) 

183 

184 

185@ui_meta(basic.LaunchGraze) 

186class LaunchGraze: 

187 # choose_card meta 

188 

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

190 if act.cond(cards): 

191 return (True, '我闪!') 

192 else: 

193 return (False, '请使用一张【擦弹】抵消【弹幕】效果…') 

194 

195 

196@ui_meta(basic.UseAttack) 

197class UseAttack: 

198 # choose_card meta 

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

200 if act.cond(cards): 

201 return (True, '打架?来吧!') 

202 else: 

203 return (False, '请打出一张弹幕…') 

204 

205 def effect_string(self, act): 

206 if not act.succeeded: return None 

207 t = act.target 

208 return '|G【%s】|r打出了|G%s|r。' % ( 

209 t.ui_meta.name, 

210 act.card.ui_meta.name, 

211 ) 

212 

213 

214@ui_meta(definition.HealCard) 

215class HealCard: 

216 # action_stage meta 

217 image = 'thb-card-heal' 

218 name = '麻薯' 

219 description = ( 

220 '|R麻薯|r\n' 

221 '\n' 

222 '你可以在如下状况中使用,回复1点体力:\n' 

223 '|B|R>> |r在你的出牌阶段且你的当前体力小于最大体力。\n' 

224 '|B|R>> |r当有角色处于濒死状态时。\n' 

225 '\n' 

226 '|DB(画师:霏茶,CV:VV)|r' 

227 ) 

228 

229 def is_action_valid(self, c, tl): 

230 target = tl[0] 

231 

232 if target.life >= target.maxlife: 232 ↛ 235line 232 didn't jump to line 235, because the condition on line 232 was never false

233 return (False, '您已经吃饱了') 

234 else: 

235 return (True, '来一口,精神焕发!') 

236 

237 def sound_effect(self, act): 

238 return 'thb-cv-card_heal' 

239 

240 

241@ui_meta(basic.AskForHeal) 

242class AskForHeal: 

243 # choose_card meta 

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

245 if act.cond(cards): 

246 return (True, '神说,你不能在这里被击坠(对%s使用)' % act.source.ui_meta.name) 

247 else: 

248 return (False, '请选择一张【麻薯】(对%s使用)…' % act.source.ui_meta.name) 

249 

250 

251@ui_meta(basic.Heal) 

252class Heal: 

253 def effect_string(self, act): 

254 if act.succeeded: 

255 return '|G【%s】|r回复了%d点体力。' % ( 

256 act.target.ui_meta.name, act.amount 

257 )