Coverage for thb/meta/characters/chen.py : 65%
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
4# -- stdlib --
5from typing import cast
7# -- third party --
8# -- own --
9from thb import actions, characters
10from thb.meta.common import ui_meta
11from utils.misc import BatchList
12import thb.cards.classes as cards
15# -- code --
16@ui_meta(characters.chen.FlyingSkanda)
17class FlyingSkanda:
18 # Skill
19 name = '飞翔韦驮天'
20 description = (
21 '出牌阶段限一次,你使用|G弹幕|r或单体符卡时,可以额外指定一个目标。\n'
22 '|B|R>> |r在线版本中,不能以此法使用|G人形操控|r'
23 )
25 def clickable(self, game):
26 me = game.me
27 if me.tags['flying_skanda'] >= me.tags['turn_count']: return False
28 try:
29 act = game.action_stack[-1]
30 if isinstance(act, actions.ActionStage) and act.target is me:
31 return True
32 except IndexError:
33 pass
34 return False
36 def is_action_valid(self, sk, tl):
37 acards = sk.associated_cards
38 if len(acards) != 1:
39 return (False, '请选择一张牌!')
40 c = acards[0]
42 while True:
43 if c.is_card(cards.AttackCard): break
45 rst = True
46 rst = rst and not c.is_card(cards.RejectCard)
47 rst = rst and not c.is_card(cards.DollControlCard)
48 rst = rst and c.associated_action
49 rst = rst and issubclass(c.associated_action, cards.InstantSpellCardAction)
50 if rst: break
52 return (False, '请选择一张【弹幕】或者除【人形操控】与【好人卡】之外的非延时符卡!')
54 if len(tl) != 2:
55 return (False, '请选择目标(2名玩家)')
57 if self.me is tl[-1]: 57 ↛ 58line 57 didn't jump to line 58, because the condition on line 57 was never true
58 return (False, '不允许选择自己')
59 else:
60 return (True, '喵!')
62 def effect_string(self, act: actions.LaunchCard):
63 # for LaunchCard.ui_meta.effect_string
64 src = act.source
65 card = cast(characters.chen.FlyingSkanda, act.card).associated_cards[0]
66 tl = BatchList(act.target_list)
68 if card.is_card(cards.AttackCard):
69 s = '弹幕掺了金坷垃,攻击范围一千八!'
70 else:
71 s = '符卡掺了金坷垃,一张能顶两张用!'
73 return '|G【%s】|r:“%s|G【%s】|r接招吧!”' % (
74 src.ui_meta.name,
75 s,
76 '】|r、|G【'.join(tl.ui_meta.name),
77 )
79 def sound_effect(self, act):
80 return 'thb-cv-chen_skanda'
83@ui_meta(characters.chen.Shikigami)
84class Shikigami:
85 # Skill
86 name = '式神'
87 description = (
88 '|B限定技|r,出牌阶段,你可以令一名其他角色选择一项:|B|R>> |r摸两张牌,|B|R>> |r回复1点体力。\n'
89 '直到下次你的回合开始时,你与其可以在出牌阶段对对方攻击范围内的角色使用|G弹幕|r。'
90 )
92 def clickable(self, game):
93 me = game.me
94 if me.tags.get('shikigami_tag'): return False
95 try:
96 act = game.action_stack[-1]
97 if isinstance(act, actions.ActionStage) and act.target is me:
98 return True
99 except IndexError:
100 pass
101 return False
103 def is_action_valid(self, sk, tl):
104 cl = sk.associated_cards
105 if cl:
106 return (False, '请不要选择牌')
108 if not tl:
109 return (False, '请选择一名玩家')
110 else:
111 return (True, '发动【式神】')
113 def sound_effect(self, act):
114 return 'thb-cv-chen_shikigami'
117@ui_meta(characters.chen.ShikigamiAction)
118class ShikigamiAction:
119 choose_option_buttons = (('摸2张牌', False), ('回复1点体力', True))
120 choose_option_prompt = '请为受到的【式神】选择效果'
123@ui_meta(characters.chen.Chen)
124class Chen:
125 name = '橙'
126 title = '凶兆的黑喵'
127 illustrator = '和茶'
128 cv = 'shourei小N'
130 port_image = 'thb-portrait-chen'
131 figure_image = 'thb-figure-chen'
132 miss_sound_effect = 'thb-cv-chen_miss'