Example #1
0
 def test_get_ep(self):
     test_buffs = buffs.Buffs()
     test_mh = stats.Weapon(939.5, 1.8, 'dagger', 'landslide')
     test_oh = stats.Weapon(730.5, 1.4, 'dagger', 'landslide')
     test_ranged = stats.Weapon(1371.5, 2.2, 'thrown')
     test_procs = procs.ProcsList('heroic_prestors_talisman_of_machination', 'fluid_death', 'rogue_t11_4pc')
     test_gear_buffs = stats.GearBuffs('rogue_t11_2pc', 'leather_specialization', 'potion_of_the_tolvir', 'chaotic_metagem')
     test_stats = stats.Stats(20, 4756, 190, 1022, 1329, 597, 1189, 1377, test_mh, test_oh, test_ranged, test_procs, test_gear_buffs)
     test_talents = rogue_talents.RogueTalents('0333230113022110321', '0020000000000000000', '2030030000000000000')
     glyph_list = ['backstab', 'mutilate', 'rupture']
     test_glyphs = rogue_glyphs.RogueGlyphs(*glyph_list)
     test_race = race.Race('night_elf')
     test_cycle = settings.AssassinationCycle()
     test_settings = settings.Settings(test_cycle, response_time=1)
     test_level = 85
     calculator = AldrianasRogueDamageCalculator(test_stats, test_talents, test_glyphs, test_buffs, test_race, test_settings, test_level)
     ep_values = calculator.get_ep()
     self.assertTrue(ep_values['agi'] < 4.0)
     self.assertTrue(ep_values['agi'] > 2.0)
     self.assertTrue(ep_values['yellow_hit'] < 4.0)
     self.assertTrue(ep_values['yellow_hit'] > 1.0)
     self.assertTrue(ep_values['crit'] < 2.0)
     self.assertTrue(ep_values['crit'] > 0.0)
test_gear_buffs = stats.GearBuffs('rogue_t12_2pc', 'rogue_t12_4pc',
                                  'leather_specialization',
                                  'potion_of_the_tolvir', 'chaotic_metagem')

# Set up a calcs object..
test_stats = stats.Stats(20, 6248, 190, 624, 1331, 297, 1719, 2032, test_mh,
                         test_oh, test_ranged, test_procs, test_gear_buffs)

# Initialize talents..
test_talents = rogue_talents.RogueTalents('0333230113022110321',
                                          '0020000000000000000',
                                          '2030030000000000000')

# Set up glyphs.
glyph_list = ['backstab', 'mutilate', 'rupture', 'tricks_of_the_trade']
test_glyphs = rogue_glyphs.RogueGlyphs(*glyph_list)

# Set up race.
test_race = race.Race('night_elf')

# Set up settings.
test_cycle = settings.AssassinationCycle()
test_settings = settings.Settings(test_cycle, response_time=1, duration=360)

# Set up level
test_level = 85

# Build a DPS object.
calculator = AldrianasRogueDamageCalculator(test_stats, test_talents,
                                            test_glyphs, test_buffs, test_race,
                                            test_settings, test_level)
Example #3
0
 def setUp(self):
     self.glyphs = rogue_glyphs.RogueGlyphs('backstab', 'mutilate', 'rupture')
def from_json(json_string, character_class='rogue'):
    j = json.loads(json_string)
    try:
        race_object = race.Race(str(j['race']),
                                character_class=character_class)
        level = int(j['level'])

        s = j['settings']
        settings_type = s['type']
        if settings_type == 'assassination':
            # AssassinationCycle(self, min_envenom_size_mutilate=4, min_envenom_size_backstab=5, prioritize_rupture_uptime_mutilate=True, prioritize_rupture_uptime_backstab=True)
            c = s.get('cycle', {})
            cycle = settings.AssassinationCycle(
                c.get('min_envenom_size_mutilate', 4),
                c.get('min_envenom_size_backstab', 5),
                c.get('prioritize_rupture_uptime_mutilate', True),
                c.get('prioritize_rupture_uptime_backstab', True))
        elif settings_type == 'combat':
            # CombatCycle(self, use_rupture=True, use_revealing_strike='sometimes', ksp_immediately=False)
            c = s.get('cycle', {})
            cycle = settings.CombatCycle(
                c.get('use_rupture', True),
                c.get('use_revealing_strike', 'sometimes'),
                c.get('ksp_immediately', False))
        elif settings_type == 'subtlety':
            # SubletySycle(raid_crits_per_second, clip_recuperate=False)
            c = s['cycle']
            cycle = settings.SubtletyCycle(c['raid_crits_per_second'],
                                           c.get('clip_recuperate', False))
        else:
            raise InvalidJSONException(_("Missing settings"))

        # Settings(cycle, time_in_execute_range=.35, tricks_on_cooldown=True, response_time=.5, mh_poison='ip', oh_poison='dp', duration=300):
        settings_object = settings.Settings(
            cycle, s.get('time_in_execute_range', .35),
            s.get('tricks_on_cooldown', True), s.get('response_time', .5),
            s.get('mh_poison', 'ip'), s.get('oh_poison', 'dp'),
            s.get('duration', 300))

        stats_dict = j['stats']
        # Weapon(damage, speed, weapon_type, enchant=None):
        mh_dict = stats_dict['mh']
        mh = stats.Weapon(mh_dict['damage'], mh_dict['speed'], mh_dict['type'],
                          mh_dict.get('enchant'))
        oh_dict = stats_dict['oh']
        oh = stats.Weapon(oh_dict['damage'], oh_dict['speed'], oh_dict['type'],
                          oh_dict.get('enchant'))
        ranged_dict = stats_dict['ranged']
        ranged = stats.Weapon(ranged_dict['damage'], ranged_dict['speed'],
                              ranged_dict['type'], ranged_dict.get('enchant'))
        procs_list = procs.ProcsList(*stats_dict['procs'])
        gear_buffs = stats.GearBuffs(*stats_dict['gear_buffs'])

        # Stats(str, agi, ap, crit, hit, exp, haste, mastery, mh, oh, ranged, procs, gear_buffs, level=85):
        def s(stat):
            return int(stats_dict[stat])

        stats_object = stats.Stats(s('str'), s('agi'), s('ap'), s('crit'),
                                   s('hit'), s('exp'), s('haste'),
                                   s('mastery'), mh, oh, ranged, procs_list,
                                   gear_buffs, level)
        glyphs = rogue_glyphs.RogueGlyphs(*j['glyphs'])
        talents = rogue_talents.RogueTalents(*j['talents'])
        buffs_object = buffs.Buffs(*j['buffs'])
    except KeyError as e:
        raise InvalidJSONException(
            _("Missing required input {key}").format(key=str(e)))
    # Calculator(stats, talents, glyphs, buffs, race, settings=None, level=85):
    return AldrianasRogueDamageCalculator(stats_object,
                                          talents,
                                          glyphs,
                                          buffs_object,
                                          race_object,
                                          settings=settings_object,
                                          level=level)