Example #1
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            Player  p       = Main.player[projectile.owner];
            MPlayer mplayer = (MPlayer)(p.GetModPlayer(mod, "MPlayer"));

            projectile.friendly = false;
            Vector2 vel = projectile.velocity;

            vel.Normalize();
            vel *= 6 + mplayer.specialProgressionCount / 1.8f;
            if (target.knockBackResist != 0)
            {
                GNPC info = target.GetGlobalNPC <GNPC>();
                if (target.realLife != -1)
                {
                    target = Main.npc[target.realLife];
                }                                                                 //if worm style, target head
                target.velocity = vel;
                if (Main.netMode != 0)
                {
                    var netmessage = mod.GetPacket();
                    netmessage.Write("VelNPC");
                    netmessage.Write((double)vel.X);
                    netmessage.Write((double)vel.Y);
                    netmessage.Write(target.whoAmI);
                    netmessage.Send();
                }
                target.AddBuff(mod.BuffType("MonkPalm"), 60);
                info.monkPalmOwner = projectile.owner;
            }
        }
Example #2
0
        public static void DevouringVoid(Player player)
        {
            float range = 22 * 16;

            range *= range;
            Vector2 pos = player.Center;

            for (int i = 0; i < Main.maxNPCs; i++)
            {
                NPC npc = Main.npc[i];
                if (!npc.active || npc.lifeMax <= 5 || npc.friendly || npc.dontTakeDamage)
                {
                    continue;
                }
                if (Vector2.DistanceSquared(npc.Center, pos) > range)
                {
                    continue;
                }
                GNPC npcData = npc.GetGlobalNPC <GNPC>();
                npcData.voidInfluence = true;
                if (npcData.voidStacks < 4 * DELAY)
                {
                    npcData.voidStacks++;
                }
                npc.AddBuff(Buffs.Glyph.DevouringVoid._type, 2, true);
            }
        }
Example #3
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            GNPC info = target.GetGlobalNPC <GNPC>();

            target.AddBuff(mod.BuffType <Buffs.DeathMark>(), 180);
            info.deathMarkOwner = projectile.owner;
        }
Example #4
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            GNPC info = target.GetGlobalNPC <GNPC>();

            target.AddBuff(mod.BuffType("Chum"), 120);
            info.chumOwner = projectile.owner;
        }
Example #5
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            Player  p       = Main.player[projectile.owner];
            MPlayer mplayer = p.GetModPlayer <MPlayer>();

            projectile.friendly = false;
            Vector2 vel = projectile.velocity;

            vel.Normalize();
            vel *= 6 + mplayer.specialProgressionCount / 1.8f;
            if (target.knockBackResist != 0)
            {
                GNPC info = target.GetGlobalNPC <GNPC>();
                if (target.realLife != -1)
                {
                    target = Main.npc[target.realLife];
                }                                                                 //if worm style, target head
                target.velocity = vel;
                if (Main.netMode != NetmodeID.SinglePlayer)
                {
                    VelocityChangeNpcNetMsg.SerializeAndSend(
                        mod,
                        vel,
                        target.whoAmI);
                }
                target.AddBuff(mod.BuffType <Buffs.MonkPalm>(), 60);
                info.monkPalmOwner = projectile.owner;
            }
        }
Example #6
0
        public override bool ReApply(NPC npc, int time, int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>(mod);

            if (info.GhostJellyStacks < 5)
            {
                info.GhostJellyStacks++;
            }
            return(true);
        }
Example #7
0
        public override bool ReApply(NPC npc, int time, int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (info.angelWrathStacks < 5)
            {
                info.angelWrathStacks++;
            }
            return(true);
        }
Example #8
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            {
                int dust = Dust.NewDust(npc.Center, npc.width, npc.height, 112);
                Main.dust[dust].velocity *= -1f;
                Main.dust[dust].scale    *= .35f * info.angelWrathStacks;
                Main.dust[dust].noGravity = true;
                Vector2 vector2_1 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
                vector2_1.Normalize();
                Vector2 vector2_2 = vector2_1 * ((float)Main.rand.Next(50, 100) * 0.04f);
                Main.dust[dust].velocity = vector2_2;
                vector2_2.Normalize();
                Vector2 vector2_3 = vector2_2 * 34f;
                Main.dust[dust].position = npc.Center - vector2_3;
            }
            if (info.angelWrathStacks <= 1)
            {
                lightnum = 1;
            }
            if (info.angelWrathStacks <= 2 || info.angelWrathStacks <= 3)
            {
                lightnum = 2;
            }
            if (info.angelWrathStacks >= 4)
            {
                lightnum = 3;
            }
            if (npc.buffTime[buffIndex] == 1)
            {
                Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 9);
                for (int k = 0; k < lightnum; k++)
                {
                    float num12 = Main.rand.Next(-10, 10);
                    float num13 = 100;
                    if ((double)num13 < 0.0)
                    {
                        num13 *= -1f;
                    }
                    if ((double)num13 < 20.0)
                    {
                        num13 = 20f;
                    }
                    float num14  = (float)Math.Sqrt((double)num12 * (double)num12 + (double)num13 * (double)num13);
                    float num15  = 10 / num14;
                    float num16  = num12 * num15;
                    float num17  = num13 * num15;
                    float SpeedX = num16 + (float)Main.rand.Next(-40, 41) * 0.15f;  //this defines the projectile X position speed and randomnes
                    float SpeedY = num17 + (float)Main.rand.Next(-40, 41) * 0.15f;  //this defines the projectile Y position speed and randomnes
                    int   proj   = Projectile.NewProjectile(npc.position.X, npc.position.Y + Main.rand.Next(-400, -380), SpeedX, SpeedY, ModContent.ProjectileType <AngelLightStar>(), 65, 0, Main.myPlayer, 0.0f, 1);
                    info.angelWrathStacks = 0;
                }
            }
        }
        public override bool ReApply(NPC npc, int time, int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>(mod);

            if (info.fireStacks < 3)
            {
                info.fireStacks++;
            }
            npc.buffTime[buffIndex] = time;
            return(true);
        }
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>(mod);

            if (info.fireStacks <= 0)
            {
                info.fireStacks = 1;
            }
            if (Main.rand.Next(2) == 0)
            {
                int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6);
            }
        }
Example #11
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (info.nebulaFlameStacks == 0)
            {
                info.nebulaFlameStacks = 1;
            }

            for (int i = 0; i < info.nebulaFlameStacks; ++i)
            {
                Dust.NewDust(npc.position, npc.width, npc.height, DustID.PinkFlame);
            }
        }
Example #12
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>(mod);

            if (info.GhostJellyStacks == 0)
            {
                info.GhostJellyStacks = 1;
            }

            for (int i = 0; i < info.GhostJellyStacks; ++i)
            {
                Dust.NewDust(npc.position, npc.width, npc.height, 206);
            }
        }
Example #13
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            Player  player  = Main.player[projectile.owner];
            MPlayer mplayer = player.GetModPlayer <MPlayer>();

            if (mplayer.moth)
            {
                GNPC  info     = target.GetGlobalNPC <GNPC>();
                float scaleDam = 1f + (float)Math.Pow(mplayer.specialProgressionCount, 1.6) / 5;
                info.mothPoison     = 2.5f * scaleDam - 2;
                info.mothPoisonTime = 300;
                target.AddBuff(BuffID.Poisoned, 300);
            }
        }
Example #14
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (info.acidBurnStacks <= 0)
            {
                info.acidBurnStacks = 1;
            }

            npc.defense -= 2;

            if (Main.rand.NextBool(2))
            {
                Dust.NewDust(npc.position, npc.width, npc.height, 107, 0, 1);
            }
        }
Example #15
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            int dust = Dust.NewDust(npc.position, npc.width, npc.height, 109);

            if (npc.buffTime[buffIndex] == 1)
            {
                GNPC    info    = npc.GetGlobalNPC <GNPC>();
                Player  player  = Main.player[info.deathMarkOwner];
                MPlayer mplayer = (MPlayer)(player.GetModPlayer(mod, "MPlayer"));
                int     damage  = 5 + (int)(info.deathMarkDamage * (.35 + .01 * mplayer.specialProgressionCount));
                damage += npc.defense / 2;
                npc.StrikeNPC(damage, 0, 0, true);
                NetMessage.SendData(28, -1, -1, null, npc.whoAmI, (float)damage, 0, 0, 1, 0, 0);
                info.deathMarkDamage = 0;
                info.deathMarkOwner  = -1;
            }
        }
Example #16
0
 public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 {
     if (target.life - damage + target.defense / 2 <= 0 && target.knockBackResist != 0)
     {
         if (target.realLife != -1)
         {
             target = Main.npc[target.realLife];
         }                                                                 //if worm style, target head
         GNPC info = target.GetGlobalNPC <GNPC>();
         damage = 1;
         info.killAfterKnockback = true;
     }
     else if (target.knockBackResist == 0)
     {
         damage *= 2;
     }
 }
Example #17
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC npcData = npc.GetGlobalNPC <GNPC>();

            if (Main.rand.NextDouble() < 0.06f + npcData.voidStacks * (0.072f / Items.Glyphs.VoidGlyph.DELAY))
            {
                Dust.NewDustDirect(npc.position - new Vector2(4), npc.width + 8, npc.height + 8, Dusts.VoidDust._type).customData = npc;
            }

            if (npcData.voidStacks > 0)
            {
                npc.buffTime[buffIndex] = 2;
            }
            else
            {
                npc.DelBuff(buffIndex);
            }
        }
Example #18
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            Vector2 spawnPos = new Vector2(npc.Center.X - 16, npc.Center.Y + 32 + npc.height / 2);
            int     dust     = Dust.NewDust(spawnPos, 32, 12, 103);

            if (npc.buffTime[buffIndex] == 1)
            {
                GNPC info = npc.GetGlobalNPC <GNPC>();
                int  p    = Projectile.NewProjectile(spawnPos.X + 16, spawnPos.Y, 0, -6, mod.ProjectileType("AnglerShark"), 1, 0, info.chumOwner);
                for (int i = 0; i < 60; i++)
                {
                    int  d   = Dust.NewDust(spawnPos, 32, 12, 103);
                    Dust dst = Main.dust[d];
                    dst.velocity.Y -= 2.5f;
                    dst.velocity.Normalize();
                    dst.velocity *= 8;
                    dst.scale    *= 1.2f;
                }
            }
        }
Example #19
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC    info    = npc.GetGlobalNPC <GNPC>();
            Player  player  = Main.player[info.monkPalmOwner];
            MPlayer mplayer = player.GetModPlayer <MPlayer>();

            for (int i = 0; i < 200; i++)
            {
                NPC target = Main.npc[i];
                if (!target.Equals(npc))
                {
                    Rectangle targetRect = target.getRect();
                    if (targetRect.Intersects(npc.getRect()) && target.FindBuffIndex(mod.BuffType <Buffs.ActiveCooldown>()) == -1)
                    {
                        float scalar = 1.0f + (float)Math.Pow(mplayer.specialProgressionCount, 1.7) / 6.0f;
                        float damage = (20.0f * scalar * player.meleeDamage + npc.damage) * Main.rand.Next(90, 111) / 100f;
                        int   dir    = (target.position.X > npc.position.X) ? 1 : -1;
                        bool  crit   = Main.rand.Next(100) < player.meleeCrit;
                        target.StrikeNPC((int)damage, 12, dir, crit);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, target.whoAmI, damage, 12, dir, crit ? 1 : 0);
                        }
                        target.AddBuff(mod.BuffType <Buffs.ActiveCooldown>(), 60);
                    }
                }
            }
            //npc.velocity = npc.oldVelocity;
            if (npc.buffTime[buffIndex] <= 30)
            {
                npc.velocity *= .95f;
            }
            if (npc.buffTime[buffIndex] == 1 && info.killAfterKnockback)
            {
                npc.StrikeNPC(npc.life + npc.defense / 2 + 1, 0, 0);
                if (Main.netMode != NetmodeID.SinglePlayer)
                {
                    NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, npc.life + npc.defense / 2 + 1);
                }
            }
        }
Example #20
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (info.acidBurnStacks <= 0)
            {
                info.acidBurnStacks = 1;
            }

            if (Main.rand.NextBool(2))
            {
                int a  = Dust.NewDust(npc.position, npc.width, npc.height, 184, 0, 1);
                int ab = Dust.NewDust(npc.position, npc.width, npc.height, 184, 0, 1);
                int ac = Dust.NewDust(npc.position, npc.width, npc.height, 184, 0, 1);
                Main.dust[a].alpha  = 100;
                Main.dust[ab].alpha = 100;
                Main.dust[ac].alpha = 100;
                Main.dust[a].scale  = Main.rand.NextFloat(.3f, .9f);
                Main.dust[ab].scale = Main.rand.NextFloat(.3f, .9f);
                Main.dust[ac].scale = Main.rand.NextFloat(.3f, .9f);
            }
        }
Example #21
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC modNPC = npc.GetGlobalNPC <GNPC>();

            double chance = npc.width * npc.height;

            chance = Math.Max(0.02, chance * 0.00003);
            if (!modNPC.sanguinePrev)
            {
                for (int i = 0; i < 4; i++)
                {
                    Vector2 offset = Main.rand.NextVec2CircularEven(npc.width >> 1, npc.height >> 1);
                    Dust.NewDustPerfect(npc.Center + offset, Dusts.Blood._type).customData = npc;
                }
            }
            if (Main.rand.NextDouble() < chance && npc.buffTime[buffIndex] > 60)
            {
                Vector2 offset = Main.rand.NextVec2CircularEven(npc.width >> 1, npc.height >> 1);
                Dust.NewDustPerfect(npc.Center + offset, Dusts.Blood._type).customData = npc;
            }
            modNPC.sanguineBleed = true;
        }
Example #22
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            int dust = Dust.NewDust(npc.Center, npc.width, npc.height, DustID.Clentaminator_Purple);

            Main.dust[dust].velocity *= -1f;
            Main.dust[dust].scale    *= .5f * info.angelLightStacks;
            Main.dust[dust].noGravity = true;
            Vector2 vector2_1 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));

            vector2_1.Normalize();
            Vector2 vector2_2 = vector2_1 * (Main.rand.Next(50, 100) * 0.04f);

            Main.dust[dust].velocity = vector2_2;
            vector2_2.Normalize();
            Vector2 vector2_3 = vector2_2 * 34f;

            Main.dust[dust].position = npc.Center - vector2_3;

            if (info.angelLightStacks == 2)
            {
                Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 9);
                for (int k = 0; k < Main.rand.Next(1, 3); k++)
                {
                    float num12  = Main.rand.Next(-10, 10);
                    float num14  = (float)Math.Sqrt(num12 * num12 + 100 * 100);
                    float num15  = 10 / num14;
                    float num16  = num12 * num15;
                    float num17  = 100 * num15;
                    float SpeedX = num16 + Main.rand.Next(-40, 41) * 0.05f;                      //this defines the projectile X position speed and randomnes
                    float SpeedY = num17 + Main.rand.Next(-40, 41) * 0.05f;                      //this defines the projectile Y position speed and randomnes
                    Projectile.NewProjectile(npc.position.X, npc.position.Y + Main.rand.Next(-400, -380), SpeedX, SpeedY, ModContent.ProjectileType <AngelLightStar>(), 50, 0, Main.myPlayer, 0.0f, 1);
                    info.angelLightStacks = 0;
                }
            }
        }