Beispiel #1
0
def maximum_minion_kill(lane,
                        time_current,
                        kill_interval=0,
                        kill_rate=1,
                        time_purchase=0):
    caster = models.Minion('caster')
    melee = models.Minion('melee')
    siege = models.Minion('siege')

    kill_gold = 0
    last_kill = time_purchase - kill_interval
    for time in range(time_purchase, time_current):
        if time < last_kill + kill_interval:
            continue

        minion = None
        for minion in (siege, melee, caster):
            available = (minion.in_lane(lane, time) -
                         minion.in_lane(lane, time - 1))
            if available:
                break
        else:
            continue

        kill_gold += minion.value(time)
        last_kill = time

    return kill_gold * kill_rate
Beispiel #2
0
def test_group_size():
    caster = models.Minion('Caster')
    melee = models.Minion('Melee')
    assert caster.group_size == melee.group_size == 3

    siege = models.Minion('Siege')
    assert siege.group_size == 1
Beispiel #3
0
def test_equality():
    caster = models.Minion('Caster')
    assert caster == caster

    melee = models.Minion('Melee')
    assert caster != melee

    melee_copy = models.Minion('Melee')
    assert melee == melee_copy
Beispiel #4
0
def test_interval():
    times = [0, 15 * 60, 30 * 60, 45 * 60]

    caster = models.Minion('Caster')
    melee = models.Minion('Melee')
    for time in times:
        assert caster.interval(time) == 30
        assert melee.interval(time) == 30

    siege = models.Minion('Siege')
    assert siege.interval(times[0]) == 90
    assert siege.interval(times[1]) == 90
    assert siege.interval(times[2]) == 60
    assert siege.interval(times[3]) == 30
Beispiel #5
0
def maximum_passively_generated_from_farm(lane,
                                          gold_per_farm,
                                          time_current,
                                          farm_rate=1,
                                          time_purchase=0):
    caster = models.Minion('caster').in_lane
    melee = models.Minion('melee').in_lane
    siege = models.Minion('siege').in_lane

    casters = caster(lane, time_current) - caster(lane, time_purchase)
    melees = melee(lane, time_current) - melee(lane, time_purchase)
    sieges = siege(lane, time_current) - siege(lane, time_purchase)
    farm = casters + melees + sieges

    return farm * gold_per_farm * farm_rate
Beispiel #6
0
def test_speed():
    melee = models.Minion('Melee')
    assert melee.speed == 325

    bot = models.Lane('Bot')
    assert bot.nexus_to_center_time(melee.speed) == 33

    mid = models.Lane('Mid')
    assert mid.nexus_to_center_time(melee.speed) == 24
Beispiel #7
0
def test_first_spawn_order():
    caster = models.Minion('Caster')
    melee = models.Minion('Melee')
    siege = models.Minion('Siege')

    assert melee.first_spawn < caster.first_spawn < siege.first_spawn
Beispiel #8
0
def test_repr():
    assert str(models.Minion('Caster')) == '[caster]'