# Coverage for thb/meta/characters/kaguya.py : 68%

## 54 statements 36 run 18 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 import random

5

6# -- third party --

7# -- own --

8 from thb import characters

9 from thb.meta.common import ui_meta

10

11# -- code --

12

13

14@ui_meta(characters.kaguya.Kaguya)

15 class Kaguya:

16 # Character

17 name = '蓬莱山辉夜'

18 title = '永远的公主殿下'

19 illustrator = '噗呼噗呼@星の妄想乡'

20 cv = 'shourei小N'

21

22 port_image = 'thb-portrait-kaguya'

23 figure_image = 'thb-figure-kaguya'

24 miss_sound_effect = 'thb-cv-kaguya_miss'

25

26

27@ui_meta(characters.kaguya.Dilemma)

28 class Dilemma:

29 # Skill

30 name = '难题'

31 description = '每当一名角色令你回复1点体力后，你可以令其摸一张牌；每当你受到一次伤害后，你可以令伤害来源选择一项：|B|R>> |r交给你一张方块牌，|B|R>> |r失去1点体力。'

32

33

34@ui_meta(characters.kaguya.DilemmaDamageAction)

35 class DilemmaDamageAction:

36 # choose_card meta

37 def choose_card_text(self, act, cards):

38 if act.cond(cards):

39 return (True, '交出一张方片牌')

40 else:

41 return (False, '请选择交出一张方片牌（否则失去一点体力）')

42

43 def effect_string_before(self, act):

44 return '|G【%s】|r对|G【%s】|r发动了|G难题|r。' % (

45 act.source.ui_meta.name,

46 act.target.ui_meta.name

47 )

48

49 def effect_string(self, act):

50 if act.peer_action == 'card':

51 return '|G【%s】|r给了|G【%s】|r一张牌。' % (

52 act.target.ui_meta.name,

53 act.source.ui_meta.name

54 )

55 # elif act.peer_action == 'life':

56 # <handled by LifeLost>

57

58 def sound_effect(self, act):

59 return random.choice([

60 'thb-cv-kaguya_dilemma1',

61 'thb-cv-kaguya_dilemma2',

62 ])

63

64

65@ui_meta(characters.kaguya.DilemmaHealAction)

66 class DilemmaHealAction:

67 def effect_string(self, act):

68 return '|G【%s】|r发动了|G难题|r，|G【%s】|r摸了一张牌。' % (

69 act.source.ui_meta.name,

70 act.target.ui_meta.name,

71 )

72

73 def sound_effect(self, act):

74 return random.choice([

75 'thb-cv-kaguya_dilemma1',

76 'thb-cv-kaguya_dilemma2',

77 ])

78

79

80@ui_meta(characters.kaguya.DilemmaHandler)

81 class DilemmaHandler:

82 # choose_option meta

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

84

85 def choose_option_prompt(self, act):

86 _type = {

87 'positive': '正面效果',

88 'negative': '负面效果'

89 }.get(act.dilemma_type, 'WTF?!')

90 return '你要发动【难题】吗（%s）？' % _type

91

92

93@ui_meta(characters.kaguya.ImperishableNight)

94 class ImperishableNight:

95 # Skill

96 name = '永夜'

97 description = '你的回合外，每当其他角色使用的红色基本牌置入弃牌堆时，你可以将一张红色基本牌或装备牌当|G封魔阵|r对其使用。'

98 image = None

99 tag = 'thb-tag-sealarray'

100

101 def effect_string(self, act):

102 return '|G【%s】|r对|G【%s】|r使用了|G永夜|r。' % (

103 act.source.ui_meta.name,

104 act.target.ui_meta.name

105 )

106

107 def sound_effect(self, act):

108 return 'thb-cv-kaguya_inight'

109

110

111@ui_meta(characters.kaguya.ImperishableNightHandler)

112 class ImperishableNightHandler:

113 # choose_option meta

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

115

116 def choose_option_prompt(self, act):

117 prompt = '你要发动【永夜】吗（对%s）？'

118 return prompt % act.target.ui_meta.name

119

120 # choose_card meta

121 def choose_card_text(self, act, cards):

122 if act.cond(cards):

123 return (True, '陷入永夜吧！')

124 else:

125 return (False, '请选择一张红色的基本牌或装备牌')