Beispiel #1
0
 public MagicAttackAnimationInfo(string AnimationName, MagicSpell Owner, ProjectileContext GlobalContext, SharedProjectileParams SharedParams)
     : base(AnimationName)
 {
     this.Owner         = Owner;
     this.GlobalContext = GlobalContext;
     this.SharedParams  = SharedParams;
 }
Beispiel #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);
        }
Beispiel #3
0
        public IActionResult SpellMagic(int magicId)
        {
            var magicSpell = new MagicSpell();

            using (OracleConnection connection = new OracleConnection(configuration["OracleConnectionString"]))
            {
                using (OracleCommand command = connection.CreateCommand())
                {
                    connection.Open();
                    command.CommandText =
                        $@"SELECT * FROM FANTASYRPG.Spell
                        JOIN FANTASYRPG.Magic USING(MagicID)
                        WHERE MagicID = {magicId}
                        ";
                    OracleDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        if (reader.RowSize > 0)
                        {
                            magicSpell.Name = reader.GetString(3);
                            magicSpell.Spells.Add(reader.GetString(2));
                        }
                    }
                    ;
                    reader.Dispose();
                    connection.Close();
                }
            }

            return(View(magicSpell));
        }
Beispiel #4
0
 public override async Task CastSpell(MagicSpell magic)
 {
     if (magic.ID == 6)
     {
         await CastSeekSpell();
     }
 }
Beispiel #5
0
 private static Boolean KawigiEdit_RunTest(int testNum, string p0, Boolean hasAnswer, string p1)
 {
     Console.Write("Test " + testNum + ": [" + "\"" + p0 + "\"");
     Console.WriteLine("]");
     MagicSpell obj;
     string answer;
     obj = new MagicSpell();
     DateTime startTime = DateTime.Now;
     answer = obj.fixTheSpell(p0);
     DateTime endTime = DateTime.Now;
     Boolean res;
     res = true;
     Console.WriteLine("Time: " + (endTime - startTime).TotalSeconds + " seconds");
     if (hasAnswer) {
         Console.WriteLine("Desired answer:");
         Console.WriteLine("\t" + "\"" + p1 + "\"");
     }
     Console.WriteLine("Your answer:");
     Console.WriteLine("\t" + "\"" + answer + "\"");
     if (hasAnswer) {
         res = answer == p1;
     }
     if (!res) {
         Console.WriteLine("DOESN'T MATCH!!!!");
     } else if ((endTime - startTime).TotalSeconds >= 2) {
         Console.WriteLine("FAIL the timeout");
         res = false;
     } else if (hasAnswer) {
         Console.WriteLine("Match :-)");
     } else {
         Console.WriteLine("OK, but is it right?");
     }
     Console.WriteLine("");
     return res;
 }
Beispiel #6
0
        private async Task CastSeekSpell(MagicSpell magic)
        {
            await TextArea.PrintLine("\n\nCast Seek Spell.");

            await GameControl.WaitAsync(200);

            const int MainContinentMapId = 1;
            const int MuseumMapId        = 5;

            if (GameState.Map.MapID != MainContinentMapId)
            {
                await TextArea.PrintLine("Too far.");

                Player.Items[magic.ItemID]++;
                return;
            }

            GameState.Player.FaceDirection = Direction.East;

            await GameControl.PlaySoundSync(LotaSound.VeryGood);

            var evt = GameState.Map.Events.OfType <ChangeMapEvent>()
                      .First(x => x.MapID == MuseumMapId);

            GameState.Player.Location = new Point(
                evt.Location.X + 2, evt.Location.Y - 2);
        }
Beispiel #7
0
 public ActionPanelSpellEditor(ActionPanelHolder ListActionMenuChoice, MagicSpell ActiveSpell, ProjectileContext GlobalProjectileContext, SharedProjectileParams SharedParams)
     : base(ActiveSpell.Name, ListActionMenuChoice, true)
 {
     this.ActiveSpell             = ActiveSpell;
     this.GlobalProjectileContext = GlobalProjectileContext;
     this.SharedParams            = SharedParams;
 }
Beispiel #8
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);
        }
        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);
        }
Beispiel #10
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();
        }
Beispiel #11
0
    // Start is called before the first frame update
    void Start()
    {
        rb    = GetComponent <Rigidbody>();
        spell = GetComponent <MagicSpell>();

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
    }
 // Start is called before the first frame update
 void Start()
 {
     KeyQ    = new BackFlip();
     KeyW    = new MagicSpell();
     KeyE    = new UppercutJab();
     upArrow = new RunFast();
     anim    = actor.GetComponent <Animator>();
     Camera.main.GetComponent <CameraFollow360>().player = actor.transform;
 }
Beispiel #13
0
        public override async Task CastSpell(MagicSpell magic)
        {
            await TextArea.PrintLine("Cast " + magic.Name + ".", XleColor.White);

            if (magic.ID == 5)
            {
                await ExecuteKillFlash();
            }
        }
        public MagicTimeline(MagicSpell ActiveSpell, ProjectileContext GlobalContext, SharedProjectileParams SharedParams)
            : this()
        {
            this.ActiveSpell   = ActiveSpell;
            this.GlobalContext = GlobalContext;
            this.SharedParams  = SharedParams;

            GlobalContext.OwnerSandbox = this;
            this.ActiveSpell.ComputeSpell();
        }
Beispiel #15
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);
        }
Beispiel #16
0
        private Attack GetAnimationStartSandbox(MagicSpell ActiveSpell, Vector2 AnimationOrigin, out List <Projectile> ListOutputProjectile)
        {
            MagicProjectileSandboxStartAnimation AnimationStartSandbox = new MagicProjectileSandboxStartAnimation();

            GlobalContext.OwnerSandbox = AnimationStartSandbox;
            SharedParams.OwnerPosition = AnimationOrigin;
            SharedParams.OwnerAngle    = 0;

            List <BaseAutomaticSkill> ListAttackAttribute = ActiveSpell.ComputeSpell();
            Attack SpellAttack = new Attack("Dummy Attack");

            SpellAttack.ArrayAttackAttributes = ListAttackAttribute.ToArray();

            ListOutputProjectile = AnimationStartSandbox.SimulateAttack(SpellAttack);

            foreach (Projectile ActiveProjectile in ListOutputProjectile)
            {
                float MinX = float.MaxValue;
                float MinY = float.MaxValue;
                float MaxX = float.MinValue;
                float MaxY = float.MinValue;

                for (int P = ActiveProjectile.Collision.ListCollisionPolygon.Count - 1; P >= 0; --P)
                {
                    for (int V = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex.Length - 1; V >= 0; --V)
                    {
                        if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X < MinX)
                        {
                            MinX = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X;
                        }
                        if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X > MaxX)
                        {
                            MaxX = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X;
                        }

                        if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y < MinY)
                        {
                            MinY = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y;
                        }
                        if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y > MaxY)
                        {
                            MaxY = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y;
                        }
                    }
                }

                //Offset almost completely outside screen
                ActiveProjectile.Offset(new Vector2(Constants.Width + MaxX - 1, 0));
                ActiveProjectile.IsAlive = true;
            }

            return(SpellAttack);
        }
        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);
        }
        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);
        }
Beispiel #19
0
        protected override async Task CastSpell(MagicSpell magic)
        {
            switch (magic.ID)
            {
            case 1:
            case 2:
                await UseAttackMagic(magic);

                break;

            default:
                break;
            }
        }
    public IEnumerator Attack(SpellDB.AttackID id, Vector3 to = default(Vector3))
    {
        wizardAnimator.SetBool("Attack", true);
        yield return(new WaitForSeconds(1.0f));

        magicSpell = magicPool[(int)id];

        StartCoroutine(magicSpell.castMagic(gameObject, to));

        Debug.Log("Attack using " + SpellDB.attackIDnames[(int)id]);


        wizardAnimator.SetBool("Attack", false);
    }
Beispiel #21
0
        protected override async Task CastSpell(MagicSpell magic)
        {
            switch (magic.ID)
            {
            case 1:
            case 2:
                if (EncounterState == 0)
                {
                    Player.Items[magic.ItemID]++;
                    await TextArea.PrintLine("Nothing to fight.");

                    return;
                }
                else if (EncounterState != EncounterState.MonsterReady)
                {
                    Player.Items[magic.ItemID]++;
                    await TextArea.PrintLine("The unknown creature is out of range.");

                    return;
                }

                await TextArea.PrintLine("Attack with " + magic.Name + ".");

                var sound = (magic.ID == 1) ?
                            LotaSound.MagicFlame : LotaSound.MagicBolt;

                if (RollSpellFizzle(magic))
                {
                    await GameControl.PlayMagicSound(sound, LotaSound.MagicFizzle, 1);

                    await TextArea.PrintLine("Attack fizzles.", XleColor.Yellow);

                    return;
                }
                else
                {
                    await GameControl.PlayMagicSound(sound, LotaSound.MagicFlameHit, 1);
                }

                int damage = RollSpellDamage(magic, 0);

                await HitMonster(damage);

                break;

            default:
                throw new NotImplementedException();
            }
        }
Beispiel #22
0
    // Update is called once per frame
    public Vector3 TakeHit(MagicSpell m_s)
    {
        Vector3 F_R     = Vector3.zero;
        Vector3 FullDmg = Vector3.zero;

        for (int i = 0; i < 4; i++)
        {
            F_R += Div(Cloth[i].Magic_Resist, new Vector3(400, 400, 400));
        }
        FullDmg = Mul(m_s.Damage, new Vector3(Mathf.Abs(F_R.x - 1f), Mathf.Abs(F_R.y - 1f), Mathf.Abs(F_R.z - 1f)));
        Debug.Log("DMG = " + FullDmg);
        Indicators -= FullDmg;
        //UpdateIndicators();
        return(Mul(FullDmg, new Vector3(100, 100, 100))); //Div(m_s.Absorb, )
    }
Beispiel #23
0
        protected override async Task CastSpell(MagicSpell magic)
        {
            switch (magic.ID)
            {
            case 6:
                await CastSeekSpell(magic);

                break;

            default:
                await base.CastSpell(magic);

                break;
            }
        }
Beispiel #24
0
    //Function for casting magic
    public void CastMagic(MagicSpell spell)
    {
        //Check if the player has enough mana to cast the spell
        if (player.GetMana() >= spell.manaCost)
        {
            //Spend the mana as the player now cast the spell
            player.SpendMana(spell.manaCost);

            //Add the player magic stat to the spell damage
            int damage = spell.baseDamage + (int)player.magic.Value;

            //Call the combat action of the spell
            spell.combatAction.Invoke(magicCastPoints, damage, spell.range);
        }
    }
Beispiel #25
0
        public override async Task CastSpell(MagicSpell magic)
        {
            await TextArea.PrintLine("Cast " + magic.Name + ".", XleColor.White);

            if (magic.ID == 3)
            {
                await CastBefuddle(magic);
            }
            if (magic.ID == 4)
            {
                await CastPsychoStrength(magic);
            }
            if (magic.ID == 5)
            {
                await CastKillFlash(magic);
            }
        }
Beispiel #26
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>Timelines by Key Frames</returns>
        public override Dictionary <int, Timeline> GetExtraTimelines(AnimationClass NewAnimation)
        {
            Vector2   OriginalPosition = SharedParams.OwnerPosition;
            Rectangle EnemyBounds      = GetEnemyPosition(NewAnimation);

            MagicProjectileSandboxEndAnimation AnimationEndSanbox = new MagicProjectileSandboxEndAnimation(EnemyBounds);

            SharedParams.OwnerPosition = OriginalPosition;
            SharedParams.OwnerAngle    = 0;
            List <Projectile> ListProjectileAfterStartAnimationEnded;
            Attack            SpellAttack = GetAnimationStartSandbox(Owner, OriginalPosition, out ListProjectileAfterStartAnimationEnded);

            foreach (Projectile ActiveProjectile in ListProjectileAfterStartAnimationEnded)
            {
                AnimationEndSanbox.AddProjectile(ActiveProjectile);
            }

            Dictionary <int, Timeline> DicExtraTimeline = new Dictionary <int, Timeline>();

            GlobalContext.OwnerSandbox = AnimationEndSanbox;
            SharedParams.OwnerPosition = Vector2.Zero;
            SharedParams.OwnerAngle    = 0;

            AnimationEndSanbox.SimulateAttack(SpellAttack);

            Owner = new MagicSpell(Owner, Owner.GlobalContext.ActiveTarget);
            MagicTimeline NewTimeline = new MagicTimeline(Owner, GlobalContext, SharedParams);

            SharedParams.OwnerPosition = OriginalPosition;
            SharedParams.OwnerAngle    = 0;
            GetAnimationStartSandbox(Owner, OriginalPosition, out ListProjectileAfterStartAnimationEnded);

            foreach (Projectile ActiveProjectile in ListProjectileAfterStartAnimationEnded)
            {
                NewTimeline.AddProjectile(ActiveProjectile);
            }

            NewTimeline.DeathFrame = AnimationEndSanbox.TotalSimulationFrames;
            NewAnimation.LoopEnd   = Math.Max(NewAnimation.LoopEnd, NewTimeline.DeathFrame);
            DicExtraTimeline.Add(0, NewTimeline);

            SharedParams.OwnerPosition = OriginalPosition;
            SharedParams.OwnerAngle    = 0;

            return(DicExtraTimeline);
        }
Beispiel #27
0
        protected MagicProjectileSandboxStartAnimation GetAnimationStartSandbox(Vector2 AnimationOrigin)
        {
            MagicProjectileSandboxStartAnimation AnimationStartSandbox = new MagicProjectileSandboxStartAnimation();

            GlobalContext.OwnerSandbox = AnimationStartSandbox;
            SharedParams.OwnerPosition = AnimationOrigin;
            SharedParams.OwnerAngle    = 0;

            List <BaseAutomaticSkill> ListAttackAttribute = new MagicSpell(Owner, Owner.GlobalContext.ActiveTarget).ComputeSpell();
            Attack SpellAttack = new Attack();

            SpellAttack.ArrayAttackAttributes = ListAttackAttribute.ToArray();

            AnimationStartSandbox.SimulateAttack(SpellAttack);

            return(AnimationStartSandbox);
        }
Beispiel #28
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);
        }
Beispiel #29
0
 void CreateSpellButtons(NPC npc)
 {
     if (npc.isEnemy == false)
     {
         int   c = npc.Spells.Length;
         float h = button_pref.GetComponent <RectTransform>().rect.height;
         for (int i = 0; i < c; i++)
         {
             MagicSpell m_s = npc.Spells[i];
             GameObject n_b = Instantiate(button_pref, Magic_Panel.transform);
             n_b.GetComponent <RectTransform>().localPosition = new Vector3(0, i * h, 0);
             n_b.name = m_s.Name;
             n_b.GetComponent <Button>().enabled = !npc.isEnemy;
             n_b.transform.Find("Text").GetComponent <Text>().text = m_s.Name;
             n_b.GetComponent <Button>().onClick.AddListener(() =>
             {
                 HitEnemy(m_s);
             });
         }
     }
 }
Beispiel #30
0
    private IEnumerator AttackByPosition(SpellDB.AttackID id, Vector3 to = default(Vector3))
    {
//		id = SpellDB.AttackID.iceBurst;
        magicSpell = magicPool[(int)id];
        PlayerData pD = GetComponent <PlayerData>();

        if (pD.DecreaseMana(Constants.FIREBALL_MANA_COST))           // TODO Mana cost is constant now
        {
            wizardAnimator.SetBool("isCasting", true);
            yield return(new WaitForSeconds(Constants.MIN_CAST_COOL_DOWN));

            StartCoroutine(magicSpell.castMagic(gameObject, to));

            Debug.Log("[Spell] Attack using " + SpellDB.attackIDnames [(int)id]);

            wizardAnimator.SetBool("isCasting", false);
        }
        else
        {
            Debug.Log("[Spell] not enough mana!");
        }
        yield return(new WaitForSeconds(0.5f));
    }
Beispiel #31
0
        private async Task UseAttackMagic(MagicSpell magic)
        {
            int distance = 0;
            await TextArea.PrintLine();

            await TextArea.PrintLine("Shoot " + magic.Name + ".", XleColor.White);

            DungeonMonster monst      = MonsterInFrontOfPlayer(Player, ref distance);
            var            magicSound = magic.ID == 1 ? LotaSound.MagicFlame : LotaSound.MagicBolt;
            var            hitSound   = magic.ID == 1 ? LotaSound.MagicFlameHit : LotaSound.MagicBoltHit;

            if (monst == null)
            {
                await GameControl.PlayMagicSound(magicSound, hitSound, distance);

                await TextArea.PrintLine("There is no effect.", XleColor.White);
            }
            else
            {
                if (RollSpellFizzle(magic))
                {
                    await GameControl.PlayMagicSound(magicSound, LotaSound.MagicFizzle, distance);

                    await TextArea.PrintLine("Attack fizzles.", XleColor.White);

                    await GameControl.WaitAsync(500);
                }
                else
                {
                    await GameControl.PlayMagicSound(magicSound, hitSound, distance);

                    int damage = RollSpellDamage(magic, distance);

                    await HitMonster(monst, damage, XleColor.White);
                }
            }
        }