Пример #1
0
 public override void Update(Player player, SkillData data)
 {
     if (data.Time >= 20)
     {
         CerberusFormData sd = (CerberusFormData)PlayerMod.GetPlayerSkillData(player, 22);
         if (sd != null)
         {
             //for(int i = 0; i < 3; i++)
             sd.HeadFrame[0] = 30;
         }
         Vector2 ShotSpawnPosition = CerberusForm.GetMouthPosition(player);
         //ShotSpawnPosition.X += player.direction * 12;
         int     Damage        = data.GetMagicDamage(0, 1.2f + 0.15f * data.Level, player);
         Vector2 ShotDirection = (new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition) - ShotSpawnPosition;
         ShotDirection.Normalize();
         ShotSpawnPosition -= ShotDirection * 40f; //Magic
         if (Main.mouseX + Main.screenPosition.X < player.Center.X)
         {
             player.direction = -1;
         }
         else
         {
             player.direction = 1;
         }
         if (data.Time % 5 == 0)
         {
             Projectile.NewProjectile(ShotSpawnPosition, ShotDirection * 8f, Terraria.ID.ProjectileID.Flames, Damage, 0.7f, player.whoAmI);
         }
     }
     if (data.Time >= 4.2f * 60)
     {
         data.EndUse(false);
     }
 }
Пример #2
0
        public override void Update(Player player, SkillData data)
        {
            const int ProjectileID = Terraria.ID.ProjectileID.FrostBoltStaff;
            float     ShotTime     = 10 - ((data.Level * 0.5f) - (data.Level + 1));

            if (ShotTime < 5)
            {
                ShotTime = 5;
            }
            if (data.Time > 1 && data.LastTime <= 1)
            {
                CerberusFormData cfb = (CerberusFormData)PlayerMod.GetPlayerSkillData(player, 22);
                if (cfb != null)
                {
                    cfb.HeadFrame[1] = (byte)(ShotTime * 0.5f);
                }
            }
            if (data.Time > 3 && data.LastTime <= 3)
            {
                for (int i = 0; i < 1 + Main.rand.Next((int)(data.Level * 0.3)); i++)
                {
                    Vector2 ShotSpawnPos  = CerberusForm.GetMouthPosition(player, true);
                    Vector2 ShotDirection = (new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition - ShotSpawnPos);
                    int     Accuracy      = 50 - data.Level;
                    if (Accuracy < 0)
                    {
                        Accuracy = 0;
                    }
                    ShotDirection.X += Main.rand.Next(-Accuracy, Accuracy + 1);
                    ShotDirection.Y += Main.rand.Next(-Accuracy, Accuracy + 1);
                    ShotDirection.Normalize();
                    ShotDirection *= 16;
                    int Damage = data.GetMagicDamage(0, 0.95f + 0.09f * data.Level, player);
                    Projectile.NewProjectile(ShotSpawnPos, ShotDirection, ProjectileID, Damage, 7f, player.whoAmI);
                }
            }
            if (data.Time <= 5)
            {
                player.direction = (Main.mouseX + Main.screenPosition.X < player.Center.X) ? -1 : 1;
            }
            if (data.Time >= ShotTime)
            {
                if (data.Step >= (data.Level + 5) * 0.5f)
                {
                    data.EndUse();
                }
                else
                {
                    data.ChangeStep();
                }
            }
        }
Пример #3
0
        public override void Update(Player player, SkillData rawdata)
        {
            LightningBreathData data = (LightningBreathData)rawdata;

            if (data.Time == 0)
            {
                return;
            }
            if (data.Time < 10)
            {
                player.direction = (Main.mouseX + Main.screenPosition.X < player.Center.X ? -1 : 1);
            }
            if (data.Time > 0 && data.LastTime == 0)
            {
                CerberusFormData cfd = (CerberusFormData)PlayerMod.GetPlayerSkillData(player, 22);
                if (cfd != null)
                {
                    cfd.HeadFrame[2] = 30;
                }
                Vector2 LightningSpawnPos = CerberusForm.GetMouthPosition(player, true);
                List <LightningBreathData.LightningPath> Paths = new List <LightningBreathData.LightningPath>();
                for (int i = 0; i < 200; i++)
                {
                    if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly)
                    {
                        if (Math.Abs(Main.npc[i].Center.X - player.Center.X) < 500 &&
                            Math.Abs(Main.npc[i].Center.Y - player.Center.Y) < 300)
                        {
                            if ((player.direction > 0 && player.Center.X < Main.npc[i].Center.X) ||
                                (player.direction <0 && player.Center.X> Main.npc[i].Center.X))
                            {
                                if (Math.Abs(player.Center.Y - Main.npc[i].Center.Y) < (Main.npc[i].Center - player.Center).Length() + Main.npc[i].height * 0.5f)
                                {
                                    float Prediction = (Main.npc[i].Center - LightningSpawnPos).Length() * 0.0625f;
                                    Paths.Add(new LightningBreathData.LightningPath(LightningSpawnPos, Main.npc[i].Center + Main.npc[i].velocity * Prediction));
                                }
                            }
                        }
                    }
                }
                while (Paths.Count < 3)
                {
                    Vector2 BoltPosition = player.Center;
                    BoltPosition.X += player.direction * (300 + Main.rand.Next(200));
                    BoltPosition.Y += Main.rand.Next(-150, 151);
                    Paths.Add(new LightningBreathData.LightningPath(LightningSpawnPos, BoltPosition));
                }
                data.Paths = Paths.ToArray();

                /*TargetTranslator.Translator[] Targets = data.GetPossibleTargets(false, false, rawdata.CastPosition, GetEffectRange(data));
                 * List<LightningBreathData.LightningPath> Paths = new List<LightningBreathData.LightningPath>();
                 * foreach(TargetTranslator.Translator Target in Targets)
                 * {
                 *  Paths.Add(new LightningBreathData.LightningPath(LightningSpawnPos, Target.Center + Target.Velocity));
                 * }
                 * data.Paths = Paths.ToArray();*/
            }
            else
            {
                bool AllReady = true;
                foreach (LightningBreathData.LightningPath path in data.Paths)
                {
                    if (data.Time >= path.Path.Length + 10)
                    {
                        continue;
                    }
                    AllReady = false;
                    if (data.Time < path.Path.Length)
                    {
                        //Do Damage
                        int         Damage   = data.GetMagicDamage(0, 1.02f + 0.06f * data.Level, player);
                        const float Distance = 30;
                        for (int i = 0; i < 200; i++)
                        {
                            if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && (Main.npc[i].Center - path.Path[data.Time]).Length() < Distance)
                            {
                                Main.npc[i].StrikeNPC(Damage, 1f, player.direction);
                            }
                        }
                    }
                }
                if (AllReady && data.Time >= 20)
                {
                    if (data.Step < data.Level * 0.2f + 1)
                    {
                        data.ChangeStep();
                        data.CastPosition = new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition;
                    }
                    else
                    {
                        data.EndUse();
                    }
                }
            }
        }