// Nie atakuj burli!
// Funkcja może zwracać dane.
// Kiedy funkcja zostaje użyta jest jednoznaczna z informacją zwrotną.

function shouldAttack(target) {
    // return false
    if (!target) {
        return false;
    }
    // return false
    if (enemy.type == "burl"){
        return false;
    }

// Cudownapolana się zmieniła od naszej ostatniej wizyty.
// Ogry  rzuciły na to klątwę i musimy je pokonać.
// Burl nadal zbiera  klejnoty, nie dotykaj go.
// Ponadto nie atakuj Burla.

while (true) {
    // Znajdź najbliższy przedmiot.
    // Zbierz je(jeśli są) tylko wtedy gdy to nie jest klejnot.
    var item = hero.findNearestItem();
    if (item && item.type != "gem") {

Zadziałało ale nie jestem pewien czy to dobre rozwiązanie - raczej powinien dookoła przejść

Widziałem podobne rozwiązanie w necie ale poszedł dołem

 

// Move to the wizard and get their secret values.
hero.moveXY(20, 24);
var secretA = hero.findNearestFriend().getSecretA();
var secretB = hero.findNearestFriend().getSecretB();
var secretC = hero.findNearestFriend().getSecretC();

// If ALL three values are true, take the high path.
// Otherwise, take the low path. Save the 4th value.
var secretD = secretA && secretB && secretC;
if (secretD)

// Sneak through the forest and ambush the shaman.
// Listen to 'Commander Craig' for warning of approaching enemy.

// Place flags after pressing Submit.
while(true) {
    var flag = hero.findFlag();
    var enemy = hero.findNearestEnemy();
    if (flag){
        // Pick the flag up.

CLEAVE okazało się niepotrzebne - trzeba zmienić bohatera na ŁUCZNIKA

 

// Nadchodzi armia ogrów. Użyj flag by wygrać bitwę !
while(true) {
    var flag = hero.findFlag();
    var enemy = hero.findNearestEnemy();
    if (flag){
                hero.pickUpFlag(flag);
    } else if (enemy){
        hero.attack(enemy);

<!-- The 'toggleClass' jQuery function turns on/off... -->
<!-- ... classes whether or not the class is off/on. -->

<script>
    var image = $("img");
    var header = $("h1");
    function toggleExpand() {
        image.toggleClass("expand");
        // Toggle class "expand" on the 'h1' tag by using the header variable we just created
        header.toggleClass("expand");
    }