Exemplo n.º 1
0
        public override void Compute(MagicCoreAttributes Attributes, MagicUserContext GlobalContext)
        {
            base.Compute(Attributes, GlobalContext);

            Attributes.CurrentSkill.CurrentSkillLevel.ListActivation[0].ListEffect.Add(new ChannelInternalManaEffect(MagicParams));
            Attributes.CurrentSkill.CurrentSkillLevel.ListActivation[0].ListEffectTargetReal.Add(new List<AutomaticSkillTargetType>() { new EffectActivationExecuteOnly() });
        }
Exemplo n.º 2
0
        public MagicSpell(string Name, IMagicUser Owner, MagicUserContext GlobalContext, Dictionary <string, MagicElement> DicMagicElement)
        {
            this.Name = Name;

            ListMagicSpell                  = new List <BaseAutomaticSkill>();
            ListMagicCore                   = new List <MagicCore>();
            this.GlobalContext              = GlobalContext;
            this.GlobalContext.ActiveUser   = Owner;
            this.GlobalContext.ActiveTarget = Owner;

            FileStream   FS = new FileStream("Content/Spells/" + Name + ".pes", FileMode.Open, FileAccess.Read);
            BinaryReader BR = new BinaryReader(FS, Encoding.UTF8);

            int ListMagicCoreCount = BR.ReadInt32();

            for (int C = 0; C < ListMagicCoreCount; ++C)
            {
                string    NewMagicCoreName = BR.ReadString();
                MagicCore NewMagicCore     = (MagicCore)DicMagicElement[NewMagicCoreName].Copy();
                NewMagicCore.Load(BR, DicMagicElement);
                ListMagicCore.Add(NewMagicCore);
            }

            FS.Close();
            BR.Close();
        }
Exemplo n.º 3
0
 public MagicSpell(IMagicUser Owner, IMagicUser Target)
 {
     ListMagicSpell             = new List <BaseAutomaticSkill>();
     ListMagicCore              = new List <MagicCore>();
     GlobalContext              = new MagicUserContext();
     GlobalContext.ActiveUser   = Owner;
     GlobalContext.ActiveTarget = Target;
 }
Exemplo n.º 4
0
        public virtual void Compute(MagicCoreAttributes Attributes, MagicUserContext GlobalContext)
        {
            Attributes.TotalManaCost += ManaCost;

            foreach (MagicElement ActiveListMagicElement in ListLinkedMagicElement)
            {
                ActiveListMagicElement.Compute(Attributes, GlobalContext);
            }
        }
Exemplo n.º 5
0
        public MagicUserParams(MagicUserParams Clone)
        {
            GlobalContext = Clone.GlobalContext;
            LocalContext  = new MagicUserContext();

            LocalContext.ActiveUser   = Clone.LocalContext.ActiveUser;
            LocalContext.ActiveTarget = Clone.LocalContext.ActiveTarget;

            CopyGlobalIntoLocal();
        }
Exemplo n.º 6
0
        private BaseAutomaticSkill CreateSpell(BaseEffect CurrentSpell, MagicUserContext GlobalContext)
        {
            BaseAutomaticSkill NewSkill = BaseAutomaticSkill.CreateDummy(Name);

            //Insert a second activation use only for passive effects, should never have any requirement. Insert at 0 so they're processed before the spell requirements.
            NewSkill.CurrentSkillLevel.ListActivation.Insert(0, new BaseSkillActivation());

            NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect.Add(CurrentSpell);
            NewSkill.CurrentSkillLevel.ListActivation[1].ListEffectTargetReal.Add(new List <AutomaticSkillTargetType>()
            {
                new EffectActivationSelf(GlobalContext)
            });

            return(NewSkill);
        }
Exemplo n.º 7
0
        public MagicSpell(MagicSpell Other, IMagicUser Owner)
        {
            Name = Other.Name;

            ListMagicSpell             = new List <BaseAutomaticSkill>();
            ListMagicCore              = new List <MagicCore>();
            GlobalContext              = Other.GlobalContext;
            GlobalContext.ActiveUser   = Owner;
            GlobalContext.ActiveTarget = Owner;

            for (int C = 0; C < Other.ListMagicCore.Count; ++C)
            {
                MagicCore NewMagicCore = (MagicCore)Other.ListMagicCore[C].Copy();
                NewMagicCore.CopyElements(Other.ListMagicCore[C]);
                ListMagicCore.Add(NewMagicCore);
            }
        }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 9
0
 public override void Compute(MagicCoreAttributes Attributes, MagicUserContext GlobalContext)
 {
     Attributes.CurrentSkill.CurrentSkillLevel.ListActivation[1].ListRequirement.Add(new TimeEllapsedRequirement(MagicParams, SecondsToWait));
 }
Exemplo n.º 10
0
        public MagicUserParams(MagicUserContext GlobalContext)
        {
            this.GlobalContext = GlobalContext;

            LocalContext = new MagicUserContext();
        }
Exemplo n.º 11
0
 public EffectActivationSelf(MagicUserContext GlobalContext)
     : base(Name)
 {
     this.GlobalContext = GlobalContext;
 }