コード例 #1
0
        public void Init(string Name)
        {
            ProjectileContext GlobalProjectileContext = new ProjectileContext();
            ProjectileParams  MagicProjectileParams   = new ProjectileParams(GlobalProjectileContext);

            MagicUserContext GlobalMagicContext = new MagicUserContext();
            MagicUserParams  MagicParams        = new MagicUserParams(GlobalMagicContext);

            Dictionary <string, MagicElement> DicMagicElement = MagicElement.LoadRegularCore(MagicParams);

            foreach (KeyValuePair <string, MagicElement> ActiveMagicElement in MagicElement.LoadProjectileCores(MagicParams, MagicProjectileParams))
            {
                DicMagicElement.Add(ActiveMagicElement.Key, ActiveMagicElement.Value);
            }
            foreach (KeyValuePair <string, MagicElement> ActiveMagicElement in MagicElement.LoadElements(MagicParams))
            {
                DicMagicElement.Add(ActiveMagicElement.Key, ActiveMagicElement.Value);
            }

            ActiveSpell               = new MagicSpell(Name, null, GlobalMagicContext, DicMagicElement);
            ActiveMagicEditor         = new MagicEditor(ActiveSpell, GlobalProjectileContext, MagicProjectileParams.SharedParams);
            ActiveMagicEditor.Content = new ContentManager(Services);
            ActiveMagicEditor.Content.RootDirectory = "Content";
            Services.AddService(GraphicsDevice);
            ActiveMagicEditor.Load();
        }
コード例 #2
0
        public void TestManaReserveUsage()
        {
            AttackContext.Owner = CreateDummyRobot();

            MagicUser       ActiveUser  = new MagicUser();
            MagicSpell      ActiveSpell = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams Params      = new MagicUserParams(ActiveSpell.GlobalContext);

            ActiveUser.ManaReserves = 1000;
            ActiveUser.CurrentMana  = 100;

            InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore1.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));

            ActiveSpell.ListMagicCore.Add(FireballCore1);
            ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser);
            BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0];

            for (int i = 0; i < 10; i++)
            {
                NewSkill.AddSkillEffectsToTarget(string.Empty);
            }

            Assert.AreEqual(0, ActiveUser.ChanneledMana);
            Assert.AreEqual(990, ActiveUser.ManaReserves);
            Assert.AreEqual(100, ActiveUser.CurrentMana);
        }
コード例 #3
0
        public void TestMagicUnit()
        {
            List <MagicSpell> ListMagicSpell        = new List <MagicSpell>();
            UnitMagic         ActiveUser            = new UnitMagic("Dummy Magic", ListMagicSpell);
            MagicSpell        ActiveSpell           = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams   Params                = new MagicUserParams(ActiveSpell.GlobalContext);
            ProjectileContext GlobalContext         = new ProjectileContext();
            ProjectileParams  MagicProjectileParams = new ProjectileParams(GlobalContext);

            GlobalContext.OwnerSandbox = Sandbox;
            MagicSpell FireballSpell = new MagicSpell(ActiveUser);

            ListMagicSpell.Add(FireballSpell);

            MagicCoreFireball FireballCore1 = new MagicCoreFireball(Params, MagicProjectileParams);

            FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params));
            FireballCore1.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            FireballSpell.ListMagicCore.Add(FireballCore1);

            ActiveUser.Init();

            Assert.AreEqual(1, ActiveUser.ListAttack.Count);
        }
コード例 #4
0
        public void TestFireballChannelingActivation()
        {
            AttackContext.Owner = CreateDummyRobot();

            MagicUser       ActiveUser  = new MagicUser();
            MagicSpell      ActiveSpell = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams Params      = new MagicUserParams(ActiveSpell.GlobalContext);

            ActiveUser.ManaReserves = 1000;
            ActiveUser.CurrentMana  = 100;

            InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params));

            ActiveSpell.ListMagicCore.Add(FireballCore1);
            ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser);
            BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0];
            CreateFireballEffectTripleThunder Fireball = (CreateFireballEffectTripleThunder)NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0];

            for (int i = 0; i < 9; i++)
            {
                NewSkill.AddSkillEffectsToTarget(string.Empty);

                Assert.AreEqual(i + 1, Fireball.ChanneledMana);
            }

            NewSkill.AddSkillEffectsToTarget(string.Empty);

            Assert.AreEqual(1, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0]).NumberOfExecutions);
            Assert.AreEqual(0, ActiveUser.ChanneledMana);
            Assert.AreEqual(100, ActiveUser.CurrentMana);
        }
コード例 #5
0
 public CreateFireballEffectTripleThunder(MagicUserParams MagicParams, TripleThunderAttackParams AttackParams, InvisibleMagicCoreFireball Owner)
     : base("Fireball Effect", false, MagicParams)
 {
     IsStacking        = true;
     MaximumStack      = -1;//Allow a user to have more than one effect.
     this.AttackParams = AttackParams;
     this.Owner        = Owner;
 }
コード例 #6
0
 public InvisibleFireball(float Damage, ExplosionOptions ExplosionAttributes, RobotAnimation Owner, Vector2 Position, float Angle,
                          MagicUserParams MagicParams, IMagicUser Parent)
     : base(Damage, ExplosionAttributes, Owner, Position, Angle)
 {
     this.MagicParams = MagicParams;
     this.Parent      = Parent;
     MagicParams.SetMagicUser(Parent);
 }
コード例 #7
0
        public void TestExplodingFireballPositionWithOffset()
        {
            AttackContext.Owner = CreateDummyRobot();

            MagicUser       ActiveUser  = new MagicUser();
            MagicSpell      ActiveSpell = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams Params      = new MagicUserParams(ActiveSpell.GlobalContext);

            ActiveUser.ManaReserves = 1000;
            ActiveUser.CurrentMana  = 100;

            InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params));
            FireballCore1.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            InvisibleMagicCoreFireball FireballCore2 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore2.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore2.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));
            FireballCore2.ListLinkedMagicElement.Add(new MagicCoreOffset(Params, AttackParams, -15, 0));

            InvisibleMagicCoreFireball FireballCore3 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore3.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore3.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));
            FireballCore3.ListLinkedMagicElement.Add(new MagicCoreOffset(Params, AttackParams, 55, 0));

            FireballCore1.ListLinkedMagicElement.Add(FireballCore2);
            FireballCore1.ListLinkedMagicElement.Add(FireballCore3);

            ActiveSpell.ListMagicCore.Add(FireballCore1);
            ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser);
            BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0];
            CreateFireballEffectTripleThunder Fireball1 = (CreateFireballEffectTripleThunder)NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0];

            Fireball1.ChanneledMana = 2000;
            NewSkill.AddSkillEffectsToTarget(string.Empty);
            Constants.TotalGameTime = 10;
            NewSkill.AddSkillEffectsToTarget(string.Empty);
            DummyMap.ListLayer[0].ListAttackCollisionBox[0].ListCollisionPolygon[0].Center = new Vector2(10, 10);

            //Channel enough Mana for 2 fireballs
            for (int i = 0; i < 50; i++)
            {
                DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 0, 16)));
            }

            Constants.TotalGameTime = 20;

            DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 50, 0)));

            Assert.AreEqual(0, DummyMap.ListLayer[0].ListAttackCollisionBox[0].ListCollisionPolygon[0].Center.X);
            Assert.AreEqual(70, DummyMap.ListLayer[0].ListAttackCollisionBox[1].ListCollisionPolygon[0].Center.X);
        }
コード例 #8
0
        public UnitMagic()
            : base(null)
        {
            ArrayCharacterActive    = new Core.Characters.Character[0];
            ListMagicSpell          = new List <MagicSpell>();
            GlobalProjectileContext = new ProjectileContext();
            MagicProjectileParams   = new ProjectileParams(GlobalProjectileContext);

            GlobalMagicContext = new MagicUserContext();
            MagicParams        = new MagicUserParams(GlobalMagicContext);
        }
コード例 #9
0
        public void TestMagicSanbox()
        {
            List <MagicSpell> ListMagicSpell = new List <MagicSpell>();
            UnitMagic         ActiveUser     = new UnitMagic("Dummy Magic", ListMagicSpell);

            Character DummyCharacter = new Character();

            DummyCharacter.Name          = "Dummy Pilot";
            DummyCharacter.Level         = 1;
            DummyCharacter.ArrayLevelMEL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelRNG = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelDEF = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelSKL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelEVA = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelHIT = new int[1] {
                200
            };
            DummyCharacter.ArrayLevelMaxSP = new int[1] {
                50
            };
            ActiveUser.ArrayCharacterActive = new Character[1] {
                DummyCharacter
            };

            ActiveUser.ChanneledMana = 1000;
            MagicSpell        ActiveSpell           = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams   MagicParams           = new MagicUserParams(ActiveSpell.GlobalContext);
            ProjectileContext GlobalContext         = new ProjectileContext();
            ProjectileParams  MagicProjectileParams = new ProjectileParams(GlobalContext);

            GlobalContext.OwnerSandbox = Sandbox;
            MagicSpell FireballSpell = new MagicSpell(ActiveUser);

            ListMagicSpell.Add(FireballSpell);

            MagicCoreFireball FireballCore1 = new MagicCoreFireball(MagicParams, MagicProjectileParams);

            FireballSpell.ListMagicCore.Add(FireballCore1);

            ActiveUser.Init();
            FireballSpell.ComputeSpell()[0].AddSkillEffectsToTarget("");
            Assert.AreEqual(1, Sandbox.ListProjectile.Count);
        }
コード例 #10
0
        private MagicSpell CreateFireball(UnitMagic ActiveUser, ProjectileParams MagicProjectileParams)
        {
            MagicSpell      ActiveSpell = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams Params      = new MagicUserParams(ActiveSpell.GlobalContext);

            MagicCoreFireball FireballCore1 = (MagicCoreFireball) new MagicCoreFireball(Params, MagicProjectileParams).Copy();

            FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params).Copy());

            ActiveSpell.ListMagicCore.Add(FireballCore1);

            return(ActiveSpell);
        }
コード例 #11
0
        public void TestExplodingFireballCreation()
        {
            MagicUser       ActiveUser  = new MagicUser();
            MagicSpell      ActiveSpell = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams Params      = new MagicUserParams(ActiveSpell.GlobalContext);

            InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore1.ListLinkedMagicElement.Add(new IncreasePower(Params));
            FireballCore1.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore1.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params));

            MagicCoreEnchantlLevel1 EnchantCore = new MagicCoreEnchantlLevel1(Params);

            EnchantCore.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params));
            FireballCore1.ListLinkedMagicElement.Add(EnchantCore);

            InvisibleMagicCoreFireball FireballCore2 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore2.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params));
            FireballCore1.ListLinkedMagicElement.Add(FireballCore2);

            InvisibleMagicCoreFireball FireballCore3 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore3.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params));
            FireballCore1.ListLinkedMagicElement.Add(FireballCore3);

            ActiveSpell.ListMagicCore.Add(FireballCore1);

            BaseAutomaticSkill NewSkill = new MagicSpell(ActiveSpell, ActiveUser).ComputeSpell()[0];

            Assert.AreEqual("Fireball Effect", NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0].EffectTypeName);
            Assert.AreEqual(TimeEllapsedRequirement.Name, NewSkill.CurrentSkillLevel.ListActivation[1].ListRequirement[1].SkillRequirementName);

            Assert.AreEqual(3, NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0].ListFollowingSkill.Count);
            Assert.AreEqual("Enchant", NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0].ListFollowingSkill[0].CurrentSkillLevel.ListActivation[1].ListEffect[0].EffectTypeName);
            Assert.AreEqual("Fireball Effect", NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0].ListFollowingSkill[1].CurrentSkillLevel.ListActivation[1].ListEffect[0].EffectTypeName);
            Assert.AreEqual("Fireball Effect", NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0].ListFollowingSkill[2].CurrentSkillLevel.ListActivation[1].ListEffect[0].EffectTypeName);

            Assert.AreEqual(TimeEllapsedRequirement.Name, NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0].ListFollowingSkill[0].CurrentSkillLevel.ListActivation[1].ListRequirement[1].SkillRequirementName);
            Assert.AreEqual(TimeEllapsedRequirement.Name, NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0].ListFollowingSkill[1].CurrentSkillLevel.ListActivation[1].ListRequirement[1].SkillRequirementName);
            Assert.AreEqual(TimeEllapsedRequirement.Name, NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0].ListFollowingSkill[2].CurrentSkillLevel.ListActivation[1].ListRequirement[1].SkillRequirementName);
        }
コード例 #12
0
        public void TestExplodingFireballActivation()
        {
            AttackContext.Owner = CreateDummyRobot();

            MagicUser       ActiveUser  = new MagicUser();
            MagicSpell      ActiveSpell = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams Params      = new MagicUserParams(ActiveSpell.GlobalContext);

            ActiveUser.ManaReserves = 1000;
            ActiveUser.CurrentMana  = 100;

            InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params));
            FireballCore1.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            InvisibleMagicCoreFireball FireballCore2 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore2.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore2.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            InvisibleMagicCoreFireball FireballCore3 = new InvisibleMagicCoreFireball(Params, AttackParams);

            FireballCore3.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore3.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            FireballCore1.ListLinkedMagicElement.Add(FireballCore2);
            FireballCore1.ListLinkedMagicElement.Add(FireballCore3);

            ActiveSpell.ListMagicCore.Add(FireballCore1);
            ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser);
            BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0];
            CreateFireballEffectTripleThunder FireballEffect = (CreateFireballEffectTripleThunder)NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0];

            FireballEffect.ChanneledMana = 2000;

            NewSkill.AddSkillEffectsToTarget(string.Empty);

            Assert.AreEqual(0, DummyMap.ListLayer[0].ListAttackCollisionBox.Count);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0]).NumberOfExecutions);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0].ListLinkedMagicElement[2]).NumberOfExecutions);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0].ListLinkedMagicElement[3]).NumberOfExecutions);
            Constants.TotalGameTime = 10;
            NewSkill.AddSkillEffectsToTarget(string.Empty);

            Assert.AreEqual(1, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0]).NumberOfExecutions);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0].ListLinkedMagicElement[2]).NumberOfExecutions);
            Assert.AreEqual(0, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0].ListLinkedMagicElement[3]).NumberOfExecutions);

            Assert.AreEqual(1, DummyMap.ListLayer[0].ListAttackCollisionBox.Count);
            Assert.AreEqual(2, DummyMap.ListLayer[0].ListAttackCollisionBox[0].ListActiveSkill.Count);
            InvisibleFireball Fireball1      = (InvisibleFireball)DummyMap.ListLayer[0].ListAttackCollisionBox[0];
            IMagicUser        FireballParent = Fireball1.Parent;

            //Channel enough Mana for 2 fireballs
            for (int i = 0; i < 50; i++)
            {
                DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 0, 16)));
                Assert.AreEqual(2000 - i * 2, FireballParent.CurrentMana);
            }

            Constants.TotalGameTime = 20;

            Assert.AreEqual(true, DummyMap.ListLayer[0].ListAttackCollisionBox.Contains(Fireball1));

            DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 50, 0)));

            Assert.AreEqual(false, DummyMap.ListLayer[0].ListAttackCollisionBox.Contains(Fireball1));
            Assert.AreEqual(2, DummyMap.ListLayer[0].ListAttackCollisionBox.Count);
        }
コード例 #13
0
 protected TripleThunderMagicCore(string Name, int BasePower, int RequiredMana, int Radius,
                                  MagicUserParams Params, TripleThunderAttackParams AttackParams)
     : base(Name, BasePower, RequiredMana, Radius, Params)
 {
     this.AttackParams = new TripleThunderAttackParams(AttackParams);
 }
コード例 #14
0
        public UnitMagic(string Name, ContentManager Content, BattleMap Map, Dictionary <string, Unit> DicUnitType, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect)
            : base(Name)
        {
            this.Map                = Map;
            ArrayCharacterActive    = new Core.Characters.Character[0];
            ListMagicSpell          = new List <MagicSpell>();
            GlobalProjectileContext = new ProjectileContext();
            MagicProjectileParams   = new ProjectileParams(GlobalProjectileContext);

            GlobalMagicContext = new MagicUserContext();
            MagicParams        = new MagicUserParams(GlobalMagicContext);

            Dictionary <string, MagicElement> DicMagicElement = MagicElement.LoadRegularCore(MagicParams);

            foreach (KeyValuePair <string, MagicElement> ActiveMagicElement in MagicElement.LoadProjectileCores(MagicParams, MagicProjectileParams))
            {
                DicMagicElement.Add(ActiveMagicElement.Key, ActiveMagicElement.Value);
            }
            foreach (KeyValuePair <string, MagicElement> ActiveMagicElement in MagicElement.LoadElements(MagicParams))
            {
                DicMagicElement.Add(ActiveMagicElement.Key, ActiveMagicElement.Value);
            }

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

            BR.BaseStream.Seek(0, SeekOrigin.Begin);

            OriginalUnitName = BR.ReadString();
            if (!string.IsNullOrEmpty(OriginalUnitName) && DicUnitType != null)
            {
                OriginalUnit = Unit.FromFullName(OriginalUnitName, Content, DicUnitType, DicRequirement, DicEffect);
                _UnitStat    = OriginalUnit.UnitStat;
            }

            int ListMagicSpellCount = BR.ReadInt32();

            ListMagicSpell = new List <MagicSpell>(ListMagicSpellCount);
            for (int S = 0; S < ListMagicSpellCount; ++S)
            {
                ListMagicSpell.Add(new MagicSpell(BR.ReadString(), this, GlobalMagicContext, DicMagicElement));
            }

            if (Content != null)
            {
                string UnitDirectory = Path.GetDirectoryName("Content\\Units\\Normal\\" + Name);
                string XNADirectory  = UnitDirectory.Substring(8);

                if (File.Exists(UnitDirectory + "\\Map Sprite\\" + Name + ".xnb"))
                {
                    SpriteMap = Content.Load <Texture2D>(XNADirectory + "\\Map Sprite\\" + this.FullName);
                }
                else
                {
                    SpriteMap = Content.Load <Texture2D>("Units/Default");
                }

                if (File.Exists(UnitDirectory + "\\Unit Sprite\\" + Name + ".xnb"))
                {
                    SpriteUnit = Content.Load <Texture2D>(XNADirectory + "\\Unit Sprite\\" + this.FullName);
                }
            }

            FS.Close();
            BR.Close();
        }
コード例 #15
0
 public InvisibleMagicCoreFireball(MagicUserParams Params, TripleThunderAttackParams AttackParams)
     : base("Fireball Core", 1, 10, 40, Params, AttackParams)
 {
 }
コード例 #16
0
        public void TestMagicSanboxSimulation()
        {
            List <MagicSpell> ListMagicSpell = new List <MagicSpell>();
            UnitMagic         ActiveUser     = new UnitMagic("Dummy Magic", ListMagicSpell);

            Character DummyCharacter = new Character();

            DummyCharacter.Name          = "Dummy Pilot";
            DummyCharacter.Level         = 1;
            DummyCharacter.ArrayLevelMEL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelRNG = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelDEF = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelSKL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelEVA = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelHIT = new int[1] {
                200
            };
            DummyCharacter.ArrayLevelMaxSP = new int[1] {
                50
            };
            ActiveUser.ArrayCharacterActive = new Character[1] {
                DummyCharacter
            };

            ActiveUser.ChanneledMana = 1000;
            MagicSpell        ActiveSpell           = new MagicSpell(ActiveUser, ActiveUser);
            MagicUserParams   Params                = new MagicUserParams(ActiveSpell.GlobalContext);
            ProjectileContext GlobalContext         = new ProjectileContext();
            ProjectileParams  MagicProjectileParams = new ProjectileParams(GlobalContext);

            GlobalContext.OwnerSandbox = Sandbox;
            ListMagicSpell.Add(ActiveSpell);

            MagicCoreFireball FireballCore1 = new MagicCoreFireball(Params, MagicProjectileParams);

            FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params));
            FireballCore1.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            MagicCoreFireball FireballCore2 = new MagicCoreFireball(Params, MagicProjectileParams);

            FireballCore2.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore2.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            MagicCoreFireball FireballCore3 = new MagicCoreFireball(Params, MagicProjectileParams);

            FireballCore3.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params));
            FireballCore3.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5));

            FireballCore1.ListLinkedMagicElement.Add(FireballCore2);
            FireballCore1.ListLinkedMagicElement.Add(FireballCore3);

            ActiveSpell.ListMagicCore.Add(FireballCore1);

            ActiveUser.Init();

            List <Core.Item.BaseAutomaticSkill> ListAttackAttribute = ListMagicSpell[0].ComputeSpell();
            CreateFireballEffect FireballEffect = (CreateFireballEffect)ListAttackAttribute[0].CurrentSkillLevel.ListActivation[1].ListEffect[0];

            FireballEffect.ChanneledMana = 2000;
            Constants.TotalGameTime      = 10;

            Sandbox.SimulateAttack(ListAttackAttribute);

            Assert.AreEqual(10, Constants.TotalGameTime);
            Assert.AreEqual(15, Sandbox.TotalDamage);
        }