public MasterMateria(MateriaType type, DataStore data) : base() { Name = "Master" + type.ToString(); Type = type; switch (type) { case MateriaType.Magic: Description = "Equips all magical spells"; _abilities = data.GetMagicSpells().Select(x => x.Name).ToList(); break; case MateriaType.Command: Description = "Equips all commands"; // TODO : define command abilities _abilities = new List<string> { "Sense", "Steal" }; break; case MateriaType.Summon: Description = "Equips all summon spells"; _abilities = data.GetSummonSpells().Select(x => x.Name).ToList(); break; case MateriaType.Support: case MateriaType.Independent: throw new ImplementationException("No master materia definition for type " + type); } Tiers = new int[1]; }
public static Materia Create(string id, int ap, MateriaType type) { if (id == "enemyskill") { return(new EnemySkillMateria(ap)); } switch (type) { case MateriaType.Magic: return(new MagicMateria(id, ap)); case MateriaType.Support: return(new SupportMateria(id, ap)); case MateriaType.Command: return(new CommandMateria(id, ap)); case MateriaType.Independent: return(new IndependentMateria(id, ap)); case MateriaType.Summon: return(new SummonMateria(id, ap)); default: throw new GameImplementationException("Materia type not supported."); } }
public MasterMateria(MateriaType type, DataStore data) : base() { Name = "Master" + type.ToString(); Type = type; switch (type) { case MateriaType.Magic: Description = "Equips all magical spells"; _abilities = data.GetMagicSpells().Select(x => x.Name).ToList(); break; case MateriaType.Command: Description = "Equips all commands"; // TODO : define command abilities _abilities = new List <string> { "Sense", "Steal" }; break; case MateriaType.Summon: Description = "Equips all summon spells"; _abilities = data.GetSummonSpells().Select(x => x.Name).ToList(); break; case MateriaType.Support: case MateriaType.Independent: throw new ImplementationException("No master materia definition for type " + type); } Tiers = new int[1]; }
public static void Init() { _materiatory = new Materia[MATERIATORY_SIZE]; XmlDocument savegame = Globals.SaveGame; foreach (XmlNode node in savegame.SelectSingleNode("//materiatory").ChildNodes) { if (node.NodeType == XmlNodeType.Comment) { continue; } XmlDocument xml = new XmlDocument(); xml.Load(new MemoryStream(Encoding.UTF8.GetBytes(node.OuterXml))); XmlNode orbNode = xml.DocumentElement; string id = orbNode.Attributes["id"].Value; MateriaType type = (MateriaType)Enum.Parse(typeof(MateriaType), orbNode.Attributes["type"].Value); int ap = Int32.Parse(orbNode.Attributes["ap"].Value); int slot = Int32.Parse(orbNode.Attributes["slot"].Value); _materiatory[slot] = Materia.Create(id, ap, type); } }
public MateriaRecord(string xmlstring) { XmlDocument xml = new XmlDocument(); xml.Load(new MemoryStream(Encoding.UTF8.GetBytes(xmlstring))); _name = xml.SelectSingleNode("//name").InnerText; _desc = xml.SelectSingleNode("//desc").InnerText; hpp = Int32.Parse(xml.SelectSingleNode("//hpp").InnerText); mpp = Int32.Parse(xml.SelectSingleNode("//mpp").InnerText); str = Int32.Parse(xml.SelectSingleNode("//str").InnerText); vit = Int32.Parse(xml.SelectSingleNode("//vit").InnerText); dex = Int32.Parse(xml.SelectSingleNode("//dex").InnerText); mag = Int32.Parse(xml.SelectSingleNode("//mag").InnerText); spr = Int32.Parse(xml.SelectSingleNode("//spr").InnerText); lck = Int32.Parse(xml.SelectSingleNode("//lck").InnerText); XmlNodeList tlist = xml.SelectSingleNode("//tiers").ChildNodes; tiers = new int[tlist.Count]; int t = 0; type = (MateriaType)Enum.Parse(typeof(MateriaType), xml.SelectSingleNode("//type").InnerText); foreach (XmlNode node in tlist) { if (node.NodeType == XmlNodeType.Comment) { continue; } tiers[t] = Int32.Parse(node.InnerText); t++; } order = Int32.Parse(xml.SelectSingleNode("//order").InnerText); abilities = xml.SelectSingleNode("//abilities").InnerText.Split( new char[] { ',' }, StringSplitOptions.None); XmlNode attachNode = xml.SelectSingleNode("//attach"); if (attachNode != null) { Game.Lua.DoString("attach" + ID + " = " + attachNode.InnerText); } XmlNode detachNode = xml.SelectSingleNode("//detach"); if (detachNode != null) { Game.Lua.DoString("detach" + ID + " = " + detachNode.InnerText); } }
public Materia(MateriaRank Rank, MateriaType Type) { rank = Rank; type = Type; }
public MateriaRecord(string xmlstring) { XmlDocument xml = new XmlDocument(); xml.Load(new MemoryStream(Encoding.UTF8.GetBytes(xmlstring))); _name = xml.SelectSingleNode("//name").InnerText; _desc = xml.SelectSingleNode("//desc").InnerText; hpp = Int32.Parse(xml.SelectSingleNode("//hpp").InnerText); mpp = Int32.Parse(xml.SelectSingleNode("//mpp").InnerText); str = Int32.Parse(xml.SelectSingleNode("//str").InnerText); vit = Int32.Parse(xml.SelectSingleNode("//vit").InnerText); dex = Int32.Parse(xml.SelectSingleNode("//dex").InnerText); mag = Int32.Parse(xml.SelectSingleNode("//mag").InnerText); spr = Int32.Parse(xml.SelectSingleNode("//spr").InnerText); lck = Int32.Parse(xml.SelectSingleNode("//lck").InnerText); XmlNodeList tlist = xml.SelectSingleNode("//tiers").ChildNodes; tiers = new int[tlist.Count]; int t = 0; type = (MateriaType)Enum.Parse(typeof(MateriaType), xml.SelectSingleNode("//type").InnerText); foreach (XmlNode node in tlist) { if (node.NodeType == XmlNodeType.Comment) continue; tiers[t] = Int32.Parse(node.InnerText); t++; } order = Int32.Parse(xml.SelectSingleNode("//order").InnerText); abilities = xml.SelectSingleNode("//abilities").InnerText.Split( new char[] { ',' }, StringSplitOptions.None); XmlNode attachNode = xml.SelectSingleNode("//attach"); if (attachNode != null) Game.Lua.DoString("attach" + ID + " = " + attachNode.InnerText); XmlNode detachNode = xml.SelectSingleNode("//detach"); if (detachNode != null) Game.Lua.DoString("detach" + ID + " = " + detachNode.InnerText); }
public static Materia Create(string id, int ap, MateriaType type) { if (id == "enemyskill") return new EnemySkillMateria(ap); switch (type) { case MateriaType.Magic: return new MagicMateria(id, ap); case MateriaType.Support: return new SupportMateria(id, ap); case MateriaType.Command: return new CommandMateria(id, ap); case MateriaType.Independent: return new IndependentMateria(id, ap); case MateriaType.Summon: return new SummonMateria(id, ap); default: throw new GameImplementationException("Materia type not supported."); } }
private LinkedList<LinkedList<Materia>> FindPossibleMateriaCombos(int scoreNeeded, MateriaType mType) { int scoreBump = mType.GetBump(); LinkedList<LinkedList<Materia>> allPossibles = new LinkedList<LinkedList<Materia>>(); int tally = 0; if (scoreNeeded > 0) { for (int slot1 = 4; slot1 > 0; slot1--) { tally = slot1 + scoreBump; Materia m1 = new Materia((MateriaRank)slot1, mType); if (tally < scoreNeeded) { for (int slot2 = slot1; slot2 > 0; slot2--) { tally = slot1 + slot2 + scoreBump * 2; Materia m2 = new Materia((MateriaRank)slot2, mType); if (tally < scoreNeeded) { for (int slot3 = slot2; slot3 > 0; slot3--) { tally = slot1 + slot2 + slot3 + scoreBump * 3; Materia m3 = new Materia((MateriaRank)slot3, mType); if (tally < scoreNeeded) { for (int slot4 = slot3; slot4 > 0; slot4--) { tally = slot1 + slot2 + slot3 + slot4 + scoreBump * 4; Materia m4 = new Materia((MateriaRank)slot4, mType); if (tally < scoreNeeded) { for (int slot5 = slot4; slot5 > 0; slot5--) { tally = slot1 + slot2 + slot3 + slot4 + slot5 + scoreBump * 5; Materia m5 = new Materia((MateriaRank)slot5, mType); if (tally >= scoreNeeded) { LinkedList<Materia> poss = new LinkedList<Materia>(); poss.AddLast(m1); poss.AddLast(m2); poss.AddLast(m3); poss.AddLast(m4); poss.AddLast(m5); allPossibles.AddLast(poss); } } } else { LinkedList<Materia> poss = new LinkedList<Materia>(); poss.AddLast(m1); poss.AddLast(m2); poss.AddLast(m3); poss.AddLast(m4); allPossibles.AddLast(poss); } } } else { LinkedList<Materia> poss = new LinkedList<Materia>(); poss.AddLast(m1); poss.AddLast(m2); poss.AddLast(m3); allPossibles.AddLast(poss); } } } else { LinkedList<Materia> poss = new LinkedList<Materia>(); poss.AddLast(m1); poss.AddLast(m2); allPossibles.AddLast(poss); } } } else { LinkedList<Materia> poss = new LinkedList<Materia>(); poss.AddLast(m1); allPossibles.AddLast(poss); } } } return allPossibles; }
/// <summary> /// Loads a saved character. /// </summary> /// <param name="savexmlstring"></param> /// <param name="dataxmlstring"></param> private Character(string savexmlstring, string dataxmlstring) { _halve = new List <Element>(); _void = new List <Element>(); _absorb = new List <Element>(); _immune = new List <Status>(); XmlDocument savexml = new XmlDocument(); XmlDocument dataxml = new XmlDocument(); savexml.Load(new MemoryStream(Encoding.UTF8.GetBytes(savexmlstring))); dataxml.Load(new MemoryStream(Encoding.UTF8.GetBytes(dataxmlstring))); _name = savexml.FirstChild.Name; // Old Way : xml.SelectSingleNode("/" + _name + "/stats/lvl").InnerText // Stats _strength_base = Int32.Parse(savexml.SelectSingleNode("//str").InnerText); _dexterity_base = Int32.Parse(savexml.SelectSingleNode("//dex").InnerText); _vitality_base = Int32.Parse(savexml.SelectSingleNode("//vit").InnerText); _magic_base = Int32.Parse(savexml.SelectSingleNode("//mag").InnerText); _spirit_base = Int32.Parse(savexml.SelectSingleNode("//spi").InnerText); _luck_base = Int32.Parse(savexml.SelectSingleNode("//lck").InnerText); // Experience and Level _exp = Int32.Parse(savexml.SelectSingleNode("//exp").InnerText); _level = Int32.Parse(savexml.SelectSingleNode("//lvl").InnerText); _limitlvl = Int32.Parse(savexml.SelectSingleNode("//limitlvl").InnerText); // HP _hp = Int32.Parse(savexml.SelectSingleNode("//hp").InnerText); _maxhp = Int32.Parse(savexml.SelectSingleNode("//maxhp").InnerText); if (_hp > _maxhp) { throw new SavegameException("HP > MAXHP for " + _name); } _death = (_hp == 0); // MP _mp = Int32.Parse(savexml.SelectSingleNode("//mp").InnerText); _maxmp = Int32.Parse(savexml.SelectSingleNode("//maxmp").InnerText); if (_mp > _maxmp) { throw new SavegameException("MP > MAXMP for " + _name); } // Fury/Sadness _sadness = Boolean.Parse(savexml.SelectSingleNode("//sadness").InnerText); _fury = Boolean.Parse(savexml.SelectSingleNode("//fury").InnerText); if (_sadness && _fury) { throw new SavegameException("Can't be both sad and furious"); } // Sex _sex = (Sex)Enum.Parse(typeof(Sex), dataxml.SelectSingleNode("//sex").InnerText); // Equipment _weaponType = (WeaponType)Enum.Parse(typeof(WeaponType), _name.Replace(" ", "")); _weapon = new Weapon(savexml.SelectSingleNode("//weapon/name").InnerText); foreach (XmlNode orb in savexml.SelectNodes("//weapon/materia/orb")) { string id = orb.Attributes["id"].Value; MateriaType type = (MateriaType)Enum.Parse(typeof(MateriaType), orb.Attributes["type"].Value); int ap = Int32.Parse(orb.Attributes["ap"].Value); int slot = Int32.Parse(orb.Attributes["slot"].Value); if (slot >= _weapon.Slots.Length) { throw new SavegameException("Materia orb assigned to slot that doesnt exist on weapon."); } _weapon.Slots[slot] = Atmosphere.BattleSimulator.Materia.Create(id, ap, type); } _armor = new Armor(savexml.SelectSingleNode("//armor/name").InnerText); foreach (XmlNode orb in savexml.SelectNodes("//armor/materia/orb")) { string id = orb.Attributes["id"].Value; MateriaType type = (MateriaType)Enum.Parse(typeof(MateriaType), orb.Attributes["type"].Value); int ap = Int32.Parse(orb.Attributes["ap"].Value); int slot = Int32.Parse(orb.Attributes["slot"].Value); if (slot >= _weapon.Slots.Length) { throw new SavegameException("Materia orb assigned to slot that doesnt exist on armor."); } _armor.Slots[slot] = Atmosphere.BattleSimulator.Materia.Create(id, ap, type); } string acc = savexml.SelectSingleNode("//accessory").InnerText; _accessory = String.IsNullOrEmpty(acc) ? new Accessory() : Accessory.AccessoryTable[acc]; // Q-Values InitTable(ref _qvals, dataxml.SelectSingleNode("//qvals").InnerText, ','); // Luck base/gradient tables InitTable(ref _lck_base, dataxml.SelectSingleNode("//lbvals").InnerText, ','); InitTable(ref _lck_gradient, dataxml.SelectSingleNode("//lgvals").InnerText, ','); // HP base/gradient tables InitTable(ref _hp_base, dataxml.SelectSingleNode("//hpbvals").InnerText, ','); InitTable(ref _hp_gradient, dataxml.SelectSingleNode("//hpgvals").InnerText, ','); // MP base/gradient tables InitTable(ref _mp_base, dataxml.SelectSingleNode("//mpbvals").InnerText, ','); InitTable(ref _mp_gradient, dataxml.SelectSingleNode("//mpgvals").InnerText, ','); // Stat ranks InitTable(ref _stat_ranks, dataxml.SelectSingleNode("//ranks").InnerText, ','); }