public VirtualUnit(int fnum, int flvl, Character.Class_Type fctype, String forg, String fname) { org = forg; num = fnum; lvl = flvl; ctype = fctype; name = fname; }
public Item(String fname, Item_Type ftype, int fcost, Character.Stats.Traits fmod, OtherEffect fce) { effect = fce; cost = fcost; mod = fmod; name = fname; type = ftype; }
public Item(String fname, Item_Type ftype, int fcost, Character.Stats.Traits fmod) { effect = new OtherEffect(); effect.hp = 0; effect.mp = 0; cost = fcost; mod = fmod; name = fname; type = ftype; }
public String attack(Character c) { int dmg = attackDmg(); int h = hit(c); if (h <= 0) return "MISS"; //if (h >= 20) // dmg = (int)Math.Ceiling((double)dmg * 1.5); return c.recPhyDmg(dmg).ToString(); }
public Unit(Character fleader, String n) { deployed = false; map = new Character[4, 4]; leader = fleader; name = n; org = "main"; inv = new Inventory(); dead = false; map[0, 0] = leader; leader.Position = new Point(0, 0); resetMovement(); }
public static XmlElement charToXml(XmlDocument doc, Character c) { XmlElement e = doc.CreateElement("Character"); e.AppendChild(stat(doc, c.stats)); if (c == GameState.CurrentState.mainChar) e.SetAttribute("main", "main"); e.SetAttribute("org", c.Organization); e.SetAttribute("lvl", c.Lvl.ToString()); e.SetAttribute("exp", c.Exp.ToString()); e.SetAttribute("name", c.Name); e.SetAttribute("type", c.Type.ToString()); return e; }
public GameState() { turn = 0; alignment = 0; att = 0; saved = false; mainArmy = new Army(); mainChar = null; mainCharPos = new Point(-1, -1); gen = null; citymap = new Dictionary<String, CityMap>(); citymap.Add("gen", Content.Instance.gen.CityMap.clone()); foreach (String s in Tilemap.reflist("map\\gen.map")) citymap.Add(s, new Tilemap(s).CityMap.clone()); }
public Unit(Character fleader, int x, int y) { deployed = false; map = new Character[4, 4]; leader = fleader; name = leader.Name; dead = false; org = "main"; map[x, y] = leader; leader.Position = new Point(x, y); us = Graphic.getSprite(leader); inv = new Inventory(); resetMovement(); }
/// <summary> /// Tries to place a Character in the Unit in the first available spot /// </summary> /// <param name="u">Unit to place the Character in</param> /// <param name="c">Character to place</param> /// <returns>true if the unit was placed, false if there is no spot left</returns> private bool place(Unit u, Character c) { for (int i=0; i<4; i++) for (int e = 0; e < 4; e++) if (u.get(i, e) == null) { u.set(i, e, c); return true; } return false; }
/// <summary> /// Tries to place a Character in the Unit in the preferred spot in order provided. Otherwise it /// places the Character in the first available spot. /// </summary> /// <param name="u">Unit to place the Character in</param> /// <param name="prefPos">Prefered positions in order</param> /// <param name="c">Character to place</param> /// <returns>true if the unit was placed, false if there is no spot left</returns> private bool place(Unit u, Character c, int[,] prefPos) { for(int i=0; i<prefPos.GetLength(0); i++) if(place(u, c, prefPos[i,0], prefPos[i,1])) return true; return place(u, c); }
public void setDefeatBoss(Character fc) { type = Objective_Type.DEFEAT_BOSS; c = fc; }
public EquipmentManage(Character fc, Unit u) { MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_bigMenu; selEq = 0; c = fc; unit = u; uitemls = new List<Item>(); lbl_name = new Label("Character Name"); lbl_name.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_name.Position = new Vector2(50, 50); MainWindow.add(lbl_name); lbl_cname = new Label(c.Name); lbl_cname.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_cname.Position = new Vector2(250, 50); MainWindow.add(lbl_cname); lbl_title = new Label("Character Equipment"); lbl_title.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.TITLE; lbl_title.Position = new Vector2(250, 100); MainWindow.add(lbl_title); lbl_eq = new Label("Equipment"); lbl_eq.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_eq.Position = new Vector2(140, 130); MainWindow.add(lbl_eq); menu_eq = new Menu(3); menu_eq.Position = new Vector2(120, 140); MainWindow.add(menu_eq); lbl_weapon = new Label("Weapon"); lbl_weapon.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_weapon.Position = new Vector2(10, 180); MainWindow.add(lbl_weapon); lbl_armor = new Label("Armor"); lbl_armor.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_armor.Position = new Vector2(10, 200); MainWindow.add(lbl_armor); lbl_accesory = new Label("Accesory"); lbl_accesory.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_accesory.Position = new Vector2(10, 220); MainWindow.add(lbl_accesory); lbl_uitem = new Label("Unit's Item"); lbl_uitem.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_uitem.Position = new Vector2(450, 130); MainWindow.add(lbl_uitem); menu_uitem = new Menu(8); menu_uitem.Position = new Vector2(430, 140); MainWindow.add(menu_uitem); lbl_enter = new Label("ENTER"); lbl_enter.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL; lbl_enter.Position = new Vector2(50, 410); MainWindow.add(lbl_enter); lbl_enterGive = new Label("Equip Item"); lbl_enterGive.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_enterGive.Position = new Vector2(120, 410); MainWindow.add(lbl_enterGive); lbl_v = new Label("V"); lbl_v.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL; lbl_v.Position = new Vector2(50, 440); MainWindow.add(lbl_v); lbl_vView = new Label("View Item"); lbl_vView.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_vView.Position = new Vector2(80, 440); MainWindow.add(lbl_vView); lbl_u = new Label("U"); lbl_u.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL; lbl_u.Position = new Vector2(50, 470); MainWindow.add(lbl_u); lbl_uAction = new Label("Unequip Item"); lbl_uAction.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_uAction.Position = new Vector2(80 , 470); MainWindow.add(lbl_uAction); lbl_esc = new Label("ESC"); lbl_esc.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL; lbl_esc.Position = new Vector2(50, 500); MainWindow.add(lbl_esc); lbl_escAction = new Label("Go Back"); lbl_escAction.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_escAction.Position = new Vector2(100, 500); MainWindow.add(lbl_escAction); update_menuUItem(); update_menuEq(); inMenuEq = true; menu_uitem.TabStop = false; menu_uitem.unfocusLink(); update_lblView(); if (unit == null) { lbl_enter.Visible = false; lbl_enterGive.Visible = false; } }
/// <summary> /// Derp, never used in the code? /// </summary> /// <param name="c"></param> /// <param name="np"></param> private void moveChar(Character c, Point np) { for (int x = 0; x < tm.NumX; x++) { for (int y = 0; y < tm.NumY; y++) { if (cmap.get(x, y) == c) scp = new Point(x, y); } } Tile t = tm.get(np.X, np.Y); if (t.Type == Tile.TileType.WATER || t.Type == Tile.TileType.MOUNTAIN) return; if (cmap.isChar(np.X, np.Y)) return; cmap.move(scp.X, scp.Y, np.X, np.Y); cmap.update(map); scp = np; changeCurp(this, new EventArgObject(new Point(np.X, np.Y))); map.focus(np.X, np.Y); }
public String attack(Character c, Spell sp) { int dmg = attackDmg(sp); return c.recMagicDmg(dmg).ToString(); }
public bool gainExp(Character c) { int gexp = XPFACTOR; if(c.level<level) gexp /= (level - c.level); else if (c.level > level) gexp *= (c.level - level); return gainExp(gexp); }
public static XmlElement traits(XmlDocument doc, Character.Stats.Traits traits) { XmlElement e = doc.CreateElement("Traits"); e.SetAttribute("str", traits.str.ToString()); e.SetAttribute("dex", traits.dex.ToString()); e.SetAttribute("con", traits.con.ToString()); e.SetAttribute("wis", traits.wis.ToString()); e.SetAttribute("intel", traits.intel.ToString()); e.SetAttribute("spd", traits.spd.ToString()); return e; }
public CharManage(Character selectedChar, Unit u) { MainWindow.BackgroundImage = Content.Graphics.Instance.Images.background.bg_bigMenu; c = selectedChar; unit = u; lbl_charMng = new Label("Character Management"); lbl_charMng.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.TITLE; lbl_charMng.Position = new Vector2(50, 30); charPic = new PictureBox(); charPic.Image = Graphic.getSprite(c); charPic.Size = new Vector2(384, 384); charPic.Position = new Vector2(0, 30); MainWindow.add(lbl_charMng); MainWindow.add(charPic); lbl_name = new Label(c.Name); lbl_name.Position = new Vector2(340, 80); MainWindow.add(lbl_name); lbl_class = new Label(c.Type.ToString()); lbl_class.Position = new Vector2(340, 110); MainWindow.add(lbl_class); lbl_level = new Label("Level:"); lbl_level.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_level.Position = new Vector2(340, 140); MainWindow.add(lbl_level); lbl_clevel = new Label(c.Lvl.ToString()); lbl_clevel.Position = new Vector2(400, 140); MainWindow.add(lbl_clevel); lbl_exp = new Label("Exp:"); lbl_exp.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_exp.Position = new Vector2(460, 140); MainWindow.add(lbl_exp); lbl_cexp = new Label(c.Exp.ToString()); lbl_cexp.Position = new Vector2(505, 140); MainWindow.add(lbl_cexp); lbl_hp = new Label("HP:"); lbl_hp.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_hp.Position = new Vector2(340, 170); MainWindow.add(lbl_hp); lbl_currHp = new Label(c.stats.hp.ToString()); lbl_currHp.Position = new Vector2(460, 170); MainWindow.add(lbl_currHp); lbl_hpSlash = new Label("/"); lbl_hpSlash.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_hpSlash.Position = new Vector2(500, 170); MainWindow.add(lbl_hpSlash); lbl_maxHp = new Label(c.stats.maxHp.ToString()); lbl_maxHp.Position = new Vector2(515, 170); MainWindow.add(lbl_maxHp); lbl_mana = new Label("Mana:"); lbl_mana.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_mana.Position = new Vector2(340, 200); MainWindow.add(lbl_mana); lbl_currMana = new Label(c.stats.mana.ToString()); lbl_currMana.Position = new Vector2(460, 200); MainWindow.add(lbl_currMana); lbl_manaSlash = new Label("/"); lbl_manaSlash.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_manaSlash.Position = new Vector2(500, 200); MainWindow.add(lbl_manaSlash); lbl_maxMana = new Label(c.stats.maxMana.ToString()); lbl_maxMana.Position = new Vector2(515, 200); MainWindow.add(lbl_maxMana); lbl_state = new Label("State:"); lbl_state.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_state.Position = new Vector2(340, 230); MainWindow.add(lbl_state); lbl_cstate = new Label(c.stats.state.ToString()); lbl_cstate.Position = new Vector2(460, 230); MainWindow.add(lbl_cstate); lbl_force = new Label("Strength:"); lbl_force.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_force.Position = new Vector2(340, 260); MainWindow.add(lbl_force); lbl_cforce = new Label(c.stats.traits.str.ToString()); lbl_cforce.Position = new Vector2(460, 260); MainWindow.add(lbl_cforce); lbl_dex = new Label("Dexterity:"); lbl_dex.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_dex.Position = new Vector2(340, 290); MainWindow.add(lbl_dex); lbl_cdex = new Label(c.stats.traits.dex.ToString()); lbl_cdex.Position = new Vector2(460, 290); MainWindow.add(lbl_cdex); lbl_intel = new Label("Intelligence:"); lbl_intel.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_intel.Position = new Vector2(340, 320); MainWindow.add(lbl_intel); lbl_cintel = new Label(c.stats.traits.intel.ToString()); lbl_cintel.Position = new Vector2(460, 320); MainWindow.add(lbl_cintel); lbl_sag = new Label("Wisdom:"); lbl_sag.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_sag.Position = new Vector2(550, 260); MainWindow.add(lbl_sag); lbl_csag = new Label(c.stats.traits.wis.ToString()); lbl_csag.Position = new Vector2(670, 260); MainWindow.add(lbl_csag); lbl_spd = new Label("Speed:"); lbl_spd.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_spd.Position = new Vector2(550, 290); MainWindow.add(lbl_spd); lbl_cspd = new Label(c.stats.traits.spd.ToString()); lbl_cspd.Position = new Vector2(670, 290); MainWindow.add(lbl_cspd); lbl_con = new Label("Constitution:"); lbl_con.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_con.Position = new Vector2(550, 320); MainWindow.add(lbl_con); lbl_ccon = new Label(c.stats.traits.con.ToString()); lbl_ccon.Position = new Vector2(670, 320); MainWindow.add(lbl_ccon); lbl_move = new Label("Movement:"); lbl_move.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_move.Position = new Vector2(550, 350); MainWindow.add(lbl_move); lbl_cmove = new Label(c.stats.movement.ToString()); lbl_cmove.Position = new Vector2(670, 350); MainWindow.add(lbl_cmove); lbl_org = new Label("Organization:"); lbl_org.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.BOLD; lbl_org.Position = new Vector2(340, 350); MainWindow.add(lbl_org); lbl_corg = new Label(c.Organization); lbl_corg.Position = new Vector2(460, 350); MainWindow.add(lbl_corg); lbl_esc = new Label("ESC"); lbl_esc.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL; lbl_esc.Position = new Vector2(50, 440); MainWindow.add(lbl_esc); lbl_escAction = new Label("Go Back"); lbl_escAction.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; lbl_escAction.Position = new Vector2(100, 440); MainWindow.add(lbl_escAction); lbl_e = new Label("E"); lbl_e.Position = new Vector2(50, 470); lbl_e.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.CONTROL; if (selectedChar.Organization == "enemy") lbl_e.Visible = false; else lbl_e.Visible = true; MainWindow.add(lbl_e); lbl_eAction = new Label("Equipment"); lbl_eAction.Position = new Vector2(80, 470); lbl_eAction.LabelFun = ColorTheme.LabelColorTheme.LabelFunction.NORM; if (selectedChar.Organization == "enemy") lbl_eAction.Visible = false; else lbl_eAction.Visible = true; MainWindow.add(lbl_eAction); }
public static XmlElement stat(XmlDocument doc, Character.Stats stats) { XmlElement e = doc.CreateElement("Stat"); e.AppendChild(traits(doc, stats.traits)); e.SetAttribute("state", stats.state.ToString()); e.SetAttribute("hp", stats.hp.ToString()); e.SetAttribute("maxhp", stats.maxHp.ToString()); e.SetAttribute("mana", stats.mana.ToString()); e.SetAttribute("maxmana", stats.maxMana.ToString()); e.SetAttribute("movement", stats.movement.ToString()); return e; }
/// <summary> /// Generates a TileMap with the given CharMap and Character (and Tilemap and Organization) /// </summary> /// <param name="cmap">The CharMap to use</param> /// <param name="c">The Character to base the map on</param> /// <param name="tm">Tilemap (not the pathfind one)</param> /// <param name="org">Organization to base the map from (determins who is ally and who is enemy)</param> /// <returns>a PathFind.TileMap</returns> public static TileMap gen(CharMap cmap, Tilemap tm, String org, Character c) { TileMap ptm = new TileMap(tm.NumX, tm.NumY); for (int i = 0; i < tm.NumX; i++) for (int e = 0; e < tm.NumY; e++) if (!c.canMove(tm.get(i, e).Type)) ptm.set(i, e, Tile_Type.BLOCK_TERRAIN); else if (!cmap.canMove(i, e)) ptm.set(i, e, Tile_Type.BLOCK_UNIT); else ptm.set(i, e, Tile_Type.NOTHING); return ptm; }
public void setLeader(int x, int y) { Character c=map[x, y]; if (c != null) leader = c; us = Graphic.getSprite(leader); }
public void set(int x, int y, Character c) { map[x, y] = c; if(c!=null) c.Position = new Point(x, y); resetMovement(); }
/// <summary> /// Tries to place a Character at the given place in a unit /// </summary> /// <param name="u">Unit to place the Character in</param> /// <param name="c">Character to place</param> /// <param name="x">Position in x</param> /// <param name="y">Position in y</param> /// <returns>true if the unit was placed, false if there was already someon in the spot</returns> private bool place(Unit u, Character c, int x, int y) { if (u.get(x, y) != null) return false; u.set(x, y, c); return true; }
public int heal(Character c) { return c.getHp(healP()); }
/// <summary> /// Try to place a generated character at its best place according to class /// </summary> /// <param name="u">Unit to add the Character to</param> /// <param name="c">Character to add</param> private void placePref(Unit u, Character c) { int[,] prefPos; int[,] archer={{0,0}, {3,0}, {1,0}, {2,0}}; int[,] caster = { { 1, 2 }, { 2, 2 }, { 0, 2 }, { 3, 2 } }; int[,] fighter = { { 1, 3 }, { 2, 3 }, { 0, 3 }, { 3, 3 } }; int[,] healer = { { 1, 1 }, { 2, 1 }, { 1, 2 }, { 2, 2 } }; int[,] scout = { { 0, 1 }, { 3, 1 }}; int[,] none={{0,0}}; if (ctype == Character.Class_Type.ARCHER) prefPos=archer; else if (ctype == Character.Class_Type.CASTER) prefPos = caster; else if (ctype == Character.Class_Type.FIGHTER) prefPos = fighter; else if (ctype == Character.Class_Type.HEALER) prefPos = healer; else if (ctype == Character.Class_Type.SCOUT) prefPos = scout; else prefPos=none; place(u, c, prefPos); }
protected int hit(Character c) { //return Gen.d(1, 20) + (stats.traits.dex-c.stats.traits.dex); int rng = Gen.d(1, 100); int hitRate = 0; int dexDiff = (int)(stats.traits.dex - c.stats.traits.dex); if(dexDiff > 0) { hitRate = 90 + (int)(Math.Pow(0.0004 * (double)dexDiff, 2.0) + 0.0487 * (double)dexDiff); } else if(dexDiff < 0) { hitRate = 90 - (int)(Math.Pow(0.0052 * (double)(dexDiff), 2.0) + 0.1382 * (double)dexDiff); } else { hitRate = 90; } Console.WriteLine("RNG: " + rng + " Hit Rate: " + hitRate); return hitRate - rng; }
public Unit(Character fleader, String n, String forg) { deployed = false; map = new Character[5, 5]; leader = fleader; name = n; dead = false; inv = new Inventory(); org = forg; map[0, 0] = leader; leader.Position = new Point(0, 0); us = Graphic.getSprite(leader); resetMovement(); }
private static Point targetCharacter(Character c, Point p, CharMap cmap) { bool targetable = false; bool castable = false; List<Point> targetableChar = new List<Point>(); Point target = new Point(-1, -1); if (c is Fighter || c is Scout) { if (cmap.isChar(p.X - 1, p.Y) && cmap.get(p.X - 1, p.Y).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X - 1, p.Y)); } if (cmap.isChar(p.X, p.Y - 1) && cmap.get(p.X, p.Y - 1).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X, p.Y - 1)); } if (cmap.isChar(p.X + 1, p.Y) && cmap.get(p.X + 1, p.Y).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X + 1, p.Y)); } if (cmap.isChar(p.X, p.Y + 1) && cmap.get(p.X, p.Y + 1).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X, p.Y + 1)); } } else if (c is Archer) { if (cmap.isChar(p.X - 1, p.Y + 1) && cmap.get(p.X - 1, p.Y + 1).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X - 1, p.Y + 1)); } if (cmap.isChar(p.X - 1, p.Y - 1) && cmap.get(p.X - 1, p.Y - 1).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X - 1, p.Y - 1)); } if (cmap.isChar(p.X + 1, p.Y + 1) && cmap.get(p.X + 1, p.Y + 1).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X + 1, p.Y + 1)); } if (cmap.isChar(p.X + 1, p.Y - 1) && cmap.get(p.X + 1, p.Y - 1).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X + 1, p.Y - 1)); } if (cmap.isChar(p.X - 2, p.Y) && cmap.get(p.X - 2, p.Y).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X - 2, p.Y)); } if (cmap.isChar(p.X, p.Y - 2) && cmap.get(p.X, p.Y - 2).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X, p.Y - 2)); } if (cmap.isChar(p.X + 2, p.Y) && cmap.get(p.X + 2, p.Y).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X + 2, p.Y)); } if (cmap.isChar(p.X, p.Y + 2) && cmap.get(p.X, p.Y + 2).Organization == "main") { targetable = true; targetableChar.Add(new Point(p.X, p.Y + 2)); } } else if (c is Healer) { if (cmap.isChar(p.X - 1, p.Y) && cmap.get(p.X - 1, p.Y).Organization == "ennemy") { castable = true; targetableChar.Add(new Point(p.X - 1, p.Y)); } if (cmap.isChar(p.X, p.Y - 1) && cmap.get(p.X, p.Y - 1).Organization == "ennemy") { castable = true; targetableChar.Add(new Point(p.X, p.Y - 1)); } if (cmap.isChar(p.X + 1, p.Y) && cmap.get(p.X + 1, p.Y).Organization == "ennemy") { castable = true; targetableChar.Add(new Point(p.X + 1, p.Y)); } if (cmap.isChar(p.X, p.Y + 1) && cmap.get(p.X, p.Y + 1).Organization == "ennemy") { castable = true; targetableChar.Add(new Point(p.X, p.Y + 1)); } } else if (c is Caster) { if (cmap.isChar(p.X - 1, p.Y) && cmap.get(p.X - 1, p.Y).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X - 1, p.Y)); } if (cmap.isChar(p.X, p.Y - 1) && cmap.get(p.X, p.Y - 1).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X, p.Y - 1)); } if (cmap.isChar(p.X + 1, p.Y) && cmap.get(p.X + 1, p.Y).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X + 1, p.Y)); } if (cmap.isChar(p.X, p.Y + 1) && cmap.get(p.X, p.Y + 1).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X, p.Y + 1)); } if (cmap.isChar(p.X - 1, p.Y + 1) && cmap.get(p.X - 1, p.Y + 1).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X - 1, p.Y + 1)); } if (cmap.isChar(p.X - 1, p.Y - 1) && cmap.get(p.X - 1, p.Y - 1).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X - 1, p.Y - 1)); } if (cmap.isChar(p.X + 1, p.Y + 1) && cmap.get(p.X + 1, p.Y + 1).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X + 1, p.Y + 1)); } if (cmap.isChar(p.X + 1, p.Y - 1) && cmap.get(p.X + 1, p.Y - 1).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X + 1, p.Y - 1)); } if (cmap.isChar(p.X - 2, p.Y) && cmap.get(p.X - 2, p.Y).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X - 2, p.Y)); } if (cmap.isChar(p.X, p.Y - 2) && cmap.get(p.X, p.Y - 2).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X, p.Y - 2)); } if (cmap.isChar(p.X + 2, p.Y) && cmap.get(p.X + 2, p.Y).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X + 2, p.Y)); } if (cmap.isChar(p.X, p.Y + 2) && cmap.get(p.X, p.Y + 2).Organization == "main") { castable = true; targetableChar.Add(new Point(p.X, p.Y + 2)); } } if (targetable) { foreach (Point pt in targetableChar) { if (target == new Point(-1, -1) || cmap.get(pt.X, pt.Y).stats.hp < cmap.get(target.X, target.Y).stats.hp) target = pt; } } if (castable) { foreach (Point pt in targetableChar) { if (target == new Point(-1, -1) || cmap.get(pt.X, pt.Y).stats.hp < cmap.get(target.X, target.Y).stats.hp) target = pt; } } return target; }