# Coverage for thb/meta/characters/sakuya.py : 96%

## 51 statements 48 run 3 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.cards.classes import AttackCard

10 from thb.meta.common import ui_meta

11

12

13# -- code --

14

15

16@ui_meta(characters.sakuya.Sakuya)

17 class Sakuya:

18 # Character

19 name = '十六夜咲夜'

20 title = '完全潇洒的PAD长'

21 illustrator = '和茶'

22 cv = 'VV'

23

24 port_image = 'thb-portrait-sakuya'

25 figure_image = 'thb-figure-sakuya'

26 miss_sound_effect = 'thb-cv-sakuya_miss'

27

28

29@ui_meta(characters.sakuya.Dagger)

30 class Dagger:

31 # Skill

32 name = '飞刀'

33 description = '你可以将一张装备牌当|G弹幕|r使用或打出，以此法使用的|G弹幕|r无距离限制。'

34

35 def clickable(self):

36 g = self.game

37 me = self.me

38

39 if not (me.cards or me.showncards or me.equips): return False

40

41 try:

42 act = g.hybrid_stack[-1]

43 if act.cond([characters.sakuya.Dagger(me)]):

44 return True

45

46 except (IndexError, AttributeError):

47 pass

48

49 return False

50

51 def is_complete(self, skill):

52 assert skill.is_card(characters.sakuya.Dagger)

53 cl = skill.associated_cards

54 if len(cl) != 1 or 'equipment' not in cl[0].category:

55 return (False, '请选择一张装备牌！')

56 return (True, '快看！灰出去了！')

57

58 def is_action_valid(self, sk, tl):

59 rst, reason = self.is_complete(sk)

60 if not rst:

61 return rst, reason

62 else:

63 return AttackCard().ui_meta.is_action_valid(sk, tl)

64

65 def effect_string(self, act):

66 # for LaunchCard.ui_meta.effect_string

67 source = act.source

68 card = act.card

69 target = act.target

70 s = '|G【%s】|r将|G%s|r制成了|G飞刀|r，向|G【%s】|r掷去！' % (

71 source.ui_meta.name,

72 card.associated_cards[0].ui_meta.name,

73 target.ui_meta.name,

74 )

75 return s

76

77 def sound_effect(self, act):

78 return random.choice([

79 'thb-cv-sakuya_dagger1',

80 'thb-cv-sakuya_dagger2',

81 ])

82

83

84@ui_meta(characters.sakuya.LunaDialActionStage)

85 class LunaDialActionStage:

86 def sound_effect(self, act):

87 return 'thb-cv-sakuya_lunadial'

88

89

90@ui_meta(characters.sakuya.LunaDial)

91 class LunaDial:

92 # Skill

93 name = '月时计'

94 description = '|B锁定技|r，准备阶段开始时，你执行一个额外的出牌阶段。'