# Coverage for thb/meta/characters/alice.py : 55%

## 87 statements 47 run 40 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 from __future__ import annotations

3

4# -- stdlib --

5 import random

6

7# -- third party --

8# -- own --

9 from thb import characters

10 from thb.meta.common import ui_meta

11

12

13# -- code --

14@ui_meta(characters.alice.Alice)

15 class Alice:

16 # Character

17 name = '爱丽丝'

18 title = '七色的人偶使'

19 illustrator = '霏茶'

20 cv = '小舞'

21

22 port_image = 'thb-portrait-alice'

23 figure_image = 'thb-figure-alice'

24 miss_sound_effect = 'thb-cv-alice_miss'

25

26

27@ui_meta(characters.alice.LittleLegion)

28 class LittleLegion:

29 # Skill

30 name = '小小军势'

31 description = (

32 '出牌阶段结束时，你可以重铸一张装备牌，然后发动对应的效果：\n'

33 '|B|R>> |r武器：视为对一名其他角色使用了|G弹幕|r。\n'

34 '|B|R>> |r防具：令一名角色回复1点体力。\n'

35 '|B|R>> |r饰品：摸一张牌并跳过弃牌阶段。\n'

36 '|B|R>> |rUFO：视为使用一张|G人型操控|r。'

37 )

38

39

40@ui_meta(characters.alice.LittleLegionAttackCard)

41 class LittleLegionAttackCard:

42 name = '小小军势'

43

44 def effect_string(self, act):

45 # for LaunchCard.ui_meta.effect_string

46 return '|G【%s】|r操起人偶，向|G【%s】|r进攻！' % (

47 act.source.ui_meta.name,

48 act.target.ui_meta.name,

49 )

50

51 def sound_effect(self, act):

52 return 'thb-cv-alice_legion_attack'

53

54

55@ui_meta(characters.alice.LittleLegionDollControlCard)

56 class LittleLegionDollControlCard:

57 name = '小小军势'

58 custom_ray = True

59

60 def effect_string(self, act):

61 # for LaunchCard.ui_meta.effect_string

62 controllee, victim = act.target_list

63 return '|G【%s】|r操起人偶……呃不对，是|G【%s】|r，向|G【%s】|r进攻！' % (

64 act.source.ui_meta.name,

65 controllee.ui_meta.name,

66 victim.ui_meta.name,

67 )

68

69 def sound_effect(self, act):

70 return 'thb-cv-alice_legion_control'

71

72

73@ui_meta(characters.alice.LittleLegionAttackAction)

74 class LittleLegionAttackAction:

75

76 def target(self, pl):

77 if not pl:

78 return (False, '进攻：请选择1名玩家，视为使用弹幕')

79

80 return (True, '就让你见识下人偶军团的厉害！')

81

82

83@ui_meta(characters.alice.LittleLegionCoverEffect)

84 class LittleLegionCoverEffect:

85 def effect_string(self, act):

86 if act.succeeded:

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

88 act.target.ui_meta.name, act.amount

89 )

90

91 def sound_effect(self, act):

92 return 'thb-cv-alice_legion_cover'

93

94

95@ui_meta(characters.alice.LittleLegionCoverAction)

96 class LittleLegionCoverAction:

97

98 def target(self, pl):

99 if not pl:

100 return (False, '掩护：请选择1名玩家，回复1点体力')

101

102 return (True, '支援到了，重复，支援到了！')

103

104

105@ui_meta(characters.alice.LittleLegionHoldAction)

106 class LittleLegionHoldAction:

107

108 def sound_effect(self, act):

109 return 'thb-cv-alice_legion_hold'

110

111

112@ui_meta(characters.alice.LittleLegionControlAction)

113 class LittleLegionControlAction:

114

115 def target(self, pl):

116 g = self.game

117

118 if not pl:

119 return (False, '控场：请选择2名玩家，视为使用【人型操控】')

120

121 from thb.cards.classes import DollControlCard

122

123 rst, prompt = DollControlCard().ui_meta.is_action_valid([], pl)

124

125 if rst:

126 return (True, '就让你见识下人偶军团的厉害！')

127 else:

128 return rst, prompt

129

130

131@ui_meta(characters.alice.LittleLegionHandler)

132 class LittleLegionHandler:

133

134 # choose_card

135 def choose_card_text(self, act, cards):

136 if act.cond(cards):

137 c, = cards

138 if c.equipment_category == 'weapon':

139 text = '（武器）：视为对一名角色使用弹幕。'

140 elif c.equipment_category == 'shield':

141 text = '（防具）：令一名角色回复一点体力。'

142 elif c.equipment_category == 'accessories':

143 text = '（饰品）：跳过弃牌阶段。'

144 elif c.equipment_category in ('redufo', 'greenufo'):

145 text = '（UFO）：视为使用人型操控。'

146 else:

147 text = '（BUG）：什么鬼……'

148

149 return (True, '小小军势' + text)

150 else:

151 return (False, '小小军势：重铸一张装备牌，发动相应效果（否则不发动）')

152

153

154@ui_meta(characters.alice.DollBlast)

155 class DollBlast:

156 # Skill

157 name = '人偶爆弹'

158 description = '每当你装备区的牌被其他角色获得或弃置时，你可以弃置其一张牌。若此法弃置的牌为该角色获得的牌，你对其造成1点伤害。'

159

160

161@ui_meta(characters.alice.DollBlastEffect)

162 class DollBlastEffect:

163

164 def effect_string_before(self, act):

165 if act.do_damage:

166 return '|G【%s】|r拿走了|G【%s】|r的人偶（%s），然后，BOOM！|G【%s】|r就炸了！' % (

167 act.target.ui_meta.name,

168 act.source.ui_meta.name,

169 self.card_desc(act.card),

170 act.target.ui_meta.name,

171 )

172 else:

173 return '|G【%s】|r拿走了|G【%s】|r的人偶，|G【%s】|r非常生气，弃置|G【%s】|r的%s。' % (

174 act.target.ui_meta.name,

175 act.source.ui_meta.name,

176 act.source.ui_meta.name,

177 act.target.ui_meta.name,

178 self.card_desc(act.card),

179 )

180

181

182@ui_meta(characters.alice.DollBlastAction)

183 class DollBlastAction:

184

185 def sound_effect(self, act):

186 return random.choice([

187 'thb-cv-alice_dollblast_blast',

188 'thb-cv-alice_dollblast_noblast',

189 ])

190

191

192@ui_meta(characters.alice.DollBlastHandlerCommon)

193 class DollBlastHandlerCommon:

194 # choose_option

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

196 choose_option_prompt = '你要发动【人偶爆弹】吗？'

197

198# ----------