Пример #1
0
        private void spawnInk()
        {
            npc.rotation = npc.velocity.X * 1.25f;
            Player player = Main.player[npc.target];

            if ((double)Vector2.Distance(player.Center, npc.Center) <= (double)60f && player.position.Y < npc.position.Y + 100 && player.position.Y > npc.position.Y - 100 && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))
            {
                player.AddBuff(80, 2);
                player.AddBuff(22, 2);
                player.AddBuff(163, 2);
                player.Hurt(PlayerDeathReason.LegacyDefault(), (int)(npc.damage / 1.5f), npc.direction, false, false, false, -1);
            }
            for (int i = 0; i < 1; i++)
            {
                int index2 = Dust.NewDust(npc.position, npc.width, npc.height, 261, 0.0f, 0.0f, 100, new Color(r, g, b), 1.1f);
                Main.dust[index2].alpha      += Main.rand.Next(100);
                Main.dust[index2].noGravity   = true;
                Main.dust[index2].velocity   *= 0.3f;
                Main.dust[index2].velocity.X += (float)Main.rand.Next(-80, -40) * 0.025f * npc.velocity.X;
                Main.dust[index2].velocity.Y -= (float)(0.400000005960464 + (double)Main.rand.Next(-3, 14) * 0.150000005960464);
                Main.dust[index2].fadeIn      = (float)(0.25 + (double)Main.rand.Next(15) * 0.150000005960464);
            }

            for (int i = 0; i < 1; i++)
            {
                int index2 = Dust.NewDust(npc.position, npc.width, npc.height, 261, 0.0f, 0.0f, 100, new Color(r, g, b), 2.4f);
                Main.dust[index2].alpha      += Main.rand.Next(100);
                Main.dust[index2].noGravity   = true;
                Main.dust[index2].velocity   *= 0.3f;
                Main.dust[index2].velocity.X += (float)Main.rand.Next(-240, -180) * 0.025f * npc.velocity.X;
                Main.dust[index2].velocity.Y -= (float)(0.400000005960464 + (double)Main.rand.Next(-3, 14) * 0.150000005960464);
                Main.dust[index2].fadeIn      = (float)(0.25 + (double)Main.rand.Next(10) * 0.150000005960464);
            }
        }
Пример #2
0
        //we stripped attacker from calling functions for now, but in case it gets readded again later we keep it.
        static PlayerDeathReason createPlayerDeathReason(object attacker, string reason)
        {
            if (string.IsNullOrWhiteSpace(reason))
            {
                return(PlayerDeathReason.LegacyDefault());
            }
            else
            {
                var result = new PlayerDeathReason();

                result.SourceCustomReason = reason;

                //Disabled following when we created CorruptionLib, since it has no references to CustomNpcs, and the attacker field currently goes unused.
                //will need to reinvestigate how to handle this best.

                //var npc = attacker as CustomNpc;
                //if( npc != null )
                //{
                //	result.SourceNPCIndex = npc.Index;
                //}
                //else
                //{
                //	var projectile = attacker as CustomProjectile;
                //	if( projectile != null )
                //	{
                //		result.SourceProjectileIndex = projectile.Index;
                //	}
                //}

                return(result);
            }
        }
Пример #3
0
        public override void Update(Player player, ref int buffIndex)
        {
            player.moveSpeed *= 0.80f;
            player.jumpBoost  = true;

            if (player.miscCounter % 300 == 0)
            {
                player.Hurt(PlayerDeathReason.LegacyDefault(), 2, 0);
            }
        }
Пример #4
0
        public override void OnHitPlayer(Player target, int damage, bool crit)
        {
            if (Main.expertMode)
            {
                target.AddBuff(mod.BuffType <Slimed>(), 600);
            }

            int damages = Main.rand.Next(5, 11);

            target.Hurt(PlayerDeathReason.LegacyDefault(), damages, 0);

            NPC bloodshotEye = Main.npc[(int)projectile.ai[0]];

            bloodshotEye.life += damages;
            bloodshotEye.HealEffect(damages);
        }
Пример #5
0
        public override void NearbyEffects(int i, int j, bool closer)
        {
            Player player = Main.LocalPlayer;

            float playerX = player.position.X;
            float playerY = player.position.Y;

            if (playerX / 16 - i <= 2 && playerX / 16 - i >= -2 && playerY / 16 - j <= 2 && playerY / 16 - j >= -4.3f)
            {
                player.AddBuff(mod.BuffType("Singed"), 300);
            }
            if (playerX / 16 - i <= 1 && playerX / 16 - i >= -1.25f && playerY / 16 - j <= 1.1f && playerY / 16 - j >= -3.3f)
            {
                player.Hurt(PlayerDeathReason.LegacyDefault(), 100, 0);
            }
        }
        public string Execute(string input = null, TCRClientUser whoRanCommand = null)
        {
            if (input == null || input == "")
            {
                return("Please designate a player to kill. Example: \"kill Unlucky Player\"");
            }

            for (var i = 0; i < Main.player.Length; i++)
            {
                if (Main.player[i].name == input)
                {
                    NetMessage.SendPlayerDeath(i, PlayerDeathReason.LegacyDefault(), 99999, (new Random()).Next(-1, 1), false, -1, -1);
                    return("");
                }
            }
            return("Player not found!");
        }
Пример #7
0
        private void spawnInk()
        {
            Player player = Main.player[npc.target];

            if (!screamed)
            {
                //Main.PlaySound(SoundLoader.customSoundType, (int)npc.position.X, (int)npc.position.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/Mandrake_Scream"));
                screamed = true;
            }
            if (Vector2.Distance(player.Center, npc.Center) <= 130f && player.position.Y < npc.position.Y + 100 && player.position.Y > npc.position.Y - 100 && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))
            {
                player.AddBuff(80, 2);
                player.AddBuff(22, 2);
                player.AddBuff(163, 2);
                player.Hurt(PlayerDeathReason.LegacyDefault(), (int)(npc.damage / 1.5f), npc.direction, false, false, false, -1);
            }
            for (int i = 0; i < 1; i++)
            {
                int index2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, 0.0f, 0.0f, 100, new Color(r, g, b), 1.25f);
                Main.dust[index2].alpha      += Main.rand.Next(100);
                Main.dust[index2].noGravity   = true;
                Main.dust[index2].velocity   *= 0.3f;
                Main.dust[index2].velocity.X += (float)Main.rand.Next(-80, -40) * 0.025f * npc.velocity.X;
                Main.dust[index2].velocity.Y -= (float)(0.4f + Main.rand.Next(-3, 14) * 0.15f);
                Main.dust[index2].fadeIn      = (float)(0.25 + Main.rand.Next(15) * 0.15f);
            }

            for (int i = 0; i < 1; i++)
            {
                int index2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, 0.0f, 0.0f, 100, new Color(r, g, b), 3f);
                Main.dust[index2].alpha      += Main.rand.Next(100);
                Main.dust[index2].noGravity   = true;
                Main.dust[index2].velocity   *= 0.3f;
                Main.dust[index2].velocity.X += (float)Main.rand.Next(-240, -180) * 0.025f * npc.velocity.X;
                Main.dust[index2].velocity.Y -= (float)(0.4f + Main.rand.Next(-3, 14) * 0.15f);
                Main.dust[index2].fadeIn      = (float)(0.25 + Main.rand.Next(10) * 0.15f);
            }
        }
Пример #8
0
        public override void FindFrame(int frameHeight)
        {
            Player player = Main.player[npc.target];

            npc.frameCounter++;

            if (activated)
            {
                if ((double)Vector2.Distance(player.Center, npc.Center) >= (double)60f)
                {
                    if (npc.frameCounter >= 7)
                    {
                        frame++;
                        npc.frameCounter = 0;
                    }
                    if (frame >= 7)
                    {
                        frame = 0;
                    }
                }
                else
                {
                    if (npc.frameCounter >= 5)
                    {
                        frame++;
                        npc.frameCounter = 0;
                    }
                    if (frame >= 13)
                    {
                        frame = 7;
                    }
                    if (frame < 7)
                    {
                        frame = 7;
                    }
                    if (frame == 9 && npc.frameCounter == 4 && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))
                    {
                        player.Hurt(PlayerDeathReason.LegacyDefault(), (int)npc.damage * 2, npc.direction * -1, false, false, false, -1);
                    }
                }
            }
            else
            {
                if (!pickedFrame)
                {
                    frame       = Main.rand.Next(3);
                    pickedFrame = true;
                    switch (frame)
                    {
                    case 0:
                        frame = 13;
                        break;

                    case 1:
                        frame = 14;
                        break;

                    case 2:
                        frame = 15;
                        break;

                    default:
                        break;
                    }
                }
            }
            npc.frame.Y = frameHeight * frame;
        }
Пример #9
0
        public override void FindFrame(int frameHeight)
        {
            const int Frame_1  = 0;
            const int Frame_2  = 1;
            const int Frame_3  = 2;
            const int Frame_4  = 3;
            const int Frame_5  = 4;
            const int Frame_6  = 5;
            const int Frame_7  = 6;
            const int Frame_8  = 7;
            const int Frame_9  = 8;
            const int Frame_10 = 9;

            npc.frame.Width = 240;
            Player player = Main.player[npc.target];

            npc.frameCounter++;

            if (npc.velocity.Y != 0f)
            {
                npc.frame.Y = 2 * frameHeight;
            }
            else if (attacking == 0 && npc.velocity.X == 0f)
            {
                npc.frame.Y = 2 * frameHeight;
                npc.frame.X = 0;
            }
            else if (attacking == 1)
            {
                if (npc.frameCounter < 4)
                {
                    npc.frame.Y = 3 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 8)
                {
                    npc.frame.Y = 3 * frameHeight;
                    npc.frame.X = 240;
                }
                else if (npc.frameCounter < 12)
                {
                    npc.frame.Y = 4 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 16)
                {
                    npc.frame.Y = 4 * frameHeight;
                    npc.frame.X = 240;
                    if (npc.frameCounter == 13 && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) && (double)Vector2.Distance(player.Center, npc.Center) <= (double)150f)
                    {
                        player.Hurt(PlayerDeathReason.LegacyDefault(), (int)(npc.damage * 1.5f), 0, false, false, false, -1);
                        Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 37, 1f, 0.3f);
                        player.velocity.X = npc.direction * 13f;
                        player.velocity.Y = -9f;
                    }
                }
                else if (npc.frameCounter < 20)
                {
                    npc.frame.Y = 5 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 24)
                {
                    npc.frame.Y = 5 * frameHeight;
                    npc.frame.X = 240;
                }
                else if (npc.frameCounter < 28)
                {
                    npc.frame.Y = 6 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 32)
                {
                    npc.frame.Y = 6 * frameHeight;
                    npc.frame.X = 240;
                }
                else if (npc.frameCounter < 36)
                {
                    npc.frame.Y = 7 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 40)
                {
                    npc.frame.Y = 7 * frameHeight;
                    npc.frame.X = 240;
                }
                else if (npc.frameCounter < 44)
                {
                    npc.frame.Y = 8 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 48)
                {
                    npc.frame.Y = 8 * frameHeight;
                    npc.frame.X = 240;
                }
                else if (npc.frameCounter < 52)
                {
                    npc.frame.Y = 9 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 70)
                {
                    npc.frame.Y = 9 * frameHeight;
                    npc.frame.X = 240;
                    if (npc.frameCounter == 69)
                    {
                        attacking = 0;
                        frameRes  = false;
                    }
                }
                else
                {
                    npc.frameCounter = 0;
                }
            }
            else if (attacking == 0)
            {
                if (npc.frameCounter < 7)
                {
                    npc.frame.Y = 0 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 14)
                {
                    npc.frame.Y = 0 * frameHeight;
                    npc.frame.X = 240;
                }
                else if (npc.frameCounter < 21)
                {
                    npc.frame.Y = 1 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 28)
                {
                    npc.frame.Y = 1 * frameHeight;
                    npc.frame.X = 240;
                }
                else if (npc.frameCounter < 35)
                {
                    npc.frame.Y = 2 * frameHeight;
                    npc.frame.X = 0;
                }
                else if (npc.frameCounter < 42)
                {
                    npc.frame.Y = 2 * frameHeight;
                    npc.frame.X = 240;
                }
                else
                {
                    npc.frameCounter = 0;
                }
            }
        }
Пример #10
0
 /// <summary>
 /// Kills the player.
 /// </summary>
 public virtual void KillPlayer()
 {
     NetMessage.SendPlayerDeath(Index, PlayerDeathReason.LegacyDefault(), 99999, (new Random()).Next(-1, 1), false, -1, -1);
 }
Пример #11
0
 /// <summary>
 /// Wounds the player with the given damage.
 /// </summary>
 /// <param name="damage">The amount of damage the player will take.</param>
 public virtual void DamagePlayer(int damage)
 {
     NetMessage.SendPlayerHurt(Index, PlayerDeathReason.LegacyDefault(), damage, (new Random()).Next(-1, 1), false, false, 0, -1, -1);
 }
Пример #12
0
        public void ItemCheck_MeleeHitNPCs(Item sItem, Rectangle itemRectangle, int originalDamage, float knockBack)
        {
            for (int HitNPC = 0; HitNPC < 200; HitNPC++)
            {
                if (!Main.npc[HitNPC].active || Main.npc[HitNPC].immune[player.whoAmI] != 0 || player.attackCD != 0)
                {
                    continue;
                }

                if (!Main.npc[HitNPC].dontTakeDamage && Main.npc[HitNPC].immune[player.whoAmI] == 0)
                {
                    if (!Main.npc[HitNPC].friendly || (Main.npc[HitNPC].type == NPCID.Guide && player.killGuide) || (Main.npc[HitNPC].type == NPCID.Clothier && player.killClothier))
                    {
                        Rectangle vector = new Rectangle((int)Main.npc[HitNPC].position.X, (int)Main.npc[HitNPC].position.Y, Main.npc[HitNPC].width, Main.npc[HitNPC].height);
                        if (itemRectangle.Intersects(vector) && (Main.npc[HitNPC].noTileCollide || player.CanHit(Main.npc[HitNPC])))
                        {
                            int num = Main.DamageVar(originalDamage);;

                            int NPCtype = Item.NPCtoBanner(Main.npc[HitNPC].BannerID());
                            if (NPCtype > 0 && player.NPCBannerBuff[NPCtype] == true)
                            {
                                num = ((!Main.expertMode) ? ((int)((float)num * ItemID.Sets.BannerStrength[Item.BannerToItem(NPCtype)].NormalDamageDealt)) : ((int)((float)num * ItemID.Sets.BannerStrength[Item.BannerToItem(NPCtype)].ExpertDamageDealt)));
                            }



                            int RealDamage = Main.DamageVar(num);

                            if (Main.npc[HitNPC].life > 5)
                            {
                                player.OnHit(Main.npc[HitNPC].Center.X, Main.npc[HitNPC].Center.Y, Main.npc[HitNPC]);
                            }
                            if (player.armorPenetration > 0)
                            {
                                RealDamage += Main.npc[HitNPC].checkArmorPenetration(player.armorPenetration);
                            }
                            int dmgDone = (int)Main.npc[HitNPC].StrikeNPC(RealDamage, knockBack, player.direction, false);
                            if (sItem.modItem != null)
                            {
                                sItem.modItem.OnHitNPC(player, Main.npc[HitNPC], RealDamage, knockBack, false);
                            }
                            OnHitNPC(Main.npc[HitNPC], RealDamage, knockBack, false);
                            ApplyNPCOnHitEffects(sItem, itemRectangle, num, knockBack, HitNPC, RealDamage, dmgDone);
                            int num5 = Item.NPCtoBanner(Main.npc[HitNPC].BannerID());
                            if (num5 >= 0)
                            {
                                player.lastCreatureHit = num5;
                            }
                            if (Main.netMode != NetmodeID.SinglePlayer)
                            {
                                NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, HitNPC, RealDamage, knockBack, player.direction);
                            }
                            if (player.accDreamCatcher)
                            {
                                player.addDPS(RealDamage);
                            }
                            Main.npc[HitNPC].immune[player.whoAmI] = player.itemAnimation;
                            player.attackCD = Math.Max(1, (int)((double)player.itemAnimationMax * 0.33));
                        }
                    }
                }
                else if (Main.npc[HitNPC].type == NPCID.BlueJellyfish || Main.npc[HitNPC].type == NPCID.PinkJellyfish || Main.npc[HitNPC].type == NPCID.GreenJellyfish || Main.npc[HitNPC].type == NPCID.BloodJelly)
                {
                    Rectangle value = new Rectangle((int)Main.npc[HitNPC].position.X, (int)Main.npc[HitNPC].position.Y, Main.npc[HitNPC].width, Main.npc[HitNPC].height);
                    if (itemRectangle.Intersects(value) && (Main.npc[HitNPC].noTileCollide || player.CanHit(Main.npc[HitNPC])))
                    {
                        player.Hurt(PlayerDeathReason.LegacyDefault(), (int)((double)Main.npc[HitNPC].damage * 1.3), -player.direction);
                        Main.npc[HitNPC].immune[player.whoAmI] = player.itemAnimation;
                        player.attackCD = (int)((double)player.itemAnimationMax * 0.33);
                    }
                }
            }
        }
Пример #13
0
        /// <summary> The method called during a combo. Use for ongoing dust and gore effects. </summary>
        public static void ComboEffects(Player player, Item item, bool initial)
        {
            if (initial)
            {
                player.itemAnimation = player.itemAnimationMax + 18;
                player.AddBuff(buffID, 60 * 6);
                player.GetModPlayer <ModPlayerFists>().jumpAgainUppercut = true;
                Main.PlaySound(SoundID.DD2_SkyDragonsFurySwing, player.position);
            }

            Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 10, altHitboxSize);

            player.statDefense += player.itemAnimation; // Bonus defence during special
            if (player.itemAnimation > player.itemAnimationMax)
            {
                // Charging
                Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.Blood, 0, 0, 100, default(Color), 1.2f)];
                d.position -= d.velocity * 20f;
                d.velocity *= 1.5f;
                d.velocity += player.position - player.oldPosition;
                d.noGravity = true;
            }
            else if (player.itemAnimation == player.itemAnimationMax)
            {
                // Lower pitch
                Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 12, 1f, -0.2f);
                if (player.whoAmI == Main.myPlayer)
                {
                    PlayerDeathReason pdr = PlayerDeathReason.LegacyDefault();
                    switch (Main.rand.Next(3))
                    {
                    case 1:
                        pdr.SourceCustomReason = WeaponOut.GetTranslationTextValue("KnucklesIchorSuicide1")
                                                 .Replace("$NAME", player.name);
                        break;

                    case 2:
                        pdr.SourceCustomReason = WeaponOut.GetTranslationTextValue("KnucklesIchorSuicide2")
                                                 .Replace("$NAME", player.name).Replace("$ITEM", item.Name);
                        break;

                    default:
                        pdr.SourceCustomReason = WeaponOut.GetTranslationTextValue("KnucklesIchorSuicide3")
                                                 .Replace("$NAME", player.name);
                        break;
                    }
                    player.immune = false;
                    player.Hurt(pdr, 100 + player.statDefense / 2, player.direction, false, false, false, -1);
                }

                for (int i = 0; i < 30; i++)
                {
                    Dust d = Main.dust[Dust.NewDust(r.TopLeft(), 16, 16, DustID.Blood, 0, -0.5f, 0, default(Color), 2f)];
                    d.velocity.X *= 2f;
                }

                // Allow dash
                player.GetModPlayer <ModPlayerFists>().
                SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0);
            }
            else
            {
                // Punch effect
            }
        }
Пример #14
0
        public override void FindFrame(int frameHeight)
        {
            const int Frame_1  = 0;
            const int Frame_2  = 1;
            const int Frame_3  = 2;
            const int Frame_4  = 3;
            const int Frame_5  = 4;
            const int Frame_6  = 5;
            const int Frame_7  = 6;
            const int Frame_8  = 7;
            const int Frame_9  = 8;
            const int Frame_10 = 9;

            Player player = Main.player[npc.target];

            npc.frameCounter++;
            if (Vector2.Distance(player.Center, npc.Center) <= 45f && npc.velocity.X == 0f)
            {
                if (npc.frameCounter == 24 && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))
                {
                    player.Hurt(PlayerDeathReason.LegacyDefault(), (int)(npc.damage * 1.5f), npc.direction, false, false, false, -1);
                    npc.frame.Y = Frame_10 * frameHeight;
                }
                npc.velocity.X = 0f;;
                if (npc.frameCounter < 5)
                {
                    npc.frame.Y = Frame_6 * frameHeight;
                }
                else if (npc.frameCounter < 10)
                {
                    npc.frame.Y = Frame_7 * frameHeight;
                }
                else if (npc.frameCounter < 15)
                {
                    npc.frame.Y = Frame_8 * frameHeight;
                }
                else if (npc.frameCounter < 20)
                {
                    npc.frame.Y = Frame_9 * frameHeight;
                }
                else if (npc.frameCounter < 25)
                {
                    npc.frame.Y = Frame_10 * frameHeight;
                }
                else
                {
                    npc.frameCounter = 0;
                }
            }
            else
            {
                if (npc.frameCounter < 6)
                {
                    npc.frame.Y = Frame_1 * frameHeight;
                }
                else if (npc.frameCounter < 12)
                {
                    npc.frame.Y = Frame_2 * frameHeight;
                }
                else if (npc.frameCounter < 18)
                {
                    npc.frame.Y = Frame_3 * frameHeight;
                }
                else if (npc.frameCounter < 24)
                {
                    npc.frame.Y = Frame_4 * frameHeight;
                }
                else if (npc.frameCounter < 30)
                {
                    npc.frame.Y = Frame_5 * frameHeight;
                }
                else
                {
                    npc.frameCounter = 0;
                }
            }
        }