Exemplo n.º 1
0
 public override void OnHitByItem(NPC npc, Player player, Item item, int damage, float knockback, bool crit)
 {
     if (bouncy)
     {
         Main.PlaySound(SoundID.Item56);
         player.velocity = npc.DirectionTo(player.Center) * 20;
     }
     if (splitter)
     {
         int      spawnedNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type);
         EliteNPC spawned    = eliteNPC(Main.npc[spawnedNPC]);
         spawned.smol = true;
     }
 }
Exemplo n.º 2
0
 public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit)
 {
     if (bouncy)
     {
         Main.PlaySound(SoundID.Item56);
         projectile.hostile   = true;
         projectile.friendly  = false;
         projectile.velocity *= -1;
         projectile.timeLeft  = 600;
         projectile.penetrate = -1;
         projectile.damage    = npc.damage / 2;
     }
     if (splitter)
     {
         int      spawnedNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type);
         EliteNPC spawned    = eliteNPC(Main.npc[spawnedNPC]);
         spawned.smol = true;
     }
 }
Exemplo n.º 3
0
        public override void AI(NPC npc)
        {
            if (elite)
            {
                if (!invis)
                {
                    int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.GoldFlame);
                    Main.dust[dust].velocity  = npc.velocity;
                    Main.dust[dust].noLight   = true;
                    Main.dust[dust].noGravity = true;
                }

                if (Main.player[npc.target].dead || !Main.player[npc.target].active)
                {
                    npc.active = false;
                    DustExplosion(npc.Center, 0, 80, 20, DustID.GoldFlame, NoGravity: true);
                }
            }
            if (smol)
            {
                npc.scale       = 0.5f;
                npc.dontCountMe = true;
                if (smolstart)
                {
                    smolstart    = false;
                    npc.lifeMax /= 10;
                    npc.life     = npc.lifeMax;
                }
            }
            if (healer && !smol)
            {
                healAuraCooldown--;
                if (healAuraCooldown <= 0)
                {
                    healAuraCooldown = 120;
                    int range      = 300;
                    int enemyCount = 0;
                    DustCircle(npc.Center, 180, range, 235, -5, 3f);
                    for (int i = 0; i < 200; i++)
                    {
                        NPC target = Main.npc[i];
                        if (target.active && target.Distance(npc.Center) <= range && !target.friendly && !target.boss && target != npc && !eliteNPC(target).smol)
                        {
                            enemyCount++;
                            target.HealEffect(target.lifeMax / 10);
                            target.life += target.lifeMax / 10;
                            if (target.life >= target.lifeMax)
                            {
                                target.life = target.lifeMax;
                            }
                        }
                    }
                    npc.HealEffect((npc.lifeMax / 3) * enemyCount + npc.lifeMax / 50);
                    npc.life += (npc.lifeMax / 3) * enemyCount + npc.lifeMax / 50;
                    if (npc.life >= npc.lifeMax)
                    {
                        npc.life = npc.lifeMax;
                    }
                }
            }
            if (summoner && !smol)
            {
                summonCooldown--;
                if (summonCooldown <= 0)
                {
                    summonCooldown = 240;
                    int      spawnedNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type);
                    EliteNPC spawned    = eliteNPC(Main.npc[spawnedNPC]);
                    spawned.smol = true;
                }
            }
        }