Пример #1
0
        public override void Update(Player player, SkillData rawdata)
        {
            ElementalBreathData data = (ElementalBreathData)rawdata;

            if (data.FireDelay > 0)
            {
                data.FireDelay--;
            }
        }
Пример #2
0
        public override void UpdateItemUse(Player player, SkillData rawdata, bool JustUsed)
        {
            if (player.itemAnimation == 0)
            {
                return;
            }
            ElementalBreathData data = (ElementalBreathData)rawdata;

            if (data.FireDelay == 0)
            {
                CerberusFormData sd = (CerberusFormData)PlayerMod.GetPlayerSkillData(player, 22);
                if (sd != null)
                {
                    sd.HeadFrame[data.AttackTurn] = 30;
                }
                Vector2 ShotSpawnPosition = player.Center;
                ShotSpawnPosition.Y -= 8 * player.gravDir;
                ShotSpawnPosition.X += player.direction * 12;
                int   ShotType  = 0;
                int   Damage    = 0;
                float DamageMod = 0.8f + 0.04f * data.Level;
                switch (data.AttackTurn)
                {
                case 0:
                    ShotType = 34;
                    Damage   = data.GetMeleeDamage(0, DamageMod, player);
                    break;

                case 1:
                    ShotType = 27;
                    Damage   = data.GetRangedDamage(0, DamageMod, player);
                    break;

                case 2:
                    ShotType = 95;
                    Damage   = data.GetMagicDamage(0, DamageMod, player);
                    break;
                }
                if (Main.rand.Next(4) == 0)
                {
                    Damage   = data.GetSummonDamage(0, DamageMod, player);
                    ShotType = Terraria.ID.ProjectileID.MagicMissile;
                }
                Vector2     ProjDirection = GetDirection(ShotSpawnPosition, new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition);
                const float ShotSpeed     = 12f;
                Projectile.NewProjectile(ShotSpawnPosition, ProjDirection * ShotSpeed, ShotType, Damage, 0.8f, player.whoAmI);
                data.AttackTurn++;
                if (data.AttackTurn > 2)
                {
                    data.AttackTurn = 0;
                }
                data.OverdriveValue++;
                data.FireDelay = FireDelayMax;
                if (data.OverdriveValue >= 4)
                {
                    data.FireDelay = (byte)(data.FireDelay * 0.5f);
                    if (data.OverdriveValue >= 12)
                    {
                        data.OverdriveValue -= 12;
                    }
                }
                if (player.statLife < player.statLifeMax2 * 0.5f)
                {
                    data.FireDelay /= 2;
                }
            }
        }