# Coverage for thb/meta/characters/mamizou.py : 43%

## 46 statements 22 run 24 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# -- third party --

6# -- own --

7 from thb import actions, characters

8 from thb.meta.common import ui_meta

9 from utils.misc import BatchList

10

11

12# -- code --

13@ui_meta(characters.mamizou.Morphing)

14 class Morphing:

15 # Skill

16 name = '变化'

17 description = '出牌阶段限一次，你可以将两张手牌当任意基本牌或非延时符卡使用，这两张牌中至少有一张须与你声明使用的牌类型相同。'

18

19 params_ui = 'UIMorphingCardSelection'

20

21 def clickable(self):

22 me = self.me

23

24 if self.limit1_skill_used('mamizou_morphing_tag'):

25 return False

26

27 if not (self.my_turn() and (me.cards or me.showncards)):

28 return False

29

30 return True

31

32 def is_action_valid(self, sk, tl):

33 assert sk.is_card(characters.mamizou.Morphing)

34 cl = sk.associated_cards

35 if len(cl) != 2 or any([c.resides_in.type not in ('cards', 'showncards') for c in cl]):

36 return (False, '请选择两张手牌！')

37

38 cls = sk.get_morph_cls()

39 if not cls:

40 return (False, '请选择需要变化的牌')

41

42 if not sk.is_morph_valid():

43 return (False, '选择的变化牌不符和规则')

44

45 return sk.treat_as().ui_meta.is_action_valid(sk, tl)

46

47 def effect_string(self, act: actions.LaunchCard):

48 # for LaunchCard.ui_meta.effect_string

49 source = act.source

50 card = act.card

51 assert isinstance(card, characters.mamizou.Morphing)

52 tl = BatchList(act.target_list)

53 cl = BatchList(card.associated_cards)

54 s = '|G【%s】|r发动了|G变化|r技能，将|G%s|r当作|G%s|r对|G【%s】|r使用。' % (

55 source.ui_meta.name,

56 '|r、|G'.join(cl.ui_meta.name),

57 card.treat_as.ui_meta.name,

58 '】|r、|G【'.join(tl.ui_meta.name),

59 )

60

61 return s

62

63 def sound_effect(self, act):

64 return 'thb-cv-mamizou_morph'

65

66

67@ui_meta(characters.mamizou.Mamizou)

68 class Mamizou:

69 # Character

70 name = '二岩猯藏'

71 title = '大狸子'

72 designer = '鵺子丶爱丽丝'

73 illustrator = 'hacko.@星の妄想乡'

74 cv = 'shourei小N'

75

76 port_image = 'thb-portrait-mamizou'

77 figure_image = 'thb-figure-mamizou'

78 miss_sound_effect = 'thb-cv-mamizou_miss'

79

80 notes = '|RKOF模式不可用'