# Coverage for thb/meta/characters/kogasa.py : 47%

## 65 statements 32 run 33 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

3# -- stdlib --

4# -- third party --

5# -- own --

6 from thb import actions, characters

7 from thb.cards.base import Card, VirtualCard

8 from thb.meta.common import ui_meta

9

10# -- code --

11

12

13@ui_meta(characters.kogasa.Jolly)

14 class Jolly:

15 # Skill

16 name = '愉快'

17 description = '|B锁定技|r，摸牌阶段摸牌后，你令一名角色摸一张牌。'

18

19

20@ui_meta(characters.kogasa.JollyDrawCard)

21 class JollyDrawCard:

22 def effect_string(self, act):

23 return '|G【%s】|r高兴地让|G【%s】|r摸了%d张牌~' % (

24 act.source.ui_meta.name,

25 act.target.ui_meta.name,

26 act.amount,

27 )

28

29 def sound_effect(self, act):

30 return 'thb-cv-kogasa_jolly'

31

32

33@ui_meta(characters.kogasa.JollyHandler)

34 class JollyHandler:

35 def choose_card_text(self, act, cards):

36 if cards:

37 return (False, '请不要选择牌！')

38

39 return (True, '(～￣▽￣)～')

40

41 # choose_players

42 def target(self, pl):

43 if not pl:

44 return (False, '请选择1名玩家，该玩家摸一张牌')

45

46 return (True, '(～￣▽￣)～')

47

48

49@ui_meta(characters.kogasa.Surprise)

50 class Surprise:

51 # Skill

52 name = '惊吓'

53 description = '出牌阶段限一次，你可以选择一张手牌并指定一名其他角色，该角色选择一种花色后，获得此牌并明置之。若此牌与其选择的花色不同，你对其造成1点伤害。'

54

55 def clickable(self):

56 g = self.game

57 me = self.me

58

59 if me.tags.get('surprise_tag', 0) >= me.tags.get('turn_count', 0):

60 return False

61

62 try:

63 act = g.action_stack[-1]

64 except IndexError:

65 return False

66

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

68 return True

69

70 return False

71

72 def is_action_valid(self, sk, tl):

73 if len(tl) != 1:

74 return (False, '请选择惊吓对象…')

75

76 cl = sk.associated_cards

77 if len(cl) != 1:

78 return (False, '请选择一张手牌！')

79

80 c, = cl

81 if c.is_card(VirtualCard) or c.resides_in.type not in ('cards', 'showncards'):

82 return (False, '请选择一张手牌！')

83

84 # return (True, u'(´・ω・`)')

85 return (True, r'\ ( °▽ °) /')

86

87 def effect_string(self, act):

88 # for LaunchCard.ui_meta.effect_string

89 return (

90 '|G【%s】|r突然出现在|G【%s】|r面前，伞上'

91 '的大舌头直接糊在了|G【%s】|r的脸上！'

92 ) % (

93 act.source.ui_meta.name,

94 act.target.ui_meta.name,

95 act.target.ui_meta.name,

96 )

97

98 def sound_effect(self, act):

99 return 'thb-cv-kogasa_surprise'

100

101

102@ui_meta(characters.kogasa.SurpriseAction)

103 class SurpriseAction:

104 # choose_option

105 choose_option_buttons = (

106 ('黑桃', Card.SPADE),

107 ('红桃', Card.HEART),

108 ('草花', Card.CLUB),

109 ('方片', Card.DIAMOND),

110 )

111

112 # choose_option

113 choose_option_buttons = (

114 ('♠', Card.SPADE),

115 ('♥', Card.HEART),

116 ('♣', Card.CLUB),

117 ('♦', Card.DIAMOND),

118 )

119

120 choose_option_prompt = '请选择一个花色…'

121

122 def effect_string(self, act):

123 if act.succeeded:

124 return '效果拔群！'

125 else:

126 return '似乎没有什么效果'

127

128

129@ui_meta(characters.kogasa.Kogasa)

130 class Kogasa:

131 # Character

132 name = '多多良小伞'

133 title = '愉快的遗忘之伞'

134 illustrator = '霏茶'

135 cv = 'VV'

136

137 port_image = 'thb-portrait-kogasa'

138 figure_image = 'thb-figure-kogasa'

139 miss_sound_effect = 'thb-cv-kogasa_miss'