コード例 #1
0
        void Bleed(Player target, int hitDamage)
        {
            int damage   = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, int.MaxValue);
            int duration = (int)MathHelper.Clamp(Type3.GetValue() * 60, 1, int.MaxValue);

            target.GetModPlayer <BuffPlayer>().AddBleedBuff(target, damage, duration);
        }
コード例 #2
0
        void SpawnBurst(Player player, Entity target, int hitDamage)
        {
            PlaySound(player);

            int   spikeCount     = 5;
            float speed          = 20;
            float halfArc        = 0.7f;
            float arc            = halfArc * 2;
            float angleIncrement = arc / (spikeCount - 1);
            float angle          = (target.Center - player.Center).ToRotation() - halfArc;
            int   damage         = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999);

            int spawnerBurst = spikeCount / 2;

            for (int i = 0; i < spikeCount; i++)
            {
                Vector2 velocity = angle.ToRotationVector2() * speed;
                Projectile.NewProjectile(
                    position: player.Center,
                    velocity: velocity,
                    Type: ModContent.ProjectileType <IceBurst>(),
                    Damage: damage,
                    KnockBack: 0,
                    Owner: player.whoAmI,
                    ai0: Type3.GetValue(),
                    ai1: i == spawnerBurst ? 1f : 0f);
                angle += angleIncrement;
            }
        }
コード例 #3
0
        void Bleed(NPC target, int hitDamage)
        {
            int     damage   = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, int.MaxValue);
            int     duration = (int)MathHelper.Clamp(Type3.GetValue() * 60, 1, int.MaxValue);
            BuffNPC pomNPC   = target.GetGlobalNPC <BuffNPC>();

            pomNPC.AddBleedBuff(target, damage, duration);
        }
コード例 #4
0
        void SpawnIcycles(Player player, Entity target, int hitDamage)
        {
            PlaySound(player);

            int projectileNumber = Type2.GetValue();

            for (int i = 0; i < projectileNumber; i++)
            {
                Vector2 velocity = (target.Center - player.Center).SafeNormalize(Vector2.Zero).RotatedBy(Main.rand.NextFloat(-0.4f, 0.4f)) * Main.rand.NextFloat(7f, 20f);
                int     damage   = (int)MathHelper.Clamp(hitDamage * Type3.GetValue(), 1, 999999);
                Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType <Icicle>(), damage, 0, player.whoAmI);
            }
        }
コード例 #5
0
        void SpawnLifeOrbs(Player player, Entity target, int damage)
        {
            int projectileNumber = Type2.GetValue();

            for (int i = 0; i < projectileNumber; i++)
            {
                Vector2 direction  = Main.rand.NextVector2Unit();
                Vector2 velocity   = direction * Main.rand.NextFloat(5, 10);
                Vector2 projTarget = player.Center + Main.rand.NextVector2Circular(player.width * 1.5f, player.height * 1.5f);
                int     heal       = (int)MathHelper.Clamp(damage * Type3.GetValue(), 1, 999999);
                Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType <LifeOrb>(), heal, 0, player.whoAmI, projTarget.X, projTarget.Y);
            }
        }
コード例 #6
0
        void SpawnChainLightning(Player player, Entity target, int hitDamage, bool isNPC)
        {
            PlaySound(player);
            int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999);

            Projectile.NewProjectile(
                position: player.Center,
                velocity: new Vector2(isNPC ? 1 : 0, target.whoAmI),
                Type: ModContent.ProjectileType <ChainLightning>(),
                Damage: damage,
                KnockBack: 0,
                Owner: player.whoAmI,
                ai0: Type3.GetValue());
        }
コード例 #7
0
        void SpawnFrostPulse(Player player, Entity target, int hitDamage)
        {
            PlaySound(player);
            Vector2 velocity = (target.Center - player.Center).SafeNormalize(Vector2.One) * Main.rand.NextFloat(10f, 20f);
            int     damage   = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999);

            Projectile.NewProjectile(
                position: player.Center,
                velocity: velocity,
                Type: ModContent.ProjectileType <FrostPulse>(),
                Damage: damage,
                KnockBack: 0,
                Owner: player.whoAmI,
                ai0: Type3.GetValue());
        }
コード例 #8
0
        void SpawnMeteor(Player player, Entity target, int hitDamage)
        {
            float   height         = 768f;
            Vector2 spawnOffset    = new Vector2(0, -height).RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f));
            Vector2 targetPosition = target.Center + Main.rand.NextVector2Circular(target.width, target.height);
            Vector2 spawnPosition  = targetPosition + spawnOffset;

            PlaySound(spawnPosition);

            int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999);

            Projectile.NewProjectile(
                targetPosition + spawnOffset,
                targetPosition,
                ModContent.ProjectileType <Meteor>(),
                damage,
                0,
                player.whoAmI,
                ai0: hitDamage * Type3.GetValue());
        }
コード例 #9
0
        void Hit(Item item, Player player, int hitDamage)
        {
            if (item == player.HeldItem)
            {
                int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999);

                int intervalTicks = (int)Math.Round(Type3.GetValue() * 60);
                if (intervalTicks < 1)
                {
                    intervalTicks = 1;
                }

                int durationTicks = (int)Math.Round(Type1.GetValue() * 60);
                if (durationTicks < 1)
                {
                    durationTicks = 1;
                }

                player.GetModPlayer <BuffPlayer>().AddStaticStrikeBuff(player, damage, intervalTicks, durationTicks, true);
            }
        }
コード例 #10
0
 void GainDodgeChance(Item item, Player player)
 {
     if (AffixItemItem.IsArmorEquipped(item, player) && (Main.GameUpdateCount - lastProcTime) >= (int)Math.Round(Type3.GetValue() * 60))
     {
         int durationTicks = (int)Math.Round((Type2.GetValue() * 60));
         player.GetModPlayer <BuffPlayer>().AddDodgeChanceBuff(player, Type1.GetValue(), durationTicks, false);
         lastProcTime = Main.GameUpdateCount;
     }
 }
コード例 #11
0
        public override string GetTolltipText(Item item)
        {
            string plusMinus = Type3.GetValue() >= 0 ? "+" : "-";

            return($"{Type1.GetValueFormat()}% chance to Meteor for {Type2.GetValueFormat()}% damage that Ignites({plusMinus}{Type3.GetValueFormat()}%) and leaves Burning Air({plusMinus}{Type3.GetValueFormat()}%)");
        }
コード例 #12
0
        public override string GetTolltipText(Item item)
        {
            string plusMinus = Type3.GetValue() >= 0 ? "+" : "-";

            return($"{Type1.GetValueFormat()}% chance to chain lightning for {Type2.GetValueFormat()}% damage that Shocks({plusMinus}{Type3.GetValueFormat()}%)");
        }
コード例 #13
0
        public override void PostHurt(Item item, Player player, bool pvp, bool quiet, double damage, int hitDirection, bool crit)
        {
            if (AffixItemItem.IsArmorEquipped(item, player) && (Main.GameUpdateCount - lastProcTime) >= (int)Math.Round(Type3.GetValue() * 60))
            {
                player.GetModPlayer <BuffPlayer>().AddGreavesMoveSpeedBuff(player, Type1.GetValue(), (int)Math.Round(Type2.GetValue() * 60), false);

                lastProcTime = Main.GameUpdateCount;
            }
        }
コード例 #14
0
        public override string GetTolltipText(Item item)
        {
            string plusMinus = Type3.GetValue() >= 0 ? "+" : "-";

            return($"{Type1.GetValueFormat()}% chance for lightning to strike for {Type2.GetValueFormat()}% damage and leave Shocked Air({plusMinus}{Type3.GetValueFormat()}%)");
        }
コード例 #15
0
        void SpawnLightningBolt(Player player, Entity target, int hitDamage)
        {
            float   height   = 512;
            Vector2 position = target.Center + Main.rand.NextVector2Circular(target.width, target.height) - new Vector2(0, height);

            PlaySound(position);

            int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999);

            Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType <LightningBolt>(), damage, 0, player.whoAmI, Type3.GetValue(), height);
        }
コード例 #16
0
        public override string GetTolltipText(Item item)
        {
            string plusMinus = Type3.GetValue() >= 0 ? "+" : "-";

            return($"{Type1.GetValueFormat()}% chance to Ice Burst for {Type2.GetValueFormat()}% damage that leaves Chilled Air({ plusMinus }{Type3.GetValueFormat()}%)");
        }
コード例 #17
0
        void SpawnNova(Item item, Player player, int damageTaken)
        {
            if (AffixItemItem.IsArmorEquipped(item, player) && (Main.GameUpdateCount - lastProcTime) >= (int)Math.Round(Type3.GetValue() * 60))
            {
                PlaySound(player);

                Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType <ReflectNova>(), (int)Math.Round(damageTaken * Type1.GetValue()), 0, player.whoAmI, Type2.GetValue());

                lastProcTime = Main.GameUpdateCount;
            }
        }
コード例 #18
0
 void OnHit(Item item, Player player)
 {
     if (item == player.HeldItem && (Main.GameUpdateCount - lastProcTime) >= (int)Math.Round(Type3.GetValue() * 60))
     {
         GainMoveSpeed(player);
     }
 }
コード例 #19
0
        public override string GetTolltipText(Item item)
        {
            string plusMinus = Type3.GetValue() >= 0 ? "+" : "-";

            return($"Gain {plusMinus}{Type1.GetValueFormat()}% move speed on hit for {Type2.GetValueFormat(1)}s ({Type3.GetValueFormat(1)}s CD)");
        }