//Try to get the best grade (gold) at the magic exam.
// Move to each X mark, then use a spell.
var item = hero.findNearestItem();
var enemy = hero.findNearestEnemy();
hero.moveXY(18, 24);
var friend = hero.findNearestFriend();
if (friend) {
hero.cast("heal", friend);
}
if (enemy) {
hero.cast("force-bolt", enemy);
}
hero.moveXY(34, 24);
if (friend) {
hero.cast("heal", friend);
}
if (enemy) {
hero.cast("poison-cloud", enemy);
}
hero.moveXY(50, 24);
if (friend) {
hero.cast("grow", friend);
}
if (enemy) {
hero.cast("force-bolt", enemy);
}
hero.moveXY(18, 40);
if (friend) {
hero.cast("heal", friend);
}
if (enemy) {
hero.cast("force-bolt", enemy);
}
hero.moveXY(34, 40);
if (friend) {
hero.cast("heal", friend);
}
if (enemy) {
hero.cast("force-bolt", enemy);
}
hero.moveXY(50, 40);
if (friend) {
hero.cast("heal", friend);
}
if (enemy) {
hero.cast("force-bolt", enemy);
}
hero.moveXY(66, 40);
if (item) {
if (item.type == "potion") {
hero.moveXY(item.pos.x, item.pos.y);
}
}
hero.moveXY(66, 24);
if (item) {
if (item.type == "potion") {
hero.moveXY(item.pos.x, item.pos.y);
}
if (item.type == "poison") {
hero.cast("shrink", item);
}
}
not all friends need to be healed, one needs to be regened. 2. I don’t think that you can cast shrink on the poison(at least, that’s not what I did) and 3. open the top and bottom doors in a column, before preforming the spells and looking for targets.(the top could have something good OR something bad, you don’t know until you open it.) I hope that helps.
Okay, look at it this way. Okar you need to grow, shrink the brawler, poison cloud cast for scout, ogre force-bolt, poison cast grow on yourself and then drink it, potion drink, paladin regen.
You check whether the type is “potion” or “poison”. If it’s “potion”, you moveXY to the location because it’s good for you. And if it’s “poison”, you’ll want to cast “grow” on yourself so you don’t die from the effects.
Danny
As I said, I would find it really helpful if you would use a function that checks what type the friend/enemy is. Then you would use the correct spell on that.
Last you would need to Use the function consecutive times like this:
(These coordinates are not the real ones)