public static Skill Parse(XElement node) { Skill skill = new Skill(); skill.node = node; skill.Key = Tools.GetXmlAttribute(node, "key"); skill.BasePower = Tools.GetXmlAttributeFloat(node, "power"); if (node.Attribute("range") != null) { switch (Tools.GetXmlAttribute(node, "range")) { case "ALL": skill.range = Range.All; break; case "SELF": skill.range = Range.Self; break; case "LINE": skill.range = Range.Line; break; case "ALLFOREFFECT": skill.range = Range.AllForEffect; break; default: skill.range = Range.Single; break; } } if (node.Attribute("effect") != null) { foreach (var effectKey in node.Attribute("effect").Value.Split(new char[] { '#' })) { Effect effect = EffectManager.getEffect(effectKey); skill.Effects.Add(effect); } } if (node.Attribute("debuff") != null) { foreach (var debuff in node.Attribute("debuff").Value.Split(new char[] { '#' })) { Buff buff = new Buff(); buff.Key = debuff.Split(new char[] { '@' })[0]; buff.BasePower = float.Parse(debuff.Split(new char[] { '@' })[1]); buff.skill = skill; buff.Round = int.Parse(debuff.Split(new char[] { '@' })[2]); skill.Debuffs.Add(buff); } } if (node.Attribute("buff") != null) { foreach (var debuff in node.Attribute("buff").Value.Split(new char[] { '#' })) { Buff buff = new Buff(); buff.Key = debuff.Split(new char[] { '@' })[0]; buff.BasePower = float.Parse(debuff.Split(new char[] { '@' })[1]); buff.skill = skill; buff.Round = int.Parse(debuff.Split(new char[] { '@' })[2]); skill.Buffs.Add(buff); } } foreach (XElement subSkillNode in node.Elements("subskill")) { SubSkill subSkill = SubSkill.Parse(subSkillNode, skill); skill.subSkills.Add(subSkill); } return(skill); }
public SubSkill Copy(Skill rootSkill) { SubSkill s = SubSkill.Parse(this.node, rootSkill); return(s); }