Ejemplo n.º 1
0
    def test_master(self):
        c1 = Card.from_query("karen4", custom_pots=(0, 6, 10, 0, 10))
        c2 = Card.from_query("sachiko2", custom_pots=(0, 0, 8, 0, 0))
        c3 = Card.from_query("koume2", custom_pots=(0, 0, 10, 0, 10))
        c4 = Card.from_query("miho4", custom_pots=(0, 4, 10, 0, 10))
        c5 = Card.from_query("fumika1", custom_pots=(0, 6, 10, 0, 0))
        cg = Card.from_query("sae4", custom_pots=(0, 10, 0, 5, 10))
        unit = Unit.from_list([c1, c2, c3, c4, c5, cg])

        live = Live()
        live.set_music(music_name="印象", difficulty=Difficulty.MASTER)
        live.set_unit(unit)
        self.assertEqual(live.get_appeals(), 38965)
        self.assertEqual(live.get_life(), 272)
Ejemplo n.º 2
0
    def test_mplus(self):
        c1 = Card.from_query("sae4", custom_pots=(10, 10, 10, 10, 10))
        c2 = Card.from_query("chieri2", custom_pots=(10, 10, 10, 10, 10))
        c3 = Card.from_query("chieri2u", custom_pots=(10, 10, 10, 10, 10))
        c4 = Card.from_query("rika4", custom_pots=(10, 10, 10, 10, 10))
        c5 = Card.from_query("yoko1", custom_pots=(10, 10, 10, 10, 10))
        cg = Card.from_query("kaede2", custom_pots=(10, 10, 10, 10, 10))
        unit = Unit.from_list([c1, c2, c3, c4, c5, cg])

        live = Live()
        live.set_music(music_name="EVERMORE", difficulty=Difficulty.MPLUS)
        live.set_unit(unit)
        self.assertEqual(live.get_appeals(), 134140)
        self.assertEqual(live.get_life(), 394)
Ejemplo n.º 3
0
class SupportModel:
    def __init__(self, view):
        self.view = view
        self.live = Live()
        self.music = None
        self.card_ids = None
        self.cards = list()
        eventbus.eventbus.register(self)

    @subscribe(SetSupportCardsEvent)
    def set_cards(self, event):
        cards = event.cards
        self.cards = cards
        try:
            custom_pots = eventbus.eventbus.post_and_get_first(GetCustomPotsEvent())
            if len(cards) == 15:
                unit = GrandUnit.from_list(self.cards, custom_pots)
                self.live = GrandLive()
                self.live.set_unit(unit)
            else:
                unit = Unit.from_list(self.cards, custom_pots)
                self.live = Live()
                self.live.set_unit(unit)
        except InvalidUnit:
            return False
        return True

    @subscribe(SupportTeamSetMusicEvent)
    def set_music(self, event):
        score_id = event.score_id
        difficulty = event.difficulty
        self.live.set_music(score_id=score_id, difficulty=difficulty, skip_load_notes=True)
        self.music = (score_id, difficulty)

    @subscribe(RequestSupportTeamEvent)
    def generate_support(self, event):
        if self.live.unit is None:
            return
        if self.music is not None:
            self.live.set_music(score_id=self.music[0], difficulty=self.music[1])
        groove_song_color = eventbus.eventbus.post_and_get_first(GetGrooveSongColor())
        if groove_song_color is not None:
            self.live.color = groove_song_color
        self.live.set_extra_bonus(*eventbus.eventbus.post_and_get_first(GetCustomBonusEvent()))
        self.live.get_support()
        self.view.display_support(self.live.support.copy())
        return self.live.get_appeals(), self.live.get_support(), self.live.get_life()