Coverage for thb/meta/characters/reimu.py : 50%
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 -*-
3# -- stdlib --
4import random
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
14# -- code --
17@ui_meta(characters.reimu.Flight)
18class Flight:
19 # Skill
20 name = '飞行'
23@ui_meta(characters.reimu.SpiritualAttack)
24class SpiritualAttack:
25 name = '灵击'
27 def clickable(self):
28 g = self.game
29 me = self.me
31 if not (me.cards or me.showncards): return False
33 try:
34 act = g.hybrid_stack[-1]
35 if act.cond([characters.reimu.SpiritualAttack(me)]):
36 return True
38 except (IndexError, AttributeError):
39 pass
41 return False
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张手牌!')
50 c = acards[0]
52 if c.resides_in not in (me.cards, me.showncards):
53 return (False, '只能使用手牌发动!')
54 elif not c.color == Card.RED:
55 return (False, '请选择红色手牌!')
57 return (True, '反正这条也看不到,偷个懒~~~')
59 def is_action_valid(self, sk, tl):
60 return (False, '你不能主动使用灵击')
62 def sound_effect(self, act):
63 return 'thb-cv-reimu_sa'
65 def effect_string(self, act):
66 return RejectCard.ui_meta.effect_string(act)
69@ui_meta(characters.reimu.TributeTarget)
70class TributeTarget:
71 # Skill
72 name = '纳奉'
73 description = '|BBOSS技|r,其他角色的出牌阶段限一次,若你的手牌数小于体力上限,其可以将一张手牌置入你的明牌区。'
76@ui_meta(characters.reimu.Tribute)
77class Tribute:
78 # Skill
79 name = '赛钱'
80 description = '出牌阶段限一次,若灵梦的手牌数小于体力上限,你可以将一张手牌置入灵梦的明牌区。'
82 def clickable(self):
83 g = self.game
84 me = self.me
86 if self.limit1_skill_used('tribute_tag'):
87 return False
89 try:
90 act = g.action_stack[-1]
91 except IndexError:
92 return False
94 if isinstance(act, actions.ActionStage) and (me.cards or me.showncards or me.equips):
95 return True
97 return False
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, '只能选择一张手牌')
104 if not cl[0].resides_in.type in ('cards', 'showncards'):
105 return (False, '只能选择手牌!')
107 if len(tl) != 1 or not tl[0].has_skill(characters.reimu.TributeTarget):
108 return (False, '请选择一只灵梦')
110 if len(tl[0].cards) + len(tl[0].showncards) >= tl[0].maxlife:
111 return (False, '灵梦的赛钱箱满了')
113 return (True, '投进去……会发生什么呢?')
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 )
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 ])
136# ----------------------
138@ui_meta(characters.reimu.ReimuExterminate)
139class ReimuExterminate:
140 # Skill
141 name = '退治'
142 description = (
143 '其他角色的回合内,你可以于以下时机无视距离对其使用一张弹幕:\n'
144 '|B|R>> |r出牌阶段,你受到伤害后。\n'
145 '|B|R>> |r回合结束阶段,且该角色本回合对其他角色造成过伤害。'
146 )
149@ui_meta(characters.reimu.ReimuExterminateAction)
150class 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)
159@ui_meta(characters.reimu.ReimuExterminateLaunchCard)
160class 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 )
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'
177@ui_meta(characters.reimu.ReimuClear)
178class ReimuClear:
179 # Skill
180 name = '快晴'
181 description = '你对一名其他角色造成伤害后,你可以与其各摸一张牌,若此时位于其它角色的出牌阶段,停止当前结算并结束出牌阶段。'
184@ui_meta(characters.reimu.ReimuClearAction)
185class 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 )
192 def sound_effect(self, act):
193 return 'thb-cv-reimu_clear'
196@ui_meta(characters.reimu.ReimuClearHandler)
197class ReimuClearHandler:
198 choose_option_prompt = '要发动【快晴】吗?'
199 choose_option_buttons = (('发动', True), ('不发动', False))
202@ui_meta(characters.reimu.Reimu)
203class Reimu:
204 # Character
205 name = '博丽灵梦'
206 title = '节操满地跑的城管'
207 illustrator = '和茶'
208 cv = 'shourei小N'
210 port_image = 'thb-portrait-reimu'
211 figure_image = 'thb-figure-reimu'
212 miss_sound_effect = 'thb-cv-reimu_miss'