# Coverage for thb/meta/tags.py : 48%

## 76 statements 34 run 42 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 itertools

6

7# -- third party --

8# -- own --

9 from thb.actions import PlayerTurn

10

11

12# -- code --

13 tags = {}

14

15

16 def ui_meta(cls):

17 tags[cls.__name__] = cls()

18 return cls

19

20

21 def get_display_tags(p):

22 from thb.actions import ttags

23

24 rst = []

25

26 try:

27 for t, v in itertools.chain(p.tags.items(), ttags(p).items()):

28 meta = tags.get(t)

29 if not meta:

30 continue

31

32 desc = meta.desc(p, v)

33 if not desc:

34 continue

35

36 rst.append(desc)

37

38 for c in list(getattr(p, 'fatetell', ())):

39 rst.append((c.ui_meta.tag_desc(c), c.ui_meta.description))

40

41 except AttributeError:

42 pass

43

44 return rst

45

46

47@ui_meta

48 class vitality:

49 def desc(g, p, v):

50 current = PlayerTurn.get_current(g).target

51 if v <= 0 and current is p:

52 return 'thb-tag-attacked', '没有干劲了……'

53

54

55@ui_meta

56 class wine:

57 def desc(g, p, v):

58 return v and ('thb-tag-wine', '喝醉了…')

59

60

61@ui_meta

62 class flan_cs:

63 def desc(g, p, v):

64 current = PlayerTurn.get_current(g).target

65 if v >= p.tags['turn_count'] and current is p:

66 return 'thb-tag-flandrecs', '玩坏你哦！'

67

68

69@ui_meta

70 class lunadial:

71 def desc(g, p, v):

72 current = PlayerTurn.get_current(g).target

73 if v and current is p:

74 return 'thb-tag-lunadial', '咲夜的时间！'

75

76

77@ui_meta

78 class riverside_target:

79 def desc(g, p, v):

80 if v == g.turn_count:

81 return 'thb-tag-riverside', '被指定为彼岸的目标'

82

83

84@ui_meta

85 class ran_ei:

86 def desc(g, p, v):

87 if v < p.tags['turn_count'] + 1:

88 return 'thb-tag-ran_ei', '还可以发动极智'

89

90

91@ui_meta

92 class aya_count:

93 def desc(g, p, v):

94 current = PlayerTurn.get_current(g).target

95 if v >= 2 and p is current:

96 return 'thb-tag-aya_range_max', '使用卡牌时不受距离限制'

97

98

99@ui_meta

100 class exterminate:

101 def desc(g, p, v):

102 return v and 'thb-tag-flandre_exterminate', '毁灭：无法使用人物技能'

103

104

105@ui_meta

106 class reisen_discarder:

107 def desc(g, p, v):

108 return v and 'thb-tag-reisen_discarder', '丧心：下一个出牌阶段只能使用弹幕，且只能对最近的角色使用弹幕'

109

110

111@ui_meta

112 class shizuha_decay:

113 def desc(g, p, v):

114 return v and 'thb-tag-shizuha_decay', '凋零：弃牌阶段需额外弃置一张手牌'

115

116

117@ui_meta

118 class scarlet_mist:

119 def desc(g, p, v):

120 if v == 'buff':

121 return 'thb-tag-scarlet_mist', '红雾：增益效果'

122

123

124@ui_meta

125 class keine_devour:

126 def desc(g, p, v):

127 current = PlayerTurn.get_current(g).target

128 if v and p is current:

129 return 'thb-tag-keine_devour', '这位玩家的历史将会被慧音吞噬'

130

131

132@ui_meta

133 class devoted:

134 def desc(p, v):

135 return 'thb-tag-keine_devoted', '合格的CP当然要同富贵共患难！'

136

137# -----END TAGS UI META-----