def test_music_not_found(self): live = Live() self.assertRaises( NoLiveFoundException, lambda: live.set_music(music_name="印象", difficulty=Difficulty.TRICK)) self.assertRaises( NoLiveFoundException, lambda: live.set_music(music_name="not found", difficulty=Difficulty.REGULAR))
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)
def test_bless1(self): c0 = Card.from_query("kaede5", custom_pots=(10, 10, 5, 0, 10)) c1 = Card.from_query("natalia1", custom_pots=(10, 0, 0, 0, 10)) c2 = Card.from_query("yoshino3", custom_pots=(0, 10, 10, 0, 10)) c3 = Card.from_query("sarina1", custom_pots=(0, 0, 0, 0, 0)) c4 = Card.from_query("shiki3", custom_pots=(10, 0, 10, 0, 10)) guest = Card.from_query("kaede2", custom_pots=(10, 10, 10, 0, 0)) unit = Unit.from_list([c0, c1, c2, c3, c4, guest]) live = Live() live.set_music(music_name="印象", difficulty=Difficulty.MPLUS) live.set_unit(unit) sim = Simulator(live) sim._setup_simulator(support=110319) self.assertEqual(sim.total_appeal, 279476)
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)
def test_bless3(self): # For some reason, with reso, the other bonuses can only be 0 or -100 c0 = Card.from_query("kaede5", custom_pots=(10, 10, 5, 0, 10)) c1 = Card.from_query("karen4", custom_pots=(0, 6, 10, 0, 10)) c2 = Card.from_query("syuko4", custom_pots=(0, 0, 8, 0, 10)) c3 = Card.from_query("asuka4", custom_pots=(10, 10, 0, 0, 10)) c4 = Card.from_query("shiki3", custom_pots=(10, 0, 10, 0, 10)) guest = Card.from_query("yui2", custom_pots=(10, 10, 10, 0, 0)) unit = Unit.from_list([c0, c1, c2, c3, c4, guest]) live = Live() live.set_music(music_name="印象", difficulty=Difficulty.MPLUS) live.set_unit(unit) sim = Simulator(live) sim._setup_simulator(support=110319) self.assertEqual(sim.total_appeal, 189565)
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()
def test_bonus_chara(self): sae4 = Card.from_query("sae4", custom_pots=(0, 10, 10, 0, 10)) chieri4 = Card.from_query("chieri4", custom_pots=(0, 10, 10, 0, 10)) yoshino3 = Card.from_query("yoshino3", custom_pots=(0, 10, 10, 0, 10)) rika4 = Card.from_query("rika4", custom_pots=(0, 10, 10, 0, 10)) mio4 = Card.from_query("mio4", custom_pots=(0, 10, 10, 0, 10)) kaede2_guest = Card.from_query("kaede2", custom_pots=(10, 10, 10, 0, 0)) unit = Unit.from_list( [sae4, chieri4, yoshino3, rika4, mio4, kaede2_guest]) live = Live() live.set_music(music_name="印象", difficulty=Difficulty.MPLUS) live.set_unit(unit) sim = Simulator(live) sim.simulate() self.assertEqual(live.get_appeals(), 155135) live.reset_attributes() live.set_chara_bonus({262}, 500) live.special_option = APPEAL_PRESETS["Event Idols"] self.assertEqual(live.get_appeals(), 238635) live.reset_attributes() live.set_chara_bonus({262}, 5000) live.special_option = APPEAL_PRESETS["Event Idols"] self.assertEqual(live.get_appeals(), 973137)
self.p.drawConvexPolygon(polygon) def draw_notes(self): for group_idx, group in enumerate(self.note_groups): for note in group: x = self.get_x(note.lane + note.span / 2, group_idx) - note.note_pic.width() // 2 y = self.get_y(note.sec, group_idx) - note.note_pic.height() // 2 self.p.drawImage(QPoint(x, y), note.note_pic) if __name__ == '__main__': app = QApplication(sys.argv) app.setApplicationName("Bruh") main_window = QMainWindow() main_window.show() unit = Unit.from_list([100936, 100708, 100914, 100584, 100456, 100964]) live = Live() live.set_music(score_id=637, difficulty=5) live.set_unit(unit) sim = Simulator(live) res: MaxSimulationResult = sim.simulate_theoretical_max() cpg = BaseChartPicGenerator.get_generator(637, Difficulty(5), main_window, mirrored=True) cpg.hook_cards(unit.all_cards()) cpg.hook_abuse(unit.all_cards(), res.abuse_df) app.exec_()
from logic.unit import Unit from simulator import Simulator from static.song_difficulty import Difficulty logger.print_debug() sae4 = Card.from_query("sae4", custom_pots=(2, 10, 0, 0, 10)) chieri4 = Card.from_query("chieri4", custom_pots=(0, 10, 9, 0, 10)) yoshino3 = Card.from_query("yoshino3", custom_pots=(8, 10, 0, 0, 10)) rika4 = Card.from_query("rika4", custom_pots=(8, 10, 0, 0, 10)) mio4 = Card.from_query("mio4", custom_pots=(0, 5, 0, 0, 10)) kaede2_guest = Card.from_query("kaede2", custom_pots=(10, 10, 10, 0, 5)) unit = Unit.from_list([sae4, chieri4, yoshino3, rika4, mio4, kaede2_guest]) live = Live() live.set_music(music_name="印象", difficulty=Difficulty.MPLUS) live.set_unit(unit) sim = Simulator(live) assert sim.simulate(times=100, appeals=270000).perfect_score == 1736810 unitA = Unit.from_query("kaede2 chieri4 kyoko4 rika4 rika4u") unitB = Unit.from_query("sae4 kozue2 momoka3 frederica3 sachiko4") unitC = Unit.from_query("atsumi2 anzu3 anzu3u miku4 miku3") gu = GrandUnit(unitA, unitB, unitC) live = GrandLive() live.set_music(music_name="Starry-Go-Round", difficulty=Difficulty.PIANO) live.set_unit(gu) sim = Simulator(live) assert sim.simulate(times=10, appeals=490781).perfect_score == 3424303 unit = Unit.from_query("nao4 yukimi2 haru2 mizuki4 rin2 ranko3",