Desert Duel Tips and Tricks


def summon_units(type, lane, count=1):
    for _ in range(count):
        hero.summon(type, lane)

def play_if_ready(play_name, lane):
    if hero.isReady(play_name):
        hero.play(play_name, lane)

def quicksand():
    et11 = hero.findPlayers(1)
    et22 = hero.findPlayers(2)
    et00 = hero.findPlayers(0)
    
    if hero.isReady("quicksand"):
        if len(et11) >= 2: 
            play_if_ready("quicksand", 1)
            play_if_ready("press", 2)
        elif len(et22) >= 2:
            play_if_ready("quicksand", 2)
            play_if_ready("press", 1)
        elif len(et00) >= 2:
            play_if_ready("quicksand", 0)

while True:
    quicksand()

    # Update enemy data once per iteration
    et0 = hero.findTheirPlayers(0)
    et1 = hero.findTheirPlayers(1)
    et2 = hero.findTheirPlayers(2)

    # Lane 0 actions
    if et0:
        summon_units("threat", 0, 2)
        play_if_ready("boost", 0)
        play_if_ready("hot", 0)
        play_if_ready("goliath", 0)

    # Lane 1 actions
    if et1:
        summon_units("charger", 1)
        summon_units("driver", 1)
        summon_units("threat", 1)
        play_if_ready("boost", 1)
        play_if_ready("hot", 1)
        play_if_ready("goliath", 1)

    # Lane 2 actions
    if et2:
        summon_units("charger", 2, 2)
        summon_units("threat", 2)
        play_if_ready("hot", 2)
        play_if_ready("goliath", 2)

    # Reinforcement strategy
    for lane, enemies in enumerate([et0, et1, et2]):
        if enemies and hero.isReady("hot") and hero.isReady("goliath"):
            summon_units("big", lane)
            play_if_ready("hot", lane)
            play_if_ready("boost", lane)
            play_if_ready("goliath", lane)

Need some help, actually…

first you can switch your quicksand code from this:

def quicksand():
    et11 = hero.findPlayers(1)
    et22 = hero.findPlayers(2)
    et00 = hero.findPlayers(0)
    
    if hero.isReady("quicksand"):
        if len(et11) >= 2: 
            play_if_ready("quicksand", 1)
            play_if_ready("press", 2)
        elif len(et22) >= 2:
            play_if_ready("quicksand", 2)
            play_if_ready("press", 1)
        elif len(et00) >= 2:
            play_if_ready("quicksand", 0)

into this:

def quicksand(lane):
    enemy = hero.findTheirPlayers(lane)
    if len(enemy) >= 2:
        play_if_ready("quicksand", lane)

it’s much more clean (:D)

one thing else to note is the way you’re noting the enemy summons below, the reinforcement strat is placed on the lowest part which means it will run on last priority so you might have to fix that

1 Like