public virtual void Compute(MagicCoreAttributes Attributes, MagicUserContext GlobalContext) { Attributes.TotalManaCost += ManaCost; foreach (MagicElement ActiveListMagicElement in ListLinkedMagicElement) { ActiveListMagicElement.Compute(Attributes, GlobalContext); } }
public override void Compute(MagicCoreAttributes Attributes, MagicUserContext GlobalContext) { IMagicUser OriginalUser = GlobalContext.ActiveUser; IMagicUser OriginalTarget = GlobalContext.ActiveTarget; Attributes.TotalManaCost += RequiredMana; MagicEffect SpellEffect = GetSpellEffect(); BaseAutomaticSkill BaseSkill = CreateSpell(SpellEffect, GlobalContext); GlobalContext.ActiveTarget = SpellEffect; //Linked magic cores are considered as following skills if (Attributes.CurrentSpell != null) { GlobalContext.ActiveUser = OriginalTarget; Attributes.CurrentSpell.ListFollowingSkill.Add(BaseSkill); BaseSkill.CurrentSkillLevel.ListActivation[1].ListRequirement.Add(new ManaChanneledRequirement(Attributes.TotalManaCost, MagicParams)); } else { BaseSkill.CurrentSkillLevel.ListActivation[1].ListRequirement.Add(new ManaChanneledRequirement(Attributes.TotalManaCost, MagicParams)); //Add a final effect that will empty the channeled mana on its own after every other effects are executed. BaseSkill.CurrentSkillLevel.ListActivation[1].ListEffect.Add(new EmptyChanneledManaEffect(MagicParams)); } Attributes.CurrentSkill = BaseSkill; Attributes.CurrentSpell = SpellEffect; foreach (MagicElement ActiveListMagicElement in ListLinkedMagicElement) { ActiveListMagicElement.Compute(Attributes, GlobalContext); Attributes.CurrentSkill = BaseSkill; Attributes.CurrentSpell = SpellEffect; } BaseSkill.CurrentSkillLevel.ListActivation[1].ListEffectTargetReal.Add(new List <AutomaticSkillTargetType>() { new EffectActivationExecuteOnly() }); GlobalContext.ActiveUser = OriginalUser; GlobalContext.ActiveTarget = OriginalTarget; }