import java.util.*; public class Confuse1 extends Illusions { String target; String spellName= "Misinformation"; int manaCost = 10; int level = 1; String[] targets = {"dragon"}; String description= "When cast upon a dragon he will get confused on the exact location of his destination. He will not go to his original destination exactly, but not far off.";; /** * Should as the string argument take city#cityname or dragon#dragonname */ public void cast(Fod game, int playerNr, String arg) { System.out.println("Player "+playerNr+" casts "+spellName+" on "+arg); Object o = game.dragons.get(arg); if(o!=null){ Dragon d = (Dragon)o; d.Looks[1] = 4; Area dest = d.getDestination(game.Map); //Sätt om drakens destination; int x_mis = 1-Dice.rand(2); int y_mis = 1-Dice.rand(2); if(dest.x + x_mis >= 0 && dest.x +x_mis <= game.world.X_SIZE -1) d.X_destination = (short)(dest.x+x_mis); if(dest.y + y_mis >= 0 && dest.y +y_mis <= game.world.Y_SIZE -1) d.Y_destination = (short)(dest.y+y_mis); } } ////Primitves public String getSpellName(){ return spellName; } public String getDescription(){ return description; } public int getManaCost(){ return manaCost; } public int getLevel(){ return level; } public String[] getTargetProfile(){ return targets; } public String getTarget(){ return target; } public String setTarget(String t){ target = t; return target; } }