public static AbstractAbilityEffect getEffect(XmlNode xmlEffect, object obj) { AbstractAbilityEffect effect = null; switch (xmlEffect["type"].InnerText) { case "DamageAbilityEffect": effect = new DamageAbilityEffect(); break; case "AddBuffEffect": { var buffEffect = new AddBuffEffect { buff = (Buff)obj }; effect = buffEffect; break; } case "RowAddBuffEffect": { AddBuffEffect buffEffect = new RowAddBuffEffect(); buffEffect.buff = (Buff)obj; effect = buffEffect; break; } case "HealAbilityEffect": effect = new HealAbilityEffect(); break; case "SummonEffect": var sumEffect = new SummonEffect(); sumEffect.person = ((SummonAbility)obj).person; effect = sumEffect; break; case "UseItemEffect": effect = new UseItemEffect(); break; case "AddShieldAbilityEffect": effect = new AddShieldAbilityEffect(); break; case "RowAddShieldAbilityEffect": effect = new RowAddShieldAbilityEffect(); break; } effect.targetsNumber = int.Parse(xmlEffect["targetsNumber"].InnerText); foreach (XmlNode attribute in xmlEffect["attributes"]) { effect.attribures.Add(getEffectAttribures(attribute.InnerText)); } effect.valueGenerator = getValueGenerator(xmlEffect["valueGenerator"]); return(effect); }
public MeleeAttack(string n) { name = n; timeCast = Constants.PERSON_MELEE_ATTACK_SPEED; targetType = AbilityTargetType.ENEMY; image = Constants.loadSprite("texture/Skills/buffIcons", "buffIcons_2"); type = "activeAbility"; setAbstractTactic(new MeleeAttackTactic(1)); isActive = true; AbstractAbilityEffect effect = new DamageAbilityEffect(); effect.targetsNumber = 1; effect.valueGenerator = new ConstantValueGenerator(1); effectList.Add(effect); targetTactic = new RandomTargetTactic(); }