function cleaveOrAttack(enemy) {
// Jeśli "cleave " jest gotowe ,cleave , w przeciwnym przypadku atakuj.
if (hero.isReady("cleave")) {
hero.cleave(enemy);
function cleaveOrAttack(enemy) {
// Jeśli "cleave " jest gotowe ,cleave , w przeciwnym przypadku atakuj.
if (hero.isReady("cleave")) {
hero.cleave(enemy);
// W tym poziomi użyjesz funkcji z dwoma parametrami
// Look at the structure below, notice how there are two arguments.
// These are both accessible within the function.
function checkAndAttack(x, y) {
// First move to the coordinates provided by the parameters.
hero.moveXY(x, y);
// Następnie sprawdź czy jest wróg
// You now have a pet!
function speak(event) {
// Your pet should respond with pet.say()
// A forgotten tomb in the forest!
// But the ogres are hot on your heels.
// Break open the tomb, while defending yourself from the munchkins.
// This function should attack an enemy if it exists, otherwise attack the door!
function checkToDefend(target) {
// Check if the `target` exists
if (target) {
// This shows how to define a function called cleaveWhenClose
// The function defines a parameter called `target`
function cleaveWhenClose(target) {
if(hero.distanceTo(target) < 5) {
// Put your attack code here
// If cleave is ready, then cleave target
if (hero.isReady("cleave")) {
hero.cleave(enemy);
}
// Jedyne wyjście jest zablokowane przez ogry.
// Chowaj się przed kościotrupami i zabijaj ogry jeden po drugim.
// Ta funkcja powinna atakować wroga i chować.
function hitOrHide(target) {
// Jeżeli cel istnieje:
if (target) {
// Przechwyć wszystkie ogrze wiadomości z zasadzki.
function ambushAttack(target) {
// Zaatakuj cel jeśli istnieje i powróć na znak.
// Napisz funkcję.
// Gather 4 lightstones to defeat the Brawler.
// If you find a lightstone, hide.
function checkTakeHide(item) {
if (item) {
// The item is here, so take it.
hero.moveXY(item.pos.x, item.pos.y);
// Then move to the center of the camp (40, 34)
hero.moveXY(40, 34);
}
}