import java.util.*; public class Control2 extends Mentalism { String target; String spellName= "Conqueror of the Mind"; int manaCost = 60; int level = 6; String[] targets = {"dragon"}; String description= "With this spell you can take the control of an enemy dragon"; /** * 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); Dragon o = (Dragon)game.dragons.get(arg); if (o != null){ Dragon d = (Dragon)o; boolean safe = false; if(Dice.roll() < d.Wisdom) safe = true; if(d.fake) safe = true; if (!safe){ game.players[d.Owner].messages += "|@|"+d.name+" had a too weak soul and left you for another mage"; d.Owner = (short)playerNr; game.players[d.Owner].messages += "|@|"+d.name+" has joined your forces"; } } } ////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; } }