public Ally(Character c, int x, int y, int e) { _c = c; _abilityState = new AbilityState(); int vStep = Globals.BattleSpeed; _c_timer = new ScaledClock(10000); _v_timer = new ScaledClock(vStep); _turnTimer = new ScaledTimer(6000, e, Globals.TurnTimerSpeed(this, vStep)); _x = x; _y = y; GetMagicSpells(); GetSummons(); _battleMenu = new BattleMenu(this); _magicMenu = new MagicMenu(MagicSpells, _battleMenu.WMagic); if (!_magicMenu.IsValid) { _magicMenu = null; } _summonMenu = new SummonMenu(Summons, _battleMenu.WSummon); if (!_summonMenu.IsValid) { _summonMenu = null; } EnemySkillMateria m = new EnemySkillMateria(GetEnemySkillMask()); if (m.AP > 0) { _enemySkillMenu = new EnemySkillMenu(m); } if (HP == 0) { InflictDeath(); } }
public Enemy(string xmlstring, int x, int y) { _xml = xmlstring; _weak = new List<Element>(); _halve = new List<Element>(); _void = new List<Element>(); _absorb = new List<Element>(); _immune = new List<Status>(); _win = new List<EnemyItem>(); _steal = new List<EnemyItem>(); _abilityState = new AbilityState(); XmlDocument xml = new XmlDocument(); xml.Load(new MemoryStream(Encoding.UTF8.GetBytes(xmlstring))); _name = xml.SelectSingleNode("//name").InnerText; _attack = Int32.Parse(xml.SelectSingleNode("//atk").InnerText); _defense = Int32.Parse(xml.SelectSingleNode("//def").InnerText); _defensePercent = Int32.Parse(xml.SelectSingleNode("//defp").InnerText); _dexterity = Int32.Parse(xml.SelectSingleNode("//dex").InnerText); _magicAttack = Int32.Parse(xml.SelectSingleNode("//mat").InnerText); _magicDefense = Int32.Parse(xml.SelectSingleNode("//mdf").InnerText); _luck = Int32.Parse(xml.SelectSingleNode("//lck").InnerText); _level = Int32.Parse(xml.SelectSingleNode("//lvl").InnerText); _maxhp = _hp = Int32.Parse(xml.SelectSingleNode("//hp").InnerText); _maxmp = _mp = Int32.Parse(xml.SelectSingleNode("//mp").InnerText); _exp = Int32.Parse(xml.SelectSingleNode("//exp").InnerText); _ap = Int32.Parse(xml.SelectSingleNode("//ap").InnerText); _gil = Int32.Parse(xml.SelectSingleNode("//gil").InnerText); foreach (XmlNode weak in xml.SelectSingleNode("//weaks").ChildNodes) _weak.Add((Element)Enum.Parse(typeof(Element), weak.InnerText)); foreach (XmlNode halve in xml.SelectSingleNode("//halves").ChildNodes) _halve.Add((Element)Enum.Parse(typeof(Element), halve.InnerText)); foreach (XmlNode v in xml.SelectSingleNode("//voids").ChildNodes) _void.Add((Element)Enum.Parse(typeof(Element), v.InnerText)); foreach (XmlNode absorb in xml.SelectSingleNode("//absorbs").ChildNodes) _absorb.Add((Element)Enum.Parse(typeof(Element), absorb.InnerText)); foreach (XmlNode immunity in xml.SelectSingleNode("//immunities").ChildNodes) _immune.Add((Status)Enum.Parse(typeof(Status), immunity.InnerText)); foreach (XmlNode win in xml.SelectSingleNode("//win").ChildNodes) _win.Add(new EnemyItem(win.OuterXml)); foreach (XmlNode steal in xml.SelectSingleNode("//steal").ChildNodes) _steal.Add(new EnemyItem(steal.OuterXml)); foreach (XmlNode morph in xml.SelectSingleNode("//morph").ChildNodes) if (morph.Attributes["id"] != null) { string id = morph.Attributes["id"].Value; string type = morph.Attributes["type"].Value; _morph = Atmosphere.BattleSimulator.Item.GetItem(id, type); } int vStep = Globals.BattleSpeed; _c_timer = new ScaledClock(vStep); _v_timer = new ScaledClock(vStep); _turnTimer = new ScaledTimer(6000, _dexterity * vStep / Globals.NormalSpeed()); _ai = new Thread(new ThreadStart(AI)); _x = x; _y = y; }
public Enemy(string xmlstring, int x, int y) { _xml = xmlstring; _weak = new List <Element>(); _halve = new List <Element>(); _void = new List <Element>(); _absorb = new List <Element>(); _immune = new List <Status>(); _win = new List <EnemyItem>(); _steal = new List <EnemyItem>(); _abilityState = new AbilityState(); XmlDocument xml = new XmlDocument(); xml.Load(new MemoryStream(Encoding.UTF8.GetBytes(xmlstring))); _name = xml.SelectSingleNode("//name").InnerText; _attack = Int32.Parse(xml.SelectSingleNode("//atk").InnerText); _defense = Int32.Parse(xml.SelectSingleNode("//def").InnerText); _defensePercent = Int32.Parse(xml.SelectSingleNode("//defp").InnerText); _dexterity = Int32.Parse(xml.SelectSingleNode("//dex").InnerText); _magicAttack = Int32.Parse(xml.SelectSingleNode("//mat").InnerText); _magicDefense = Int32.Parse(xml.SelectSingleNode("//mdf").InnerText); _luck = Int32.Parse(xml.SelectSingleNode("//lck").InnerText); _level = Int32.Parse(xml.SelectSingleNode("//lvl").InnerText); _maxhp = _hp = Int32.Parse(xml.SelectSingleNode("//hp").InnerText); _maxmp = _mp = Int32.Parse(xml.SelectSingleNode("//mp").InnerText); _exp = Int32.Parse(xml.SelectSingleNode("//exp").InnerText); _ap = Int32.Parse(xml.SelectSingleNode("//ap").InnerText); _gil = Int32.Parse(xml.SelectSingleNode("//gil").InnerText); foreach (XmlNode weak in xml.SelectSingleNode("//weaks").ChildNodes) { _weak.Add((Element)Enum.Parse(typeof(Element), weak.InnerText)); } foreach (XmlNode halve in xml.SelectSingleNode("//halves").ChildNodes) { _halve.Add((Element)Enum.Parse(typeof(Element), halve.InnerText)); } foreach (XmlNode v in xml.SelectSingleNode("//voids").ChildNodes) { _void.Add((Element)Enum.Parse(typeof(Element), v.InnerText)); } foreach (XmlNode absorb in xml.SelectSingleNode("//absorbs").ChildNodes) { _absorb.Add((Element)Enum.Parse(typeof(Element), absorb.InnerText)); } foreach (XmlNode immunity in xml.SelectSingleNode("//immunities").ChildNodes) { _immune.Add((Status)Enum.Parse(typeof(Status), immunity.InnerText)); } foreach (XmlNode win in xml.SelectSingleNode("//win").ChildNodes) { _win.Add(new EnemyItem(win.OuterXml)); } foreach (XmlNode steal in xml.SelectSingleNode("//steal").ChildNodes) { _steal.Add(new EnemyItem(steal.OuterXml)); } foreach (XmlNode morph in xml.SelectSingleNode("//morph").ChildNodes) { if (morph.Attributes["id"] != null) { string id = morph.Attributes["id"].Value; string type = morph.Attributes["type"].Value; _morph = Atmosphere.BattleSimulator.Item.GetItem(id, type); } } int vStep = Globals.BattleSpeed; _c_timer = new ScaledClock(vStep); _v_timer = new ScaledClock(vStep); _turnTimer = new ScaledTimer(6000, _dexterity * vStep / Globals.NormalSpeed()); _ai = new Thread(new ThreadStart(AI)); _x = x; _y = y; }