Beispiel #1
0
        public override void SafeKill(int timeLeft, Player player, OrchidModPlayer modPlayer)
        {
            Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 85);
            int dmg = projectile.damage;

            OrchidModProjectile.spawnDustCircle(projectile.Center, 184, 200, 15, false, 1.5f, 1f, 5f);
            OrchidModProjectile.spawnDustCircle(projectile.Center, 184, 175, 30, false, 1.5f, 1f, 5f);

            Vector2 move     = Vector2.Zero;
            float   distance = 500f;

            for (int k = 0; k < 200; k++)
            {
                if (Main.npc[k].active && !Main.npc[k].friendly)
                {
                    Vector2 newMove    = Main.npc[k].Center - projectile.Center;
                    float   distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
                    if (distanceTo < distance)
                    {
                        OrchidModAlchemistNPC modTarget = Main.npc[k].GetGlobalNPC <OrchidModAlchemistNPC>();
                        modTarget.alchemistWater = 60 * 10;
                    }
                }
            }
        }
Beispiel #2
0
 public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
 {
     if (OrchidModAlchemistNPC.AttractiteCanHome(target) || !this.hasTarget)
     {
         projectile.Kill();
     }
 }
Beispiel #3
0
        public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                            OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            if (!(target.boss || target.type == NPCID.TargetDummy) && target.knockBackResist > 0f)
            {
                target.AddBuff(mod.BuffType("SlimeSlow"), 90 * (alchProj.nbElements * 2));
            }

            int rand = alchProj.nbElements;

            rand += alchProj.hasCloud() ? 2 : 0;
            if (Main.rand.Next(10) < rand && !alchProj.noCatalyticSpawn)
            {
                int     dmg            = getSecondaryDamage(player, modPlayer, alchProj.nbElements);
                int     proj           = ProjectileType <Alchemist.Projectiles.Reactive.SlimeBubbleLava>();
                Vector2 perturbedSpeed = new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(20));
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, proj, dmg, 0f, projectile.owner);
            }

            if (modTarget.alchemistFire > 0)
            {
                int nb   = Main.rand.Next(3) + 3;
                int dmg  = (int)(getSecondaryDamage(player, modPlayer, alchProj.nbElements) * 1.5);
                int proj = ProjectileType <Alchemist.Projectiles.Fire.HellSlimeFlaskProj>();
                for (int i = 0; i < nb; i++)
                {
                    Vector2 perturbedSpeed = projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15)) * 0.75f;
                    Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, proj, dmg, 1f, projectile.owner);
                }
            }
        }
Beispiel #4
0
        public override void AI()
        {
            for (int l = 0; l < Main.npc.Length; l++)
            {
                NPC target = Main.npc[l];
                if (projectile.Hitbox.Intersects(target.Hitbox))
                {
                    OrchidModAlchemistNPC modTarget = target.GetGlobalNPC <OrchidModAlchemistNPC>();
                    target.AddBuff(BuffType <Alchemist.Buffs.Debuffs.FlashFreeze>(), modTarget.alchemistWater > 0 ? 60 * 30 : 60 * 3);
                }
            }

            for (int l = 0; l < Main.projectile.Length; l++)
            {
                Projectile proj = Main.projectile[l];
                if (projectile.owner == proj.owner && proj.active && projectile.Hitbox.Intersects(proj.Hitbox))
                {
                    if (IceChestFlask.smallProjectiles.Contains(proj.type))
                    {
                        int damage   = projectile.damage;
                        int projType = ProjectileType <IceChestFlaskProjSmall>();
                        Projectile.NewProjectile(proj.Center.X, proj.Center.Y, 0f, 1f, projType, damage, 1f, projectile.owner);
                        proj.active = false;
                    }
                    if (IceChestFlask.bigProjectiles.Contains(proj.type))
                    {
                        int damage   = projectile.damage * 5;
                        int projType = ProjectileType <IceChestFlaskProjBig>();
                        Projectile.NewProjectile(proj.Center.X, proj.Center.Y, 0f, 1f, projType, damage, 5f, projectile.owner);
                        proj.active = false;
                    }
                }
            }
        }
Beispiel #5
0
 public override void SafeOnHitNPC(NPC target, OrchidModAlchemistNPC modTarget, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer)
 {
     if (modTarget.alchemistFire > 0)
     {
         damage = (int)(damage * 1.1f);
     }
 }
Beispiel #6
0
 public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                     OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
 {
     if (alchProj.fireFlask.type != 0)
     {
         modTarget.alchemistWater = 60 * 10;
     }
 }
Beispiel #7
0
        public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                            OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            int rand = alchProj.nbElements;

            if (Main.rand.Next(10) < rand)
            {
                int     dmg            = OrchidModAlchemistHelper.getSecondaryDamage(player, modPlayer, alchProj.nbElements);
                int     proj           = ProjectileType <Alchemist.Projectiles.Reactive.AlchemistHive>();
                Vector2 perturbedSpeed = new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(20));
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, proj, dmg, 0f, projectile.owner);
            }
        }
Beispiel #8
0
        public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                            OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            target.AddBuff(BuffID.Poisoned, 60 * 5);
            int rand = alchProj.nbElements;

            rand += alchProj.hasCloud() ? 2 : 0;
            if (Main.rand.Next(10) < rand && !alchProj.noCatalyticSpawn)
            {
                int     dmg            = getSecondaryDamage(player, modPlayer, alchProj.nbElements);
                int     proj           = ProjectileType <Alchemist.Projectiles.Reactive.PoisonBubble>();
                Vector2 perturbedSpeed = new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(20));
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, proj, dmg, 0f, projectile.owner);
            }
        }
        public override void AI()
        {
            for (int l = 0; l < Main.npc.Length; l++)
            {
                NPC target = Main.npc[l];
                if (projectile.Hitbox.Intersects(target.Hitbox))
                {
                    OrchidModAlchemistNPC modTarget = target.GetGlobalNPC <OrchidModAlchemistNPC>();
                    if (modTarget.alchemistWater > 0)
                    {
                        spawnSpores(ProjectileType <WaterSporeProj>(), target, projectile);
                    }
                    if (modTarget.alchemistAir > 0)
                    {
                        spawnSpores(ProjectileType <AirSporeProj>(), target, projectile);
                    }
                    if (modTarget.alchemistFire > 0)
                    {
                        spawnSpores(ProjectileType <FireSporeProj>(), target, projectile);
                    }
                    if (modTarget.alchemistNature > 0)
                    {
                        spawnSpores(ProjectileType <NatureSporeProj>(), target, projectile);
                    }
                }
            }

            for (int l = 0; l < Main.projectile.Length; l++)
            {
                Projectile proj = Main.projectile[l];
                if (projectile.owner == proj.owner && proj.active && projectile.Hitbox.Intersects(proj.Hitbox) && sporeProjectiles.Contains(proj.type) && proj.localAI[0] != 1f && proj.timeLeft < 590)
                {
                    for (int i = 0; i < 2; i++)
                    {
                        Vector2    vel          = (new Vector2(0f, -5f).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360))));
                        int        spawnProjInt = Projectile.NewProjectile(proj.Center.X, proj.Center.Y, vel.X, vel.Y, proj.type, proj.damage, proj.knockBack, proj.owner);
                        Projectile spawnProj    = Main.projectile[spawnProjInt];
                        spawnProj.localAI[1] = proj.localAI[1];
                        spawnProj.localAI[0] = 1f;
                        spawnProj.timeLeft   = 580;
                        spawnProj.netUpdate  = true;
                    }
                    proj.active    = false;
                    proj.netUpdate = true;
                }
            }
        }
Beispiel #10
0
        public override void SafeKill(int timeLeft, Player player, OrchidModPlayer modPlayer)
        {
            Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 85);
            int dmg = projectile.damage;

            OrchidModProjectile.spawnDustCircle(projectile.Center, 102, 100, 20, false, 1.5f, 1f, 5f);
            OrchidModProjectile.spawnDustCircle(projectile.Center, 102, 150, 20, false, 1.5f, 1f, 5f);
            Player  targetPlayer = Main.player[Main.myPlayer];
            Vector2 center       = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f);
            float   offsetX      = targetPlayer.Center.X - center.X;
            float   offsetY      = targetPlayer.Center.Y - center.Y;
            float   distance     = (float)Math.Sqrt(offsetX * offsetX + offsetY * offsetY);

            if (distance < 300f)
            {
                if (!targetPlayer.moonLeech)
                {
                    int damage = player.statLifeMax2 - player.statLife;
                    if (dmg > damage)
                    {
                        dmg = damage;
                    }
                    if (dmg > 0)
                    {
                        player.HealEffect(dmg, true);
                        player.statLife += dmg;
                    }
                }
            }

            Vector2 move = Vector2.Zero;

            distance = 500f;
            for (int k = 0; k < 200; k++)
            {
                if (Main.npc[k].active && !Main.npc[k].friendly)
                {
                    Vector2 newMove    = Main.npc[k].Center - projectile.Center;
                    float   distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
                    if (distanceTo < distance)
                    {
                        OrchidModAlchemistNPC modTarget = Main.npc[k].GetGlobalNPC <OrchidModAlchemistNPC>();
                        modTarget.alchemistNature = 600;
                    }
                }
            }
        }
Beispiel #11
0
        public override void SafeOnHitNPC(NPC target, OrchidModAlchemistNPC modTarget, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer)
        {
            if (this.projOwner)
            {
                if (modPlayer.alchemistCovent && this.nbElements > 2 && this.airFlaskGlobal == null)                   // Keystone of the Convent
                {
                    float distance       = 500f;
                    bool  keystoneCrit   = (Main.rand.Next(101) <= modPlayer.alchemistCrit + 4);
                    int   keystoneDamage = (int)(22 * (modPlayer.alchemistDamage + player.allDamage - 1f));
                    int   absorbedCount  = 0;
                    int   spawnProj      = ProjectileType <Alchemist.Projectiles.Air.KeystoneOfTheConventProj>();
                    for (int k = 0; k < Main.maxNPCs; k++)
                    {
                        if (Main.npc[k].active)
                        {
                            Vector2 newMove    = Main.npc[k].Center - target.Center;
                            float   distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
                            if (distanceTo < distance)
                            {
                                OrchidModAlchemistNPC modTargetSecondary = Main.npc[k].GetGlobalNPC <OrchidModAlchemistNPC>();
                                if (modTargetSecondary.alchemistAir > 0)
                                {
                                    modTargetSecondary.alchemistAir = 0;
                                    absorbedCount++;
                                    newMove /= -10f;
                                    Projectile.NewProjectile(Main.npc[k].Center.X, Main.npc[k].Center.Y, newMove.X, newMove.Y, spawnProj, 0, 0f, projectile.owner);
                                }
                            }
                        }
                    }
                    player.ApplyDamageToNPC(target, Main.DamageVar(keystoneDamage * absorbedCount), 0f, player.direction, keystoneCrit);
                }

                this.hitNPC = true;
                OrchidModGlobalNPC modTargetGlobal = target.GetGlobalNPC <OrchidModGlobalNPC>();

                this.OnHitNPCFirst(target, damage, knockback, crit, player, modPlayer, modTarget, modTargetGlobal);
                this.OnHitNPCSecond(target, damage, knockback, crit, player, modPlayer, modTarget, modTargetGlobal);
                this.OnHitNPCThird(target, damage, knockback, crit, player, modPlayer, modTarget, modTargetGlobal);
            }
        }
Beispiel #12
0
        public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                            OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            if (alchProj.fireFlask.type != 0)
            {
                int dmg = getSecondaryDamage(player, modPlayer, alchProj.nbElements);
                modTarget.spreadOilFire(target.Center, dmg, Main.player[projectile.owner]);
                Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 45);
            }

            int rand = alchProj.nbElements;

            rand += alchProj.hasCloud() ? 2 : 0;
            if (Main.rand.Next(6) < rand && !alchProj.noCatalyticSpawn)
            {
                int     dmg            = 0;
                int     proj           = ProjectileType <Alchemist.Projectiles.Reactive.OilBubble>();
                Vector2 perturbedSpeed = new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(20));
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, proj, dmg, 0f, projectile.owner);
            }
        }
Beispiel #13
0
        public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                            OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            if (!(target.boss || target.type == NPCID.TargetDummy) && target.knockBackResist > 0f)
            {
                target.AddBuff(mod.BuffType("SlimeSlow"), 90 * (alchProj.nbElements * 2));
            }

            int rand = alchProj.nbElements;

            rand += alchProj.hasCloud() ? 2 : 0;
            rand += player.HasBuff(BuffType <Alchemist.Buffs.KingSlimeFlaskBuff>()) ? 2 : 0;
            if (Main.rand.Next(10) < rand && !alchProj.noCatalyticSpawn)
            {
                int dmg = getSecondaryDamage(player, modPlayer, alchProj.nbElements);
                dmg += player.HasBuff(BuffType <Alchemist.Buffs.KingSlimeFlaskBuff>()) ? 5 : 0;
                int     proj           = ProjectileType <Alchemist.Projectiles.Reactive.SlimeBubble>();
                Vector2 perturbedSpeed = new Vector2(0f, -5f).RotatedByRandom(MathHelper.ToRadians(20));
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, proj, dmg, 0f, projectile.owner);
            }
        }
Beispiel #14
0
 public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                     OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
 {
     target.AddBuff(BuffType <Alchemist.Buffs.Debuffs.Attraction>(), 60 * (alchProj.nbElements * 3));
 }
Beispiel #15
0
        public override void KillFirst(int timeLeft, Player player, OrchidModPlayer modPlayer, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
        {
            if (alchProj.fireFlask.type == 0)
            {
                int range = 135 * alchProj.nbElements;
                int nb    = 20 * alchProj.nbElements;
                OrchidModProjectile.spawnDustCircle(projectile.Center, this.rightClickDust, (int)(range * 0.75), nb, true, 1.5f, 1f, 8f);
                OrchidModProjectile.spawnDustCircle(projectile.Center, this.rightClickDust, (int)(range * 0.5), (int)(nb / 3), true, 1.5f, 1f, 16f, true, true, false, 0, 0, true);

                int damage = getSecondaryDamage(player, modPlayer, alchProj.nbElements);

                /*
                 * int projType = ProjectileType<Alchemist.Projectiles.Water.IceChestFlaskProj>();
                 * int newProjectileInt = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, projType, damage, 0f, projectile.owner);
                 * Projectile newProjectile = Main.projectile[newProjectileInt];
                 * newProjectile.width = range * 2;
                 * newProjectile.height = range * 2;
                 * newProjectile.position.X = projectile.Center.X - (newProjectile.width / 2);
                 * newProjectile.position.Y = projectile.Center.Y - (newProjectile.width / 2);
                 * newProjectile.netUpdate = true;
                 */

                for (int i = 0; i < 20; i++)
                {
                    int dust = Dust.NewDust(projectile.position, range * 2, range * 2, 261);
                    Main.dust[dust].scale       = 1.2f;
                    Main.dust[dust].noGravity   = true;
                    Main.dust[dust].velocity.X /= 3;
                    Main.dust[dust].velocity.Y /= 3;
                }

                for (int l = 0; l < Main.npc.Length; l++)
                {
                    NPC   target   = Main.npc[l];
                    float offsetX  = target.Center.X - projectile.Center.X;
                    float offsetY  = target.Center.Y - projectile.Center.Y;
                    float distance = (float)Math.Sqrt(offsetX * offsetX + offsetY * offsetY);
                    if ((range + (target.width / 2)) > distance)
                    {
                        OrchidModAlchemistNPC modTarget = target.GetGlobalNPC <OrchidModAlchemistNPC>();
                        target.AddBuff(BuffType <Alchemist.Buffs.Debuffs.FlashFreeze>(), modTarget.alchemistWater > 0 ? 60 * 30 : 60 * 3);
                    }
                }

                for (int l = 0; l < Main.projectile.Length; l++)
                {
                    Projectile proj     = Main.projectile[l];
                    float      offsetX  = proj.Center.X - projectile.Center.X;
                    float      offsetY  = proj.Center.Y - projectile.Center.Y;
                    float      distance = (float)Math.Sqrt(offsetX * offsetX + offsetY * offsetY);
                    if (player.whoAmI == proj.owner && proj.active && (range + (proj.width / 2)) > distance)
                    {
                        if (smallProjectiles.Contains(proj.type))
                        {
                            int projType = ProjectileType <IceChestFlaskProjSmall>();
                            Projectile.NewProjectile(proj.Center.X, proj.Center.Y, 0f, 1f, projType, damage, 1f, player.whoAmI);
                            proj.active    = false;
                            proj.netUpdate = true;
                        }

                        if (bigProjectiles.Contains(proj.type))
                        {
                            int projType = ProjectileType <IceChestFlaskProjBig>();
                            Projectile.NewProjectile(proj.Center.X, proj.Center.Y, 0f, 1f, projType, damage * 5, 5f, player.whoAmI);
                            proj.active    = false;
                            proj.netUpdate = true;
                        }
                    }
                }
            }
        }
Beispiel #16
0
 public override void OnHitNPCFirst(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                    OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
 {
     modTarget.alchemistNature = 60 * 10;
 }
Beispiel #17
0
        public override void AI()
        {
            if (!this.initialized)
            {
                this.orbitPoint  = projectile.Center;
                this.initialized = true;
            }

            projectile.ai[1]     = projectile.ai[1] + 1f + projectile.ai[0] >= 360f ? 0f : projectile.ai[1] + 1 + projectile.ai[0];
            projectile.rotation += 0.1f + (projectile.ai[0] / 30f);

            if (Main.rand.Next(30) == 0)
            {
                int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 21);
                Main.dust[dust].noGravity = true;
                Main.dust[dust].noLight   = true;
            }

            if (projectile.timeLeft <= 880)
            {
                if (projectile.timeLeft == 880)
                {
                    projectile.friendly  = true;
                    projectile.netUpdate = true;
                }
                else
                {
                    float  distance = 2000f;
                    Player player   = Main.player[projectile.owner];
                    if (player.HasBuff(BuffType <Alchemist.Buffs.StellarTalcBuff>()))
                    {
                        orbitPoint = player.Center;
                    }
                    else
                    {
                        for (int k = 0; k < 200; k++)
                        {
                            if (Main.npc[k].active && !Main.npc[k].dontTakeDamage && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5 &&
                                OrchidModAlchemistNPC.AttractiteCanHome(Main.npc[k]))
                            {
                                Vector2 newMove    = Main.npc[k].Center - projectile.Center;
                                float   distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
                                if (distanceTo < distance)
                                {
                                    distance   = distanceTo;
                                    orbitPoint = Main.npc[k].Center;
                                }
                            }
                        }
                    }

                    Vector2 move = orbitPoint - projectile.Center + new Vector2(0f, 100f).RotatedBy(MathHelper.ToRadians(projectile.ai[1]));
                    distance = (float)Math.Sqrt(move.X * move.X + move.Y * move.Y);
                    move.Normalize();
                    float vel = (1f + (distance * 0.05f));
                    vel   = vel > 10f ? 10f : vel;
                    move *= vel;
                    projectile.velocity = move;
                }
            }
        }
Beispiel #18
0
        public void OnHitNPCThird(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer, OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal)
        {
            if (this.fireFlaskGlobal != null)
            {
                fireFlaskGlobal.onHitNPCThirdDelegate(target, damage, knockback, crit, player, modPlayer, modTarget, modTargetGlobal, this, projectile, this.fireFlaskGlobal);
            }

            if (this.waterFlaskGlobal != null)
            {
                waterFlaskGlobal.onHitNPCThirdDelegate(target, damage, knockback, crit, player, modPlayer, modTarget, modTargetGlobal, this, projectile, this.waterFlaskGlobal);
            }

            if (this.natureFlaskGlobal != null)
            {
                natureFlaskGlobal.onHitNPCThirdDelegate(target, damage, knockback, crit, player, modPlayer, modTarget, modTargetGlobal, this, projectile, this.natureFlaskGlobal);
            }

            if (this.airFlaskGlobal != null)
            {
                airFlaskGlobal.onHitNPCThirdDelegate(target, damage, knockback, crit, player, modPlayer, modTarget, modTargetGlobal, this, projectile, this.airFlaskGlobal);
            }

            if (this.lightFlaskGlobal != null)
            {
                lightFlaskGlobal.onHitNPCThirdDelegate(target, damage, knockback, crit, player, modPlayer, modTarget, modTargetGlobal, this, projectile, this.lightFlaskGlobal);
            }

            if (this.darkFlaskGlobal != null)
            {
                darkFlaskGlobal.onHitNPCThirdDelegate(target, damage, knockback, crit, player, modPlayer, modTarget, modTargetGlobal, this, projectile, this.darkFlaskGlobal);
            }
        }
Beispiel #19
0
        public override void AI()
        {
            if (!this.initialized)
            {
                projectile.ai[1]     = Main.rand.Next(2) == 0 ? -1 : 1;
                projectile.ai[0]     = 150;
                projectile.timeLeft -= Main.rand.Next(15);
                projectile.netUpdate = true;
                this.initialized     = true;
            }

            if (projectile.timeLeft <= 550)
            {
                if (projectile.timeLeft == 550)
                {
                    projectile.velocity *= (float)((4 + Main.rand.Next(3)) / 10f);
                    projectile.friendly  = true;
                    projectile.netUpdate = true;
                }
                else
                {
                    Vector2 move     = Vector2.Zero;
                    float   distance = 2000f;
                    int     flag     = -1;
                    for (int k = 0; k < 200; k++)
                    {
                        if (Main.npc[k].active && !Main.npc[k].dontTakeDamage && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5 &&
                            OrchidModAlchemistNPC.AttractiteCanHome(Main.npc[k]))
                        {
                            Vector2 newMove    = Main.npc[k].Center - projectile.Center;
                            float   distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
                            if (distanceTo < distance)
                            {
                                move     = newMove;
                                distance = distanceTo;
                                flag     = k;
                            }
                        }
                    }

                    if (flag > -1)
                    {
                        this.hasTarget = true;

                        float npcPosX  = Main.npc[flag].Center.X;
                        float npcPosY  = Main.npc[flag].Center.Y;
                        float projPosX = projectile.Center.X;
                        float projPosY = projectile.Center.Y;
                        if (Math.Abs(npcPosY - projPosY) > 5f)
                        {
                            if (npcPosY > projPosY)
                            {
                                projectile.velocity.Y += projectile.velocity.X < 5f ? 0.75f : 0f;
                            }
                            else
                            {
                                projectile.velocity.Y -= projectile.velocity.Y > -5f ? 0.75f : 0f;
                            }
                            projectile.velocity.X *= 0.9f;
                        }
                        else
                        {
                            if (npcPosX > projPosX)
                            {
                                projectile.velocity.X += projectile.velocity.X < 8f ? 0.75f : 0f;
                            }
                            else
                            {
                                projectile.velocity.X -= projectile.velocity.X > -8f ? 0.75f : 0f;
                            }
                            projectile.velocity.Y *= 0.9f;
                        }

                        // Vector2 newVel = Main.npc[flag].Center - projectile.Center;
                        // newVel.Normalize();
                        // projectile.ai[0] -= projectile.ai[0] > 0f ? 1f : 0f;
                        // projectile.velocity = newVel.RotatedBy(0.01f * (int)projectile.ai[0] * (int)projectile.ai[1]) * (6f + 0.05f * (int)projectile.ai[0]);

                        if (Main.rand.Next(4) == 0)
                        {
                            int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 16);
                            Main.dust[dust].noGravity = true;
                            Main.dust[dust].noLight   = true;
                            Main.dust[dust].scale    *= 1.5f;
                        }

                        projectile.timeLeft++;
                    }
                    else
                    {
                        this.hasTarget = false;
                        int angle = (int)(5 * projectile.ai[1]);
                        move = projectile.velocity.RotatedBy(MathHelper.ToRadians(angle));
                        move.Normalize();
                        move *= 3f;
                        projectile.velocity = move;
                    }
                }
            }
        }
Beispiel #20
0
 public override void SafeOnHitNPC(NPC target, OrchidModAlchemistNPC modTarget, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer)
 {
     target.AddBuff(BuffType <Alchemist.Buffs.Debuffs.Attraction>(), 60 * 5);
 }
Beispiel #21
0
        // public override Color? GetAlpha(Color lightColor) {
        // return Color.White;
        // }

        public override void AI()
        {
            projectile.velocity.Y += projectile.velocity.Y < 3f ? 0.1f : 0f;

            if (!this.initialized)
            {
                projectile.ai[1]     = Main.rand.Next(2) == 0 ? -1 : 1;
                projectile.timeLeft -= Main.rand.Next(15);
                projectile.netUpdate = true;
                this.initialized     = true;
            }

            if (projectile.timeLeft <= 550)
            {
                if (projectile.timeLeft == 550)
                {
                    projectile.velocity *= (float)((4 + Main.rand.Next(3)) / 10f);
                    projectile.friendly  = true;
                    projectile.netUpdate = true;
                }
                else
                {
                    Vector2 move     = Vector2.Zero;
                    float   distance = 2000f;
                    int     flag     = -1;
                    for (int k = 0; k < 200; k++)
                    {
                        if (Main.npc[k].active && !Main.npc[k].dontTakeDamage && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5 &&
                            OrchidModAlchemistNPC.AttractiteCanHome(Main.npc[k]))
                        {
                            Vector2 newMove    = Main.npc[k].Center - projectile.Center;
                            float   distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
                            if (distanceTo < distance)
                            {
                                move     = newMove;
                                distance = distanceTo;
                                flag     = k;
                            }
                        }
                    }

                    if (flag > -1)
                    {
                        if (Main.npc[flag].Center.X > projectile.Center.X)
                        {
                            projectile.velocity.X += projectile.velocity.X < 5f ? 0.75f : 0f;
                        }
                        else
                        {
                            projectile.velocity.X -= projectile.velocity.X > -5f ? 0.75f : 0f;
                        }

                        projectile.timeLeft++;

                        if (Main.rand.Next(4) == 0)
                        {
                            int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 44);
                            Main.dust[dust].noGravity = true;
                            Main.dust[dust].noLight   = true;
                            Main.dust[dust].scale    *= 1.5f;
                        }
                    }
                    else
                    {
                        float absY = Math.Abs(projectile.velocity.Y);
                        projectile.velocity.X = (3f - absY) * projectile.ai[1];
                    }
                }
            }
        }
Beispiel #22
0
        public override void AI()
        {
            if (!this.initialized)
            {
                projectile.ai[1]     = Main.rand.Next(2) == 0 ? -1 : 1;
                projectile.timeLeft -= Main.rand.Next(15);
                projectile.netUpdate = true;
                this.initialized     = true;
            }

            if (projectile.timeLeft <= 550)
            {
                if (projectile.timeLeft == 550)
                {
                    projectile.velocity *= (float)((4 + Main.rand.Next(3)) / 10f);
                    projectile.friendly  = true;
                    projectile.netUpdate = true;
                }
                else
                {
                    Vector2 move     = Vector2.Zero;
                    float   distance = 2000f;
                    bool    target   = false;
                    for (int k = 0; k < 200; k++)
                    {
                        if (Main.npc[k].active && !Main.npc[k].dontTakeDamage && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5 &&
                            OrchidModAlchemistNPC.AttractiteCanHome(Main.npc[k]))
                        {
                            Vector2 newMove    = Main.npc[k].Center - projectile.Center;
                            float   distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
                            if (distanceTo < distance)
                            {
                                move     = newMove;
                                distance = distanceTo;
                                target   = true;
                            }
                        }
                    }

                    if (target)
                    {
                        move.Normalize();
                        float vel = (1f + (distance * 0.03f));
                        vel   = vel > 10f ? 10f : vel;
                        move *= vel;
                        projectile.velocity = move;
                        projectile.timeLeft++;

                        if (Main.rand.Next(4) == 0)
                        {
                            int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 29);
                            Main.dust[dust].noGravity = true;
                            Main.dust[dust].noLight   = true;
                            Main.dust[dust].scale    *= 1.5f;
                        }
                    }
                    else
                    {
                        int angle = (int)(5 * projectile.ai[1]);
                        move = projectile.velocity.RotatedBy(MathHelper.ToRadians(angle));
                        move.Normalize();
                        move *= 3f;
                        projectile.velocity = move;
                    }
                }
            }
        }
Beispiel #23
0
 public override void OnHitNPCSecond(NPC target, int damage, float knockback, bool crit, Player player, OrchidModPlayer modPlayer,
                                     OrchidModAlchemistNPC modTarget, OrchidModGlobalNPC modTargetGlobal, AlchemistProj alchProj, Projectile projectile, OrchidModGlobalItem globalItem)
 {
     target.AddBuff(BuffID.OnFire, (60 * 3) + (60 * (alchProj.nbElements)));
 }
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            OrchidModAlchemistNPC modTarget = target.GetGlobalNPC <OrchidModAlchemistNPC>();

            modTarget.alchemistAir = 600;
        }