Esempio n. 1
0
        public override void Update(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 float ShotSpeed       = 17f;
            Vector2     ShotDestination = new Vector2(Main.mouseX + Main.screenPosition.X, Main.mouseY + Main.screenPosition.Y);
            Vector2     ShotSpawnCenter = player.Center;
            Vector2     ShotDirection   = GetDirection(ShotSpawnCenter, ShotDestination) * ShotSpeed;
            int         Damage          = data.GetRangedDamage(0, 3.2f + 0.16f * 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, 20);
                    break;
                }
            }
            data.EndUse(false);
        }
Esempio n. 2
0
        public override void Update(Player player, SkillData data)
        {
            if (!player.SellItem(100 * data.Level, 1))
            {
                CombatText.NewText(player.getRect(), Microsoft.Xna.Framework.Color.Red, "You are broken.");
                data.EndUse(true);
                return;
            }
            int CoinCount = Main.rand.Next(3, 6);

            for (int i = 3; i <= data.Level; i += 3)
            {
                CoinCount++;
            }
            const int ShotRange  = 15;
            int       ShotDamage = data.GetMeleeDamage(0, 0.33f + 0.04f * data.Level, player);

            for (int i = 0; i < CoinCount; i++)
            {
                Vector2 ShotDirection = new Vector2(Main.mouseX + Main.rand.Next(-ShotRange, ShotRange + 1), Main.mouseY + Main.rand.Next(-ShotRange, ShotRange + 1)) + Main.screenPosition - player.Center;
                ShotDirection.Normalize();
                Projectile.NewProjectile(player.Center, ShotDirection * 8f, Terraria.ID.ProjectileID.SilverCoin, ShotDamage, 0.33f, player.whoAmI);
            }
            data.EndUse(false);
        }
Esempio 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;
            }
        }
Esempio n. 4
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();
         }
     }
 }
Esempio n. 5
0
 public override void Update(Player player, SkillData data)
 {
     if (data.Time == 1)
     {
         float distance = GetEffectRange(data);
         for (int p = 0; p < 255; p++)
         {
             if (Main.player[p].active && !Main.player[p].dead && (Main.player[p].Center - data.CastPosition).Length() < distance)
             {
                 data.ApplySkillBuff(Main.player[p], ModContent.BuffType <Buffs.Bless>(), 5 * 3600 + 30 * 60 * data.Level);
                 data.ApplyPlayerInteraction(Main.player[p]);
             }
         }
     }
     if (data.Time % 3 == 0)
     {
         float HealEffectX = (float)Math.Sin(data.Time * 3) * 15;
         foreach (Player p in data.GetPlayersInteractedWith())
         {
             Vector2 EffectPos = new Vector2(player.Center.X + HealEffectX, player.Center.Y - 8);
             Dust    d         = Dust.NewDustPerfect(EffectPos, Terraria.ID.DustID.Platinum);
             d.noGravity = false;
             d.noLight   = false;
             d.scale     = Main.rand.Next(13, 18) * 0.1f;
         }
     }
     if (data.Time >= 90)
     {
         data.EndUse();
     }
 }
Esempio n. 6
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);
     }
 }
Esempio n. 7
0
        public override void Update(Terraria.Player player, SkillData data)
        {
            float   Range                   = GetEffectRange(data);
            Vector2 PlayerCenter            = player.Center;
            int     DamageOvertimeInflicted = 0;
            bool    InflictDamage           = data.Time % 6 == 0;

            if (InflictDamage)
            {
                DamageOvertimeInflicted = (data.Level / 2) * 2;
            }
            for (int i = 0; i < 200; i++)
            {
                if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && IsUndead(Main.npc[i].type) && Main.npc[i].Distance(PlayerCenter) < Range)
                {
                    Main.npc[i].AddBuff(31, 5 * 60);
                    if (InflictDamage)
                    {
                        CombatText.NewText(Main.npc[i].getRect(), CombatText.DamagedHostile, DamageOvertimeInflicted, false, true);
                        Main.npc[i].life -= DamageOvertimeInflicted;
                        if (Main.npc[i].life <= 0)
                        {
                            Main.npc[i].checkDead();
                        }
                    }
                }
            }
            if (data.Time >= 20 * 60)
            {
                data.EndUse();
            }
        }
Esempio n. 8
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();
            }
        }
Esempio n. 9
0
 public override void Update(Terraria.Player player, SkillData data)
 {
     if (data.Time >= 45 * 60)
     {
         data.EndUse();
     }
 }
Esempio n. 10
0
 public override void Update(Player player, SkillData data)
 {
     if (data.Time >= (20 + 2 * data.Level) * 60)
     {
         data.EndUse();
     }
 }
Esempio n. 11
0
 public override void Update(Player player, SkillData data)
 {
     if (data.Time == 0)
     {
         data.SetInteger(ShieldBashDirectionVar, player.direction > 0 ? 1 : -1);
     }
     if (data.Time == 2)
     {
         Rectangle rect = new Rectangle((int)player.Center.X, (int)player.Center.Y, 60 + 20, 44 + 20);
         rect.Y -= rect.Height / 2;
         if (data.GetInteger(ShieldBashDirectionVar) < 0)
         {
             rect.X -= rect.Width;
         }
         TargetTranslator.Translator[] Targets = data.GetPossibleTargets(false, rect);
         int Damage = data.GetMeleeDamage(0, 1.2f + 0.026f * data.Level, player);
         foreach (TargetTranslator.Translator Target in Targets)
         {
             Target.Hurt(Damage, 15, false, true, " was launched way too far.");
         }
     }
     if (data.Time >= 20)
     {
         data.EndUse();
     }
 }
Esempio n. 12
0
        public override void Update(Terraria.Player player, SkillData data)
        {
            const byte SpawnXVar = 0, SpawnYVar = 1;

            if (data.Time == 0)
            {
                data.SetFloat(SpawnXVar, Main.screenPosition.X + Main.mouseX);
                data.SetFloat(SpawnYVar, Main.screenPosition.Y + Main.mouseY);
            }
            if (data.Time % 10 == 0)
            {
                const float ShotSpeed = 20;
                float       SpawnX = data.GetFloat(SpawnXVar), SpawnY = data.GetFloat(SpawnYVar);
                float       CenterX = SpawnX, CenterY = SpawnY;
                SpawnY -= 1000;
                SpawnX += Main.rand.Next(-300, 301);
                Vector2 ShotDir = new Vector2(CenterX - SpawnX, CenterY - SpawnY);
                ShotDir.Normalize();
                Projectile.NewProjectile(new Vector2(SpawnX, SpawnY), ShotDir * ShotSpeed, Terraria.ID.ProjectileID.Meteor1 + Main.rand.Next(3), data.GetMagicDamage(0, 1.4f + 0.12f * data.Level, player), 4f, player.whoAmI);
            }
            if (data.Time / 10 >= data.Level)
            {
                data.EndUse();
            }
        }
Esempio n. 13
0
 public override void Update(Player player, SkillData data)
 {
     if (data.Time >= (15 + 3 * data.Level) * 60)
     {
         data.EndUse(false);
     }
 }
Esempio n. 14
0
 public override void UpdateStatus(Player player, SkillData data)
 {
     player.moveSpeed += 0.2f;
     if (data.Time >= 60 * 30)
     {
         data.EndUse();
         return;
     }
 }
Esempio n. 15
0
 public override void ModifyHitNPCWithProj(Terraria.Player player, SkillData data, Terraria.Projectile proj, Terraria.NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 {
     if (target.velocity.Y != 0 && proj.type == Terraria.ID.ProjectileID.BulletHighVelocity)
     {
         damage     = (int)(damage * (1.6f + 0.2f * data.Level));
         knockback += 2f;
         data.EndUse();
     }
 }
Esempio n. 16
0
        public override void Update(Player player, SkillData data)
        {
            float Range = 140f;

            TargetTranslator.Translator[] Targets = data.GetPossibleTargets(false, false, player.Center, Range);
            if (Targets.Length > 0)
            {
                float NearestDistance = float.MaxValue;
                TargetTranslator.Translator NearestTarget = null;
                foreach (TargetTranslator.Translator target in Targets)
                {
                    float Distance = (player.Center - target.Center).Length();
                    if (Distance < NearestDistance)
                    {
                        NearestDistance = Distance;
                        NearestTarget   = target;
                    }
                }
                if (NearestTarget == null)
                {
                    CombatText.NewText(player.getRect(), Microsoft.Xna.Framework.Color.Red, "No one to steal!", true);
                    data.EndUse(true);
                    return;
                }
                else
                {
                    if (NearestTarget.CharacterIdentifier.StartsWith("pl"))
                    {
                        Player otherplayer = (Player)NearestTarget.Target;
                    }
                    else
                    {
                        StealFromOther(NearestTarget, data, player);
                    }
                }
                data.EndUse(false);
            }
            else
            {
                data.EndUse(true);
                CombatText.NewText(player.getRect(), Microsoft.Xna.Framework.Color.Red, "Nobody nearby!", true);
            }
        }
Esempio n. 17
0
 public override void UpdateItemUse(Player player, SkillData data, bool JustUsed)
 {
     if (player.itemAnimation > 0 && player.inventory[player.selectedItem].melee)
     {
         if (player.itemAnimation == 1)
         {
             data.EndUse();
         }
     }
 }
Esempio n. 18
0
 public override void Update(Player player, SkillData data)
 {
     player.immuneTime  = 5;
     player.immuneAlpha = 255;
     player.aggro      -= 900;
     if (player.controlRight || player.controlLeft || player.controlJump)
     {
         data.EndUse(false);
     }
 }
Esempio n. 19
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();
            }
        }
Esempio n. 20
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();
                }
            }
        }
Esempio n. 21
0
 public override void Update(Player player, SkillData data)
 {
     if (data.Time == 0)
     {
         data.ApplySkillBuff(player, ModContent.BuffType <Buffs.Provoke>(), (30 * (1 + data.Level / 5)) * 60);
         player.chatOverhead.NewMessage("Who will challenge me?!", Main.chatLength / 2);
     }
     if (data.Time >= 20)
     {
         data.EndUse(false);
         return;
     }
 }
Esempio n. 22
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();
            }
        }
Esempio n. 23
0
 public override void Update(Terraria.Player player, SkillData data)
 {
     if (data.Time >= MaxDuration)
     {
         data.EndUse();
     }
     else
     {
         int       AttackSize = (int)(48 * (1f + 0.1f * data.Level));
         Rectangle rect       = new Rectangle((int)player.Center.X, (int)player.Center.Y, AttackSize, AttackSize);
         if (data.Time <= MaxDuration * 0.333f)
         {
             if (player.direction > 0)
             {
                 rect.X -= rect.Width;
             }
             rect.Y -= rect.Height;
         }
         else if (data.Time <= MaxDuration * 0.667f)
         {
             if (player.direction < 0)
             {
                 rect.X -= rect.Width;
             }
             rect.Y -= rect.Height;
         }
         else
         {
             if (player.direction < 0)
             {
                 rect.X -= rect.Width;
             }
         }
         rect.X += player.direction * 4;
         int Damage = data.GetMeleeDamage(0, 1.4f + 0.2f * data.Level, player);
         for (int x = 0; x < 255; x++)
         {
             if (player.hostile && x != player.whoAmI && Main.player[x].active && !Main.player[x].dead && Main.player[x].hostile && (Main.player[x].team == 0 || Main.player[x].team != player.team) && Main.player[x].getRect().Intersects(rect))
             {
                 data.HurtPlayer(Main.player[x], Damage, player.direction, 60, false);
                 //Hurt player
             }
             if (x < 200 && Main.npc[x].active && !Main.npc[x].friendly && !Main.npc[x].townNPC && !Main.npc[x].dontTakeDamage && Main.npc[x].getRect().Intersects(rect))
             {
                 data.HurtNpc(Main.npc[x], Damage, player.direction, player.inventory[player.selectedItem].knockBack, 60, false);
                 //Hurt npc
             }
         }
     }
 }
Esempio n. 24
0
 public override void Update(Player player, SkillData data)
 {
     TargetTranslator.Translator[] Targets = data.GetPossibleTargets(true, true, player.Center, 400);
     foreach (TargetTranslator.Translator target in Targets)
     {
         if (target.Target is Player)
         {
             data.ApplySkillBuff((Player)target.Target, Terraria.ModLoader.ModContent.BuffType <Buffs.AgilityUp>(), 30 * 60 * data.Level);
             for (int i = 0; i < 5; i++)
             {
                 Dust.NewDust(target.Position, target.Width, target.Height, 175);
             }
         }
     }
     data.EndUse(false);
 }
Esempio n. 25
0
        public override void Update(Player player, SkillData data)
        {
            int BuffID = ModContent.BuffType <Buffs.HighGuard>();

            if (player.HasBuff(BuffID))
            {
                player.DelBuff(player.FindBuffIndex(BuffID));
                CombatText.NewText(player.getRect(), Microsoft.Xna.Framework.Color.White, "High Guard Deactivated.");
            }
            else
            {
                data.ApplySkillBuff(player, BuffID, 5);
                CombatText.NewText(player.getRect(), Microsoft.Xna.Framework.Color.White, "High Guard Activated.");
            }
            data.EndUse(false);
        }
Esempio n. 26
0
        public override void Update(Player player, SkillData data)
        {
            float EffectDistancing = (float)Math.Cos(data.Time) * 25;

            if (Main.rand.Next(3) == 0)
            {
                for (int x = -1; x <= 1; x += 2)
                {
                    Vector2 DustPosition = player.Center;
                    DustPosition.X += x * EffectDistancing;
                    Dust.NewDust(DustPosition, 4, 4, 171);
                }
            }
            if (data.Time >= (15 + 3 * data.Level) * 60)
            {
                data.EndUse(false);
            }
        }
Esempio n. 27
0
        public override void Update(Terraria.Player player, SkillData data)
        {
            byte NumberOfFlames = 1;

            if (data.Level >= 5)
            {
                NumberOfFlames++;
            }
            if (data.Level >= 9)
            {
                NumberOfFlames++;
            }
            int Damage = data.GetSummonDamage(0, 0.85f + 0.03f * data.Level, player);

            for (int p = 0; p < Main.maxProjectiles; p++)
            {
                if (Main.projectile[p].active && Main.projectile[p].owner == player.whoAmI && Main.projectile[p].minion)
                {
                    Projectile proj          = Main.projectile[p];
                    byte       SpawnCount    = NumberOfFlames;
                    Vector2    SpawnPosition = proj.Center;
                    SpawnPosition.Y -= proj.height;
                    Projectile.NewProjectile(SpawnPosition, Vector2.Zero, 659, Damage, 0.6f, player.whoAmI);
                    SpawnCount--;
                    if (SpawnCount > 0)
                    {
                        SpawnPosition    = proj.Center;
                        SpawnPosition.Y -= proj.height * 0.8f;
                        SpawnPosition.X -= proj.width * 0.5f;
                        Projectile.NewProjectile(SpawnPosition, Vector2.Zero, 659, Damage, 0.6f, player.whoAmI);
                        SpawnCount--;
                        if (SpawnCount > 0)
                        {
                            SpawnPosition    = proj.Center;
                            SpawnPosition.Y -= proj.height * 0.8f;
                            SpawnPosition.X += proj.width * 0.5f;
                            Projectile.NewProjectile(SpawnPosition, Vector2.Zero, 659, Damage, 0.6f, player.whoAmI);
                            SpawnCount--;
                        }
                    }
                }
            }
            data.EndUse();
        }
Esempio n. 28
0
        public override void Update(Player player, SkillData data)
        {
            player.immuneTime    = 60;
            player.immuneNoBlink = true;
            player.immune        = true;
            float DamageToInflict = GetDamageValue(player, data);

            if (player.direction > 0)
            {
                player.velocity.X += player.moveSpeed;
                if (player.velocity.X > player.maxRunSpeed * 2)
                {
                    player.velocity.X = player.maxRunSpeed * 2;
                }
            }
            else
            {
                player.velocity.X -= player.moveSpeed;
                if (player.velocity.X < -player.maxRunSpeed * 2)
                {
                    player.velocity.X = -player.maxRunSpeed * 2;
                }
            }
            Translator[] Targets = data.GetPossibleTargets(false, false, player.Center, 200);
            Microsoft.Xna.Framework.Rectangle rect = player.getRect();
            int Damage = data.GetMeleeDamage(0, DamageToInflict, player);

            foreach (Translator Target in Targets)
            {
                if (Target.GetRectangle.Intersects(rect))
                {
                    data.HurtTarget(Target, Damage, player.direction, 12f, 18);
                }
            }
            if (data.Time >= 3 * 60)
            {
                data.EndUse(false);
                player.immune        = false;
                player.immuneNoBlink = false;
            }
        }
Esempio n. 29
0
        public override void Update(Player player, SkillData data)
        {
            if (data.Time >= 45 * 60)
            {
                data.EndUse();
            }
            if (data.Time % 15 == 0)
            {
                Vector2 EffectOrientation = Vector2.Zero;
                int     Cycle             = (data.Time / 15) % 4;
                switch (Cycle)
                {
                case 0:
                    EffectOrientation.X = -1f;
                    break;

                case 1:
                    EffectOrientation.X = -0.85f;
                    EffectOrientation.Y = -0.85f;
                    break;

                case 2:
                    EffectOrientation.Y = -1f;
                    break;

                case 3:
                    EffectOrientation.X = 0.85f;
                    EffectOrientation.Y = -0.85f;
                    break;
                }
                for (int dir = -1; dir <= 1; dir += 2)
                {
                    Vector2 EffectPosition = player.Center + EffectOrientation * dir * 32f;
                    int     d = Dust.NewDust(EffectPosition, 1, 1, Terraria.ID.DustID.Grass);
                    Main.dust[d].noGravity = true;
                    Main.dust[d].velocity  = Vector2.Zero;
                    Main.dust[d].scale    *= 2;
                }
            }
        }
Esempio n. 30
0
        public override void Update(Player player, SkillData rawdata)
        {
            SoulRageData data = (SoulRageData)rawdata;

            if (rawdata.Step == 0 && rawdata.Time == 0)
            {
                Vector2 CheckPosition = GetMousePositionInTheWorld;
                data.targets.Clear();
                const float Distance   = 300f;
                int         MaxTargets = 3 + data.Level / 3;
                TargetTranslator.Translator[] Targets = rawdata.GetPossibleTargets(false).ToArray();
                foreach (TargetTranslator.Translator target in Targets)
                {
                    float MyDistance = (target.Center - CheckPosition).Length();
                    if (MyDistance < Distance)
                    {
                        data.targets.Add(new SoulRageData.Victim()
                        {
                            Target = target
                        });
                        if (data.targets.Count >= MaxTargets)
                        {
                            break;
                        }
                    }
                }

                /*foreach (TargetTranslator.Translator target in Targets)
                 * {
                 *  data.targets.Add(new SoulRageData.Victim() { Target = target });
                 * }*/
                if (data.targets.Count == 0)
                {
                    rawdata.EndUse(true);
                    CombatText.NewText(player.getRect(), Color.Red, "No Target near the mouse.");
                    return;
                }
            }
            const int   ShotDelay = 15;
            const float ShotSpeed = 0.9f;
            int         ShotCount = 1 + data.Level / 2;

            if (data.Time >= ShotDelay)
            {
                if (data.Step < ShotCount)
                {
                    foreach (SoulRageData.Victim victim in data.targets)
                    {
                        if (victim.Target == null)
                        {
                            continue;
                        }
                        Vector2 SpawnPosition = player.Center;
                        Vector2 ShotDirection = new Vector2(-30 * player.direction, (data.Step - (ShotCount * 0.5f)) * 20);
                        //ShotDirection.Normalize();
                        SoulShotInfo Shot = new SoulShotInfo()
                        {
                            Position = SpawnPosition, Velocity = ShotDirection
                        };
                        victim.SoulsPosition.Add(Shot);
                        //Projectile proj = Projectile.NewProjectileDirect(SpawnPosition, ShotDirection * ShotSpeed, 297, data.GetMagicDamage(0, 1.2f + 0.22f * data.Level, player), 4f, player.whoAmI);
                        //proj.tileCollide = false;
                    }
                }
                data.ChangeStep();
            }
            bool HasSoulActive = false;

            foreach (SoulRageData.Victim victim in data.targets)
            {
                if (victim.Target != null && (!victim.Target.IsActive() || victim.Target.IsDead()))
                {
                    victim.Target = null;
                }
                for (int s = 0; s < victim.SoulsPosition.Count; s++)
                {
                    SoulShotInfo shot          = victim.SoulsPosition[s];
                    Vector2      MoveDirection = Vector2.Zero;
                    shot.Velocity *= 0.9f;
                    if (victim.Target != null)
                    {
                        MoveDirection = (victim.Target.Center + victim.Target.Velocity) - shot.Position;
                    }
                    MoveDirection.Normalize();
                    shot.Velocity += MoveDirection * ShotSpeed;
                    if (shot.Velocity.Length() > 12)
                    {
                        shot.Velocity.Normalize();
                        shot.Velocity *= 12;
                    }
                    if (victim.Target != null && (victim.Target.Center - shot.Position).Length() < shot.Velocity.Length() * 2)
                    {
                        if (data.HurtTarget(victim.Target, data.GetMagicDamage(0, 1.2f + 0.22f * data.Level, player), player.Center.X < victim.Target.Center.X ? 1 : -1, 4f, 4) != 0)
                        {
                            victim.SoulsPosition.RemoveAt(s);
                        }
                    }
                    else
                    {
                        shot.Position += shot.Velocity;
                        shot.LifeTime++;
                        if (shot.LifeTime >= 210)
                        {
                            victim.SoulsPosition.RemoveAt(s);
                        }
                        else
                        {
                            HasSoulActive = true;
                            if (shot.SoulFade <= 4)
                            {
                                shot.SoulFade++;
                            }
                            else
                            {
                                for (int effect = 0; effect < 5; effect++)
                                {
                                    int dustid = Dust.NewDust(shot.Position, 8, 8, 175, 0f, 0f, 100, default(Color), 2f);
                                    Main.dust[dustid].noGravity = true;
                                    Dust dust = Main.dust[dustid];
                                    dust.velocity *= 0f;
                                }
                            }
                        }
                    }
                }
            }
            if (data.Step > 0 && !HasSoulActive)
            {
                data.EndUse();
            }
        }