Esempio n. 1
0
 public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit)
 {
     if (IsGuardianProjectile(projectile.whoAmI))
     {
         TerraGuardian g = GuardianProj[projectile.whoAmI];
         if (damage > 0 && target.lifeMax > 5 && projectile.friendly && !projectile.hostile && projectile.aiStyle != 59)
         {
             if (target.canGhostHeal)
             {
                 if (g.HasFlag(GuardianFlags.SpectreHealSetEffect) && !g.HasFlag(GuardianFlags.MoonLeech))
                 {
                     projectile.ghostHeal(damage, target.Center);
                 }
                 if (g.HasFlag(GuardianFlags.SpectreSplashSetEffect))
                 {
                     projectile.ghostHurt(damage, target.Center);
                 }
                 if (g.HasFlag(GuardianFlags.NebulaSetEffect) && !g.HasCooldown(GuardianCooldownManager.CooldownType.NebulaCD) && Main.rand.Next(3) == 0)
                 {
                     g.AddCooldown(GuardianCooldownManager.CooldownType.NebulaCD, 30);
                     int Type = Utils.SelectRandom <int>(Main.rand, new int[3] {
                         3453, 3454, 3455
                     });
                     int number = Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, Type, 1, false, 0, false, false);
                     Main.item[number].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
                     Main.item[number].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)projectile.direction;
                 }
             }
         }
     }
 }