Reporting bug in: "Diamond Dozen"


#1

Hi, I am experiencing a problem with this level.
Firstly, the wining conditions shouldnt be vague as collec the optimal ammount of coins. That is what? 30? 70? I know that maybe they are randomised, but it makes the whole level confusing.
Second thing, I perssume, the diamonds have greater value than low-cost coins and my hero will collect diamonds. So you should state if players should be going around them or not.
And the last issue:
The coins are disappering usually too fast. Even when I applied my other weapons to battle (lighting attack) it seems that sometimes, the coins are there for less than tree seconds, other times for much more time.
my code looks like this:

# Claim the coins while defeating the marauding ogres.
def findMostHealth(enemies):
    target = None
    targetHealth = 0
    enemyIndex = 0
    while enemyIndex < len(enemies):
        enemy = enemies[enemyIndex]
        if enemy.health > targetHealth:
            target = enemy
            targetHealth = enemy.health
        enemyIndex += 1
    return target

def valueOverDistance(item):
    return item.value / hero.distanceTo(item)

# Return the item with the highest valueOverDistance(item)
def findBestItem(items):
    bestItem = None
    bestValue = 0
    itemsIndex = 0
    # Loop over the items array.
    # Find the item with the highest valueOverDistance()
    while itemsIndex < len(items):
        item = items[itemsIndex]
        if item.value > bestValue:
            bestItem  = item
            bestValue = item.value
        itemsIndex += 1
    return bestItem

while True:
    enemies = hero.findEnemies()
    enemy = findMostHealth(enemies)
    coins = hero.findItems()
    coin = None
    coin = findBestItem(coins)
    if coin:
        hero.moveXY(coin.pos.x, coin.pos.y)
    if enemy and enemy.health > 15:
        while enemy.health > 0:
            if hero.isReady("chain-lightning"):
                hero.cast("chain-lightning", enemy)
            elif hero.isReady("cleave"): 
                hero.cleave(enemy)
            else:
                hero.attack(enemy)


#2

if enemy and enemy.health > 15:
…while enemy.health > 0:
…hero.attack(enemy)
#Do not change the code, this level requires a better sword or more health.


#3

Thank you for the advice, but, there is no suggestion in the level assignment that you should pass only with those two items. Or so to say “Do not change the code” warning.
So it is still a bug.


#4

What boots were you using because it kind of depends because they can’t make it be like you have armored boots the coins disappear this fast or you have ring of speed the coins disappear this fast. It may be a bug but I don’t see an easy way to fix it.


#5

#I use “leather boots”, “long sword”, and more health(1767 health)!


#6

No. Actually I made a mistake in my code. Do not want to spoil it for anyone. But still if administrator comes around, take a look at my advices for making the quest more specific and explained.