Exemplo n.º 1
0
        public override void Update(Player player, SkillData data)
        {
            const byte TimeVar = 0;

            if (data.Time == 0)
            {
                data.SetFloat(TimeVar, 20);
            }
            float       FireballDelay = data.GetFloat(TimeVar);
            const float ShotSpeed     = 12;

            if (data.Time >= FireballDelay)
            {
                Vector2 SpawnPosition = player.Center;
                Vector2 MousePosition = Main.screenPosition;
                MousePosition.X += Main.mouseX;
                MousePosition.Y += Main.mouseY;
                Vector2 ShotDirection = MousePosition - SpawnPosition;
                ShotDirection.Normalize();
                int Damage = data.GetMagicDamage(0, 0.6f + 0.1f * data.Level, player);
                Projectile.NewProjectile(SpawnPosition, ShotDirection * ShotSpeed, Terraria.ID.ProjectileID.Flamelash, Damage, 3, player.whoAmI);
                FireballDelay -= FireballDelay * 0.2f;
                if (FireballDelay < 1)
                {
                    FireballDelay = 1;
                }
                data.SetFloat(TimeVar, FireballDelay);
                data.ChangeStep();
            }
            if (data.Step >= data.Level)
            {
                data.EndUse();
            }
        }
Exemplo n.º 2
0
 public override void Update(Player player, SkillData data)
 {
     if (data.Step == 0 && data.Time == 0)
     {
         int EggLayingTime = 90 - data.Level * 6;
         if (EggLayingTime < 20)
         {
             EggLayingTime = 20;
         }
         data.SetInteger(EggLayingVarID, EggLayingTime);
     }
     if (data.Time >= data.GetInteger(EggLayingVarID))
     {
         int Damage = data.GetSummonDamage(0, 0.8f + 0.03f * data.Level, player);
         Projectile.NewProjectile(player.Center, Microsoft.Xna.Framework.Vector2.UnitX * -player.direction * 0.05f, Terraria.ID.ProjectileID.SpiderEgg, Damage, 0.6f, player.whoAmI);
         data.ChangeStep();
         if (data.Level < 5 && Main.rand.NextFloat() * 10 < (5 - data.Level) * 2)
         {
             player.Hurt(Terraria.DataStructures.PlayerDeathReason.ByCustomReason(" couldn't endure..."), Main.rand.Next(2, 5), 0, false, false, false);
         }
         if (data.Step >= data.Level / 2 + 5)
         {
             data.EndUse();
         }
     }
 }
Exemplo n.º 3
0
        public override void Update(Terraria.Player player, SkillData data)
        {
            if (data.Time == 0 && !player.inventory.Take(10).Any(x => x.useAmmo == Terraria.ID.AmmoID.Arrow))
            {
                CombatText.NewText(player.getRect(), Color.Red, "You don't have a bow type weapon.");
                data.EndUse(true);
                return;
            }
            const byte RainPosXVar = 0;

            switch (data.Step)
            {
            case 0:
            {
                if (data.LastTime == 0)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        if (player.inventory[i].useAmmo == Terraria.ID.AmmoID.Arrow)
                        {
                            FakeWeaponUsage(player, i, player.Center - new Vector2(0, -100));
                            break;
                        }
                    }
                    Vector2 ShotPos = player.Center;
                    for (int x = 1; x <= 6; x++)
                    {
                        float SpeedX = x * player.direction * 2, SpeedY = -18 - x * 2;
                        int   proj = Projectile.NewProjectile(player.Center, new Vector2(SpeedX, SpeedY), Terraria.ID.ProjectileID.WoodenArrowFriendly, GetDamage(player, data, true), 1.2f, player.whoAmI);
                        Main.projectile[proj].noDropItem = true;
                    }
                    data.SetFloat(RainPosXVar, ShotPos.X);
                }
                if (data.Time >= 60 * 3)
                {
                    data.ChangeStep();
                }
            }
            break;

            case 1:
            {
                if (data.Time % 3 == 0)
                {
                    Vector2 ProjPosition = player.Center;
                    ProjPosition.X  = data.GetFloat(RainPosXVar);
                    ProjPosition.Y -= Main.screenHeight;
                    ProjPosition.X -= Main.rand.Next(-Main.screenHeight, Main.screenHeight);
                    int proj = Projectile.NewProjectile(ProjPosition, new Vector2(0, 10 + Main.rand.Next(7, 13)), Terraria.ID.ProjectileID.WoodenArrowFriendly, GetDamage(player, data, false), 0.7f, player.whoAmI);
                    Main.projectile[proj].noDropItem = true;
                }
                if (data.Time >= 7 * 60)
                {
                    data.EndUse();
                }
            }
            break;
            }
        }
Exemplo n.º 4
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();
                }
            }
        }
Exemplo n.º 5
0
        public override void Update(Terraria.Player player, SkillData data)
        {
            if (data.Time == 0 && !player.inventory.Take(10).Any(x => x.useAmmo == Terraria.ID.AmmoID.Bullet))
            {
                CombatText.NewText(player.getRect(), Color.Red, "You don't have a gun type weapon.");
                data.EndUse(true);
                return;
            }
            const int   ShotType  = Terraria.ID.ProjectileID.BulletHighVelocity;
            const int   FireDelay = 6;
            const float ShotSpeed = 17f;

            if (data.Time >= FireDelay)
            {
                int     MouseSwayMaxDistance = 12 - data.Level / 2;
                Vector2 ShotDestination      = new Vector2(Main.mouseX + Main.screenPosition.X, Main.mouseY + Main.screenPosition.Y);
                Vector2 ShotSpawnCenter      = player.Center;
                if (MouseSwayMaxDistance > 0)
                {
                    ShotDestination.X += Main.rand.Next(-MouseSwayMaxDistance, MouseSwayMaxDistance + 1);
                    ShotDestination.Y += Main.rand.Next(-MouseSwayMaxDistance, MouseSwayMaxDistance + 1);
                }
                Vector2    ShotDirection = GetDirection(ShotSpawnCenter, ShotDestination) * ShotSpeed;
                int        Damage        = data.GetRangedDamage(0, 0.7f + 0.12f * data.Level, player);
                int        proj          = Projectile.NewProjectile(ShotSpawnCenter, ShotDirection, ShotType, Damage, 0.4f, player.whoAmI);
                Projectile proj2         = Main.projectile[proj];
                proj2.maxPenetrate = 3 + data.Level / 5;
                for (int i = 0; i < 10; i++)
                {
                    if (player.inventory[i].useAmmo == Terraria.ID.AmmoID.Bullet)
                    {
                        FakeWeaponUsage(player, i, GetMousePositionInTheWorld, FireDelay);
                        break;
                    }
                }
                data.ChangeStep();
            }
            if (data.Step >= 16)
            {
                data.EndUse();
            }
        }
Exemplo n.º 6
0
        public override void Update(Player player, SkillData data)
        {
            if (data.Time == 0 && !player.inventory.Take(10).Any(x => x.useAmmo == Terraria.ID.AmmoID.Arrow))
            {
                CombatText.NewText(player.getRect(), Color.Red, "You don't have a bow type weapon.");
                data.EndUse(true);
                return;
            }
            const int   ShotDelay = 8;
            const float ShotSpeed = 12;

            if (data.Time >= ShotDelay)
            {
                Vector2 SpawnPosition = player.Center;
                Vector2 MousePosition = Main.screenPosition;
                MousePosition.X += Main.mouseX;
                MousePosition.Y += Main.mouseY;
                Vector2 ShotDirection = MousePosition - SpawnPosition;
                ShotDirection.Normalize();
                int        Damage = data.GetMagicDamage(0, 0.6f + 0.1f * data.Level, player);
                int        pos    = Projectile.NewProjectile(SpawnPosition, ShotDirection * ShotSpeed, Terraria.ID.ProjectileID.WoodenArrowFriendly, Damage, 3, player.whoAmI);
                Projectile proj   = Main.projectile[pos];
                proj.noDropItem = true;
                for (int i = 0; i < 10; i++)
                {
                    if (player.inventory[i].useAmmo == Terraria.ID.AmmoID.Arrow)
                    {
                        FakeWeaponUsage(player, i, GetMousePositionInTheWorld, ShotDelay);
                        break;
                    }
                }
                data.ChangeStep();
            }
            if (data.Step >= 10)
            {
                data.EndUse();
            }
        }
Exemplo n.º 7
0
        public override void Update(Terraria.Player player, SkillData data)
        {
            int Frequence = 120 - data.Level * 4;

            if (player.numMinions > 9)
            {
                Frequence -= 40;
            }
            else
            {
                Frequence -= player.numMinions * 4;
            }
            if (data.Time >= Frequence)
            {
                bool    HostileNearby          = false;
                Vector2 NearestHostilePosition = Vector2.Zero;
                float   NearestHostileDistance = 500f;
                for (int n = 0; n < 200; n++)
                {
                    float Distance = 0;
                    if (Main.npc[n].active && !Main.npc[n].friendly && Main.npc[n].CanBeChasedBy() && (Distance = Main.npc[n].Distance(player.Center)) < NearestHostileDistance)
                    {
                        HostileNearby          = true;
                        NearestHostileDistance = Distance;
                        NearestHostilePosition = Main.npc[n].Center;
                    }
                }
                if (HostileNearby)
                {
                    int SummonIndex    = data.GetInteger(0);
                    int LastSummonPos  = -1;
                    int SummonPosStack = 0;
                    for (int proj = 0; proj < 1000; proj++)
                    {
                        if (Main.projectile[proj].active && Main.projectile[proj].owner == player.whoAmI && Main.projectile[proj].minion &&
                            Main.projectile[proj].type != Terraria.ID.ProjectileID.StardustGuardian)
                        {
                            LastSummonPos = proj;
                            if (SummonPosStack == SummonIndex)
                            {
                                break;
                            }
                            SummonPosStack++;
                        }
                    }
                    if (LastSummonPos > -1)
                    {
                        Vector2 LaunchDirection = (NearestHostilePosition - Main.projectile[LastSummonPos].Center);
                        LaunchDirection.Normalize();
                        int ProjPos = Projectile.NewProjectile(Main.projectile[LastSummonPos].Center, LaunchDirection * 8, 297, data.GetSummonDamage(0, 0.35f, player), 0.7f, player.whoAmI);
                        if (ProjPos > -1)
                        {
                            if (!SpawnedHauntProjPos.Contains(ProjPos))
                            {
                                SpawnedHauntProjPos.Add(ProjPos);
                            }
                        }
                    }
                    ;
                    SummonIndex++;
                    if (SummonIndex > player.maxMinions)
                    {
                        SummonIndex = 0;
                    }
                    data.SetInteger(0, SummonIndex);
                    data.ChangeStep();
                }
            }
        }