Esempio n. 1
0
 def setUp(self):
     self._preset = Preset(monster=Monster(name='Dummy',
                                           stats={
                                               'hp': 10000,
                                               'atk': 800,
                                               'def': 600,
                                               'spd': 100,
                                               'acc': 25
                                           }))
     self._preset.expect(Stat('spd', Between(min=200, max=220)),
                         Stat('atk', Around(1600)),
                         Stat('hp', Around(20000)),
                         Stat('acc', Between(min=50, max=75)))
Esempio n. 2
0
 def setUp(self):
     self._preset = preset = Preset(monster=Monster(name='Searra',
                                                    stats={
                                                        'hp': 10875,
                                                        'atk': 801,
                                                        'def': 615,
                                                        'spd': 100,
                                                        'acc': 25
                                                    }))
     preset.include(violent, will)
     preset.expect(
         Stat('spd', Between(min=205, max=220)),  # 105
         Stat('atk', Around(2000)),  # 150%
         Stat('hp', Around(20000)),  # 97%
         Stat('acc', Between(min=60, max=85)),  # 50%
     )
Esempio n. 3
0
from preset import Preset, Stat, Min, Around, Between
from rune import RuneSets

copper = Preset('Copper')
copper.include(RuneSets.Guard, RuneSets.Blade)
copper.exclude(RuneSets.Violent)
copper.expect(
    Stat('cr', Between(70, 80)),
    Stat('cd', Around(250)),
    Stat('def', Min(2000)),
    Stat('atk', Around(800)),
)
Esempio n. 4
0
 def test_Stat_Around_is_proportinal_to_value_4(self):
     condition = Around(1000)
     self.assertEqual(1.3039, round(condition.fulfilment(1500), 4))
Esempio n. 5
0
 def test_Stat_Around_is_proportinal_to_value_2(self):
     condition = Around(1000)
     self.assertEqual(0, condition.fulfilment(0))
Esempio n. 6
0
    def test_manager_preserves_order(self):
        runes = (
            make_rune(
                slot=1,
                set='Violent',
                grade=6,
                lvl=12,
                primary=('atk', 118),
                sub_stats=(
                    ('cr', 15),
                    ('cd', 18),
                    ('atk%', 10),
                    ('hp%', 8),
                )
            ),
            make_rune(
                slot=1,
                set='Blade',
                grade=6,
                lvl=12,
                primary=('atk', 118),
                sub_stats=(
                    ('cr', 15),
                    ('cd', 18),
                    ('atk%', 10),
                    ('hp%', 8),
                )
            ),
            make_rune(
                slot=2,
                set='Guard',
                grade=6,
                lvl=12,
                primary=('def%', 63),
                sub_stats=(
                    ('cr', 8),
                    ('cd', 24),
                    ('atk%', 10),
                    ('res', 8),
                )
            ),
            make_rune(
                slot=3,
                set='Guard',
                grade=6,
                lvl=12,
                primary=('def', 118),
                sub_stats=(
                    ('cr', 8),
                    ('cd', 16),
                    ('hp%', 10),
                    ('def%', 16),
                )
            ),
            make_rune(
                slot=4,
                set='Blade',
                grade=6,
                lvl=12,
                primary=('cd', 80),
                sub_stats=(
                    ('cr', 8),
                    ('res', 8),
                    ('hp%', 10),
                    ('def%', 24),
                )
            ),
            make_rune(
                slot=5,
                set='Guard',
                grade=6,
                lvl=12,
                primary=('hp', 2040),
                sub_stats=(
                    ('cr', 8),
                    ('cd', 24),
                    ('hp%', 10),
                    ('res', 8),
                )
            ),
            make_rune(
                slot=6,
                set='Guard',
                grade=6,
                lvl=12,
                primary=('def%', 63),
                sub_stats=(
                    ('cr', 8),
                    ('cd', 18),
                    ('hp%', 16),
                    ('res', 8),
                )
            ),
        )

        manager = RuneManager(runes)

        preset = Preset(monster=Monster(name='copper', stats={
            'hp': 9555,
            'atk': 483,
            'def': 692,
            'spd': 98,
            'res': 40
        }))
        preset.include(blade, guard)
        preset.exclude(violent)
        preset.expect(
            Stat(name='cr', condition=Min(70)),
            Stat(name='def', condition=Around(2000))
        )

        manager.add_monster(preset)

        builds = list(manager.optimize())
        self.assertEqual(1, len(list(builds)))

        build = builds[0]

        print(build)
        self.assertEqual(1, build.sets.count('Blade'))
        self.assertEqual(2, build.sets.count('Guard'))

        self.assertEqual(build.attack, 697.6)
        self.assertEqual(build.defense, 1958.72)
        self.assertEqual(build.crit_rate, 70)
        self.assertEqual(build.crit_dmg, 230)
        self.assertEqual(build.hit_points, 16754.7)
        self.assertEqual(build.speed, 98)
        self.assertEqual(build.resistance, 40)
        self.assertEqual(build.accuracy, 0)
Esempio n. 7
0
from preset import Preset, Stat, Around, Between
from rune import RuneSets

print(RuneSets.Violent)

searra = Preset('Seara')
searra.include(RuneSets.Violent, RuneSets.Will)
searra.expect(
    Stat('spd', Between(min=208, max=220)),
    Stat('acc', Between(min=65, max=85)),
    Stat('hp', Around(25000)),
    Stat('atk', Around(2500)),
)

# find all builds where first stat is satissfied
# then of just found find where stat 2 is collected
Esempio n. 8
0
from preset import Preset, Stat, Around, Between
from rune import RuneSets

theomars = Preset('Theomars')
theomars.include(RuneSets.Violent, RuneSets.Will)
theomars.expect(
    Stat('spd', Between(min=190, max=210)),
    Stat('cr', Between(min=60, max=70)),
    Stat('cd', Around(150)),
    Stat('atk', Around(2000)),
    Stat('hp', Around(20000)),
)