예제 #1
0
        public override bool CheckDead(NPC npc)
        {
            // Spread Wither to nearby NPCs
            if (witherStack > 0)
            {
                int dustT = DustType <VoidParticle>();
                for (int i = 0; i < 30; i++)
                {
                    float rot = i / 30f * MathHelper.TwoPi;
                    Dust.NewDustPerfect(npc.Center, dustT, rot.ToRotationVector2() * Main.rand.NextFloat(8, 11), newColor: Color.Black, Scale: 1.6f).noGravity = true;
                }

                int closestNPC = npc.FindClosestNPC(1000);
                if (closestNPC == -1)
                {
                    return(true);
                }

                NPC other = Main.npc[closestNPC];

                int wither = BuffType <Items.ErilipahBiome.Wither>();
                int bIndex = npc.FindBuffIndex(wither);
                int myTime = npc.buffTime[bIndex];

                if (!other.HasBuff(wither))
                {
                    other.AddBuff(wither, myTime + 30);
                }
                else
                {
                    BuffLoader.ReApply(wither, other, myTime + 30, bIndex);
                }

                for (int i = 0; i < 30; i++)
                {
                    float   rot = i / 30f * MathHelper.TwoPi;
                    Vector2 vel = rot.ToRotationVector2() * Main.rand.NextFloat(7.5f, 10);
                    Dust.NewDustPerfect(other.Center + vel * 10, dustT, -vel, newColor: Color.Black, Scale: 1.6f).noGravity = true;
                }

                for (int i = 0; i < 30; i++)
                {
                    Vector2 pos = Vector2.Lerp(npc.Center, other.Center, i / 30f);
                    Dust.NewDustPerfect(pos + Main.rand.NextVector2Circular(6, 6), dustT, Vector2.Zero, newColor: Color.Black, Scale: 1.5f).noGravity = true;
                }
            }
            return(true);
        }