Ejemplo n.º 1
0
def get_top_build(live_detail_id):
    subprocess.call(
        list(map(str, [TOOL_EXE, "build", live_detail_id, TEMP_PATH])))
    if not os.path.exists(TEMP_PATH):
        return
    with open(TEMP_PATH) as fr:
        build = literal_eval(fr.read())
        support = build['backmember_appeal']
        cards = [
            Card.from_id(
                _['card_id'],
                custom_pots=(_['potential_param_1'], _['potential_param_3'],
                             _['potential_param_2'], _['potential_param_4'],
                             _['potential_param_5']))
            for _ in build['member_list']
        ]
        if len(build['supporter']) > 0:
            cards.append(
                Card.from_id(
                    build['supporter']['card_id'],
                    custom_pots=(build['supporter']['potential_param_1'],
                                 build['supporter']['potential_param_3'],
                                 build['supporter']['potential_param_2'],
                                 build['supporter']['potential_param_4'],
                                 build['supporter']['potential_param_5'])))
        return cards, support
Ejemplo n.º 2
0
 def test_from_id(self):
     uzu3 = Card.from_id(100448, custom_pots=(0, 0, 0, 0, 0))
     self.assertEqual(uzu3.vo, 6236)
     self.assertEqual(uzu3.da, 4720)
     self.assertEqual(uzu3.vi, 4972)
     self.assertEqual(uzu3.total, 15928)
     self.assertEqual(uzu3.color, Color.CUTE)
     self.assertEqual(str(uzu3), "uzuki3")
Ejemplo n.º 3
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.º 4
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.º 5
0
 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)
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 def set_card(self, idx, card):
     if isinstance(card, Card):
         self.cards_internal[idx] = card
     else:
         if idx == 5 and len(self.cards) != 15:
             custom_pots = (10, 10, 10, 0, 5)
         else:
             custom_pots = None
         self.cards_internal[idx] = Card.from_id(card, custom_pots)
     if card is None:
         self.cards[idx].set_path(None)
     else:
         if isinstance(card, Card):
             card_id = card.card_id
         else:
             card_id = card
         self.cards[idx].set_path(
             str(self.path / "{:06d}.jpg".format(card_id)))
     self.cards[idx].repaint()
     if type(self) == UnitWidget:
         self.update_unit()
Ejemplo n.º 8
0
 def clone_internal(self):
     res = list()
     for card_internal in self.cards_internal:
         if card_internal is None:
             res.append(None)
             continue
         clone_card = Card.from_id(card_internal.card_id)
         clone_card.color = card_internal.color
         clone_card.skill.color = card_internal.skill.color
         clone_card.base_vo = card_internal.base_vo
         clone_card.base_da = card_internal.base_da
         clone_card.base_vi = card_internal.base_vi
         clone_card.base_li = card_internal.base_li
         clone_card.skill.duration = card_internal.skill.duration
         clone_card.skill.interval = card_internal.skill.interval
         clone_card.vo_pots = card_internal.vo_pots
         clone_card.da_pots = card_internal.da_pots
         clone_card.vi_pots = card_internal.vi_pots
         clone_card.li_pots = card_internal.li_pots
         clone_card.sk_pots = card_internal.sk_pots
         clone_card.star = card_internal.star
         res.append(clone_card)
     return res
Ejemplo n.º 9
0
 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)
Ejemplo n.º 10
0
import customlogger as logger
from logic.card import Card
from logic.grandlive import GrandLive
from logic.grandunit import GrandUnit
from logic.live import Live
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)