Skip to content

"Attack" item bug #4636

Open
Open

Description

This is the code I put into the console while playing the "Usual Day" level:

// Defeat munchkins, collect coins. Everything as usual.
// Use AND to check existence and type in one statement.
while (true) {
    var enemy = hero.findNearestEnemy();
    // With AND, the type is only checked if enemy exists.
    if (enemy && enemy.type === "munchkin") {
        hero.attack(enemy);
    }
    // Find the nearest item.
    var item = hero.findNearestItem();
    // Collect item if it exists and its type is "coin".
    if (item && item.type === "coin") {
        hero.attack(item);
    }
}

The loop wont continue and my hero only iterates through the two commands and then stops. I cant get past this level. Is it my code or is this a bug?

Activity

  1. changed the title [-]USUAL DAY bug[/-] [+]"Attack" item bug[/+] on Mar 1, 2018
  2. Bryukh commented on Mar 1, 2018

    @Bryukh
    Collaborator

    Thanks. That's not a problem of the level. We will add a custom error for the case when you're attacking an item.

  3. self-assigned this
    on Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions