Beispiel #1
0
        public override void GetWeaponDamage(Item item, Player player, ref int damage)
        {
            SGAPlayer sgaplayer = player.GetModPlayer(mod, typeof(SGAPlayer).Name) as SGAPlayer;

            if (item.modItem != null)
            {
                var    myType      = (item.modItem).GetType();
                var    n           = myType.Namespace;
                string asastring   = (string)n;
                int    ishavocitem = asastring.Length - asastring.Replace("HavocGear.", "").Length;
                if (ishavocitem > 0 && sgaplayer.Havoc > 0)
                {
                    damage = (int)(damage * 1.25);
                }
            }

            if (sgaplayer.Dankset > 0)
            {
                damage = (int)(damage + (damage * ((player.magicDamage + player.minionDamage + player.rangedDamage + player.meleeDamage + player.thrownDamage) - 5f) * 0.10f));
            }

            if (sgaplayer.IDGset && sgaplayer.digiStacks > 0 && item.ranged)
            {
                damage = damage + (int)((float)damage * ((float)sgaplayer.digiStacks / (float)sgaplayer.digiStacksMax) * 1.00f);
            }
        }
		public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
		{
			if (projectile.friendly)
			{
				Player owner = Main.player[projectile.owner];
				SGAPlayer sgaply = owner.SGAPly();
				if (owner != null)
				{
					float damageIncrease = 1f;
					if (projectile.aiStyle == 99)
					{
						damageIncrease += projectile.Distance(owner.MountedCenter) / ((float)ProjectileID.Sets.YoyosMaximumRange[projectile.type])*0.15f;
					}
					if (IsTrueMelee(projectile,owner))
						damageIncrease += (sgaply.trueMeleeDamage-1f);

					damage = (int)((float)damage * damageIncrease);

				}
			}
			if (damageReduce > 1)
			{
				damage = (int)(damage / damageReduce);
			}


			if (embued)
				damage = (int)(projectile.damage * 1.50f);


		}
 public static void DoHurt(SGAPlayer player, PlayerDeathReason damageSource, ref int Damage, ref int hitDirection, bool pvp, bool quiet, ref bool Crit, int cooldownCounter)
 {
     if (FirstHurtEvent != null)
     {
         FirstHurtEvent.Invoke(player, damageSource, ref Damage, ref hitDirection, pvp, quiet, ref Crit, cooldownCounter);
     }
 }
        static private void Menu_UICharacterListItem(On.Terraria.GameContent.UI.Elements.UICharacterListItem.orig_DrawSelf orig, UICharacterListItem self, SpriteBatch spriteBatch)
        {
            orig(self, spriteBatch);

            if (!SGAConfigClient.Instance.PlayerWorldData)
            {
                return;
            }

            Vector2 origin = new Vector2(self.GetDimensions().X, self.GetDimensions().Y);

            //hooray double reflection, f**k you vanilla-Scalie
            //I couldn't agree more-IDG
            UICharacter character = (UICharacter)_playerPanel.GetValue(self);

            Player    player         = (Player)_player.GetValue(character);
            SGAPlayer sgaPly         = player.SGAPly();
            bool      drakenUnlocked = sgaPly.dragonFriend;

            if (sgaPly == null)
            {
                return;
            }
            if (sgaPly.nightmareplayer)
            {
                Color     color1 = new Color(204, 130, 204);
                Texture2D tex    = Main.inventoryBack10Texture;
                Color     acolor = Color.Lerp(color1, Color.White, 0.5f);
                Color     color3 = Color.Lerp(color1, Color.Lerp(color1, Color.DarkMagenta, 0.33f), 0.50f + (float)Math.Sin(Main.GlobalTime * 2f) / 2f);
                spriteBatch.Draw(tex, origin + new Vector2(440, 0), new Rectangle(0, 0, 16, 27), acolor, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
                int i;
                for (i = 16; i < 128 + 16; i += 16)
                {
                    spriteBatch.Draw(tex, origin + new Vector2(440 + i, 0), new Rectangle(16, 0, 16, 27), acolor, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
                }
                spriteBatch.Draw(tex, origin + new Vector2(440 + i, 0), new Rectangle(32, 0, 16, 27), acolor, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
                Utils.DrawBorderString(spriteBatch, "NIGHTMARE", origin + new Vector2(454, 5), color3);

                //Hmmm color hearts
                spriteBatch.Draw(SGAmod.Instance.GetTexture("GreyHeart"), origin + new Vector2(80, 37), color3 * (0.50f + (float)Math.Cos(Main.GlobalTime * 2f) / 2f));
            }

            if (drakenUnlocked)
            {
                Texture2D       DergonHeadTex = ModContent.GetTexture("SGAmod/NPCs/TownNPCs/Dergon_Head");
                CalculatedStyle style         = self.GetDimensions();
                Vector2         offset        = style.Position() + new Vector2(style.Width, style.Height);
                float           heartBeat     = (Main.GlobalTime) % 1f;
                if (Main.GlobalTime % 2 >= 1)
                {
                    heartBeat = 1f - ((Main.GlobalTime) % 1f);
                }

                Vector2 drawerPos = offset - new Vector2(self.IsFavorite ? 16 : 48, 16);

                spriteBatch.Draw(Main.heartTexture, drawerPos, null, Color.White, 0, Main.heartTexture.Size() / 2f, 1.5f + MathHelper.SmoothStep(-1f, 1f, (heartBeat) / 2f), SpriteEffects.None, 0f);
                spriteBatch.Draw(DergonHeadTex, drawerPos, null, Color.White, 0, DergonHeadTex.Size() / 2f, 1f, SpriteEffects.None, 0f);
            }
        }
Beispiel #5
0
        public override void ModifyTooltips(Item item, List <TooltipLine> tooltips)
        {
            if (item.modItem != null)
            {
                if (item.owner > -1 && Main.netMode != 1)
                {
                    SGAPlayer sgaply = (Main.player[item.owner].GetModPlayer <SGAPlayer>());
                    pboostertextboost = "\nCurrent boost: " + sgaply.SpaceDiverWings;
                    pboostertext      = pboostertextbase2 + pboostertextboost;
                }
                var    myType    = (item.modItem).GetType();
                var    n         = myType.Namespace;
                string asastring = (string)n;
                //int ishavocitem = (asastring.Split('.').Length - 1);
                int ishavocitem = asastring.Length - asastring.Replace("HavocGear.", "").Length;
                if (ishavocitem > 0)
                {
                    Color c = Main.hslToRgb(0.9f, 0.5f, 0.35f);
                    tooltips.Add(new TooltipLine(mod, "Havoc Item", Idglib.ColorText(c, "Former Havoc mod item")));
                }
                if (SGAmod.UsesPlasma.ContainsKey(item.type))
                {
                    Color c = Main.hslToRgb(0.7f, 0.15f, 0.7f);
                    tooltips.Add(new TooltipLine(mod, "Plasma Item", Idglib.ColorText(c, "This weapon uses plasma cells for recharging")));
                }

                if (SGAmod.UsesClips.ContainsKey(item.type))
                {
                    Color c = Main.hslToRgb(0.7f, 0.15f, 0.7f);
                    tooltips.Add(new TooltipLine(mod, "Clip Item", Idglib.ColorText(c, "This weapon has a clip and requires manual reloading")));
                }
            }

            if (SGAWorld.downedWraiths < 1)
            {
                RecipeFinder finder = new RecipeFinder();
                finder.AddTile(TileID.Furnaces);
                List <Recipe> reclist = finder.SearchRecipes();

                Recipe foundone = reclist.Find(rec => rec.createItem.type == item.type);

                if (foundone != null)
                {
                    Color c = Main.hslToRgb(0.5f, 0.10f, 0.1f);
                    tooltips.Add(new TooltipLine(mod, "Wraithclue", Idglib.ColorText(c, "Crafting this will anger something...")));
                }
            }
            if (item.type == ItemID.LunarBar)
            {
                if (SGAWorld.downedWraiths < 4)
                {
                    Color c = Main.hslToRgb(0.5f, 0.20f, 0.7f);
                    tooltips.Add(new TooltipLine(mod, "Wraithclue", Idglib.ColorText(c, "A very strong being has locked it away from your possession, talk to the guide")));
                }
            }
        }
Beispiel #6
0
        public override bool TryPurchasing(int price, List <Item[]> inv, List <Point> slotCoins, List <Point> slotsEmpty, List <Point> slotEmptyBank, List <Point> slotEmptyBank2, List <Point> slotEmptyBank3)
        {
            SGAPlayer modplayer = Main.LocalPlayer.GetModPlayer <SGAPlayer>();

            if (modplayer.ExpertiseCollected >= price * 10)
            {
                modplayer.ExpertiseCollected -= price * 10;
                return(true);
            }
            return(false);
        }
        private static double Player_Hurt(On.Terraria.Player.orig_Hurt orig, Player self, PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp, bool quiet, bool Crit, int cooldownCounter)
        {
            SGAPlayer sply = self.SGAPly();

            if (sply.refractor)
            {
                if (!self.immune)
                {
                    /*
                     *      bool flag = false;
                     * if (cooldownCounter == 0)
                     * {
                     *      flag = self.hurtCooldowns[cooldownCounter] <= 0;
                     * }
                     * if (cooldownCounter == 1)
                     * {
                     *      flag = self.hurtCooldowns[cooldownCounter] <= 0;
                     * }
                     * if (cooldownCounter == 2)
                     * {
                     *      flag = true;
                     *      cooldownCounter = -1;
                     * }
                     */


                    //if (flag)
                    //{
                    SGAPlayer.DoHurt(sply, damageSource, ref Damage, ref hitDirection, pvp, quiet, ref Crit, cooldownCounter);
                    //}
                }
                if (sply.undyingValor)
                {
                    goto valor;
                }
                return(orig(self, damageSource, Damage, hitDirection, pvp, quiet, Crit, cooldownCounter));
            }

valor:
            if (sply.undyingValor && sply.GetEnergyShieldAmmountAndRecharge.Item1 < 1)
            {
                double ddd = orig(self, damageSource, 1, hitDirection, pvp, quiet, Crit, cooldownCounter);
                if (ddd > 0)
                {
                    self.SGAPly().DoTStack.Add((300, (Damage / 300f) * 60f));
                    return(orig(self, damageSource, 1, hitDirection, pvp, quiet, Crit, cooldownCounter));
                }
            }



            return(orig(self, damageSource, Damage, hitDirection, pvp, quiet, Crit, cooldownCounter));
        }
Beispiel #8
0
        private static void DetourBadLifeRegen(orig_BadLifeRegenDetour orig, Player player)
        {
            orig(player);

            if (player.lifeRegen < 0)
            {
                SGAPlayer sgaply = player.SGAPly();
                if (sgaply.DoTResist != 1f)
                {
                    player.lifeRegen = (int)(player.lifeRegen * sgaply.DoTResist);
                }
            }
        }
        public static void DrawilluminantLayer(PlayerDrawInfo drawInfo, bool front)
        {
            Player    drawPlayer = drawInfo.drawPlayer;
            SGAmod    mod        = SGAmod.Instance;
            SGAPlayer modply     = drawPlayer.GetModPlayer <SGAPlayer>();


            int activestacks = modply.activestacks;

            if (activestacks > 0)
            {
                List <Vector4> whichone = new List <Vector4>();
                UnifiedRandom  rando    = new UnifiedRandom(drawPlayer.whoAmI);

                for (int i = 0; i < activestacks; i += 1)
                {
                    float   percent = rando.NextFloat(1f) * MathHelper.TwoPi;
                    Matrix  mxatrix = Matrix.CreateRotationY((Main.GlobalTime * 2f) + percent) * Matrix.CreateRotationZ(((i / (float)activestacks) * MathHelper.TwoPi) + (Main.GlobalTime * (rando.NextFloat(0.4f, 0.6f))));
                    Vector3 vec3    = Vector3.Transform(Vector3.UnitX, mxatrix);
                    float   alpha   = 1f;
                    if (modply.CooldownStacks.Count >= i)
                    {
                        alpha = MathHelper.Clamp((modply.CooldownStacks[i].timeleft / (float)modply.CooldownStacks[i].maxtime) * 3f, 0f, 1f);
                    }

                    whichone.Add(new Vector4(vec3, alpha));
                }
                whichone = whichone.OrderBy((x) => x.Z).ToList();

                if (whichone.Count > 0)
                {
                    for (int a = 0; a < whichone.Count; a += 1)
                    {
                        Vector4 theplace = whichone[a];
                        float   scaler   = 1 + theplace.Z;

                        if ((scaler >= 1f && front) || (scaler < 1f && !front))
                        {
                            Texture2D texture = SGAmod.Instance.GetTexture("Extra_57b");

                            Vector2  drawhere = new Vector2(theplace.X, theplace.Y) * 64f;
                            DrawData data     = new DrawData(texture, drawPlayer.MountedCenter + drawhere - Main.screenPosition, null, Color.Magenta * (theplace.W * 0.75f), (float)Math.Sin(theplace.X), texture.Size() / 2f, 0.5f + (scaler - 1f) * 0.25f, (drawPlayer.gravDir > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically), 0);
                            //data.shader = (int)drawPlayer.dye[2].dye;
                            Main.playerDrawData.Add(data);
                        }
                    }
                }
            }
        }
        public void OnCrit(NPC npc, Projectile projectile, Player player, Item item, ref int damage, ref float knockback, ref bool crit)
        {
            SGAPlayer moddedplayer = player.GetModPlayer <SGAPlayer>();

            if (crit)
            {
                if (moddedplayer.ninjaStashLimit < 600)
                {
                    if (moddedplayer.ninjaSash > 0 && ((item != null && (item.Throwing().thrown || item.thrown)) || (projectile != null && (projectile.Throwing().thrown || projectile.thrown))))
                    {
                        NinjaStashSummonProjectile(npc, player, ref damage, ref knockback, ref crit);
                    }
                }
            }
        }
        private static int Main_DrawBuffIcon(On.Terraria.Main.orig_DrawBuffIcon orig, int drawBuffText, int i, int b, int x, int y)
        {
            SGAPlayer sgaply = Main.LocalPlayer.SGAPly();

            if (SGAConfig.Instance.PotionFatigue || SGAmod.DRMMode)
            {
                int fatigue = sgaply.potionFatigue;
                if (fatigue < 1)
                {
                    orig(drawBuffText, i, b, x, y);
                }

                if (SGAmod.BuffsThatHavePotions.Where(testby => testby == b).Count() > 0 && !Main.buffNoTimeDisplay[b])
                {
                    Texture2D extra       = Main.extraTexture[80];
                    Texture2D buffTex     = Main.buffTexture[b];
                    float     alpha       = MathHelper.Clamp(fatigue / 10000f, 0f, 1f);
                    int       frameHeight = extra.Height / 4;

                    List <(Vector2, float, int)> effects = new List <(Vector2, float, int)>();

                    UnifiedRandom rando = new UnifiedRandom(b);

                    for (int zz = 0; zz < 30; zz += 1)
                    {
                        int     frame    = (int)((Main.GlobalTime * 8f) + rando.Next(4) + i * 2f) % 4;
                        float   progress = (rando.NextFloat(0, 100) + Main.GlobalTime * 25) % 100;
                        Vector2 offset   = new Vector2(rando.Next(-16, 16), rando.Next(8, 16));
                        effects.Add((offset, progress, frame));
                    }

                    effects = effects.OrderBy(testby => 10000 - testby.Item2).ToList();

                    foreach ((Vector2, float, int)place in effects)
                    {
                        float   percent2 = place.Item2 / 100f;
                        Vector2 position = new Vector2(0, MathHelper.SmoothStep(0f, -32f, percent2 * percent2)) + place.Item1 + new Vector2(x, y) + buffTex.Size() / 2f;

                        float alpha2 = MathHelper.Clamp((float)Math.Sin((place.Item2 / 100f) * MathHelper.Pi) * 2f, 0f, 1f);

                        Rectangle erect = new Rectangle(0, place.Item3 * frameHeight, extra.Width, frameHeight);

                        Main.spriteBatch.Draw(extra, position, erect, Color.White * alpha * alpha2, 0, erect.Size() / 2f, alpha2, SpriteEffects.None, 0f);
                    }
                }
            }
            return(orig(drawBuffText, i, b, x, y));
        }
Beispiel #12
0
        public override void UpdateArmorSet(Player player, string set)
        {
            SGAPlayer sgaplayer = player.GetModPlayer(mod, typeof(SGAPlayer).Name) as SGAPlayer;

            if (set == "Dank")
            {
                player.setBonus   = "10% of the sum of all damage types is added to your current weapon's attack\nyou regen life faster while on the surface during the day";
                sgaplayer.Dankset = 3;
            }
            if (set == "Novus")
            {
                player.setBonus    = "Novus items emit more light when used and deal 20% more damage";
                sgaplayer.Novusset = 3;
            }
            if (set == "Blazewyrm")
            {
                player.setBonus = "True melee crits create a very powerful explosion equal to triple the damage dealt\nThis however gives you the action cooldown debuff for 10 seconds blocking reactivation\n25% increased melee damage against enemies inflicted with Thermal Blaze" +
                                  "\nImmune to fireblocks as well as immunity to On Fire! and Thermal Blaze";
                player.fireWalk = true;
                player.buffImmune[BuffID.OnFire] = true;
                player.buffImmune[mod.BuffType("ThermalBlaze")] = true;
                sgaplayer.Blazewyrmset = true;
            }
            if (set == "SpaceDiver")
            {
                string text1 = Idglib.ColorText(Color.Red, "90% reduced breath meter regen");
                string text2 = Idglib.ColorText(Color.Red, "You've adapted to pressurized air, removing the armor set will greatly harm you");
                player.setBonus            = "Receive Endurance and Defense based on breath left (40% Endurance and 100 Defense at full breath)\nTaking damage will drain your breath meter based on the faction of life lost\nReceive no damage when damaged with a full breath meter\nTechnological damage increased by 25%\n" + SGAGlobalItem.pboostertext + text1 + " \n" + text2;
                sgaplayer.SpaceDiverset    = true;
                sgaplayer.SpaceDiverWings += 0.5f;
                sgaplayer.techdamage      += 0.25f;
            }
            if (set == "MisterCreeper")
            {
                player.setBonus = "Any sword that doesn't shoot a projectile is swung 50% faster and deals crits when you are falling downwards\nWhen you take damage, you launch a damaging high velocity grenade at what hit you\nThese grenades are launched even during immunity frames if your touching an enemy\nDrinking a healing potion launches a ton of bouncy grendes in all directions" +
                                  "\nTaking lethal damage will cause you to light your fuse, killing you IF you fail to kill anyone with your ending explosion in a few seconds!\nThis gives you Action cooldown for 60 seconds, which prevents reactivation\nCreeper's explosive throw and Stormbreaker are empowered\n------";
                sgaplayer.MisterCreeperset  = true;
                sgaplayer.devempowerment[1] = 3;
            }
            if (set == "IDG")
            {
                player.setBonus = "Minions cause less immunity frames, the enemy targeted by a minion weapon is Digi-Cursed\nDigi-Curse causes enemies to take 10% increased damage from all sources\n" +
                                  "Minion Damage builds up Digi-Stacks, which increase ranged damage\nMax Stacks boosts ranged damage by 100%\nFurthermore, copies of your current bullet type are fired from your Stacks\nThese copies do 50% of the base projectile's damage\nPlus the copy consumes a percentage of Stacks based on the damage\nAny projectiles below 100 damage will not produce a copy\nSerpent's Redemption is empowered\n------";
                sgaplayer.IDGset            = true;
                sgaplayer.digiStacksMax    += 100000;
                sgaplayer.devempowerment[0] = 3;
            }
        }
Beispiel #13
0
        public override void GetPriceText(string[] lines, ref int currentLine, int price)
        {
            Color     color     = SGACustomCurrencyTextColor * ((float)Main.mouseTextColor / 255f);
            SGAPlayer modplayer = Main.LocalPlayer.GetModPlayer <SGAPlayer>();
            string    text      = " (Current: " + modplayer.ExpertiseCollected + "/Total: " + modplayer.ExpertiseCollectedTotal + ")";

            lines[currentLine++] = string.Format("[c/{0:X2}{1:X2}{2:X2}:{3} {4} {5}]", new object[]
            {
                color.R,
                color.G,
                color.B,
                Language.GetTextValue("LegacyTooltip.50"),
                price * 10,
                "Expertise" + text
            });
        }
        public static void drawdigistuff(PlayerDrawInfo drawInfo, bool front)
        {
            Player    drawPlayer = drawInfo.drawPlayer;
            SGAmod    mod        = SGAmod.Instance;
            SGAPlayer modply     = drawPlayer.GetModPlayer <SGAPlayer>();


            int bonusattacks = (int)(((float)modply.digiStacks / (float)modply.digiStacksMax) * (float)modply.digiStacksCount);

            if (bonusattacks > 0)
            {
                List <Vector2> whichone = new List <Vector2>();
                for (int i = 0; i < bonusattacks; i += 1)
                {
                    float angle  = MathHelper.ToRadians(modply.timer + ((((float)i - 1) / (float)bonusattacks) * 360f));
                    float scaler = 1f + ((float)Math.Sin(angle) * 0.25f);
                    whichone.Add(new Vector2(scaler, angle));
                    //Vector2 apos = new Vector2((float)Math.Cos(angle) * 64, (float)Math.Sin(angle) * 24);
                }
                whichone = whichone.OrderBy((x) => x.X).ToList();

                if (whichone.Count > 0)
                {
                    for (int a = 0; a < whichone.Count; a += 1)
                    {
                        Vector2 theplace = whichone[a];
                        float   scaler   = theplace.X;

                        if ((scaler >= 1f && front) || (scaler < 1f && !front))
                        {
                            float angle = theplace.Y;

                            Vector2 apos = new Vector2((float)Math.Cos(angle) * 64, (float)Math.Sin(angle) * 12);

                            Texture2D texture = Main.itemTexture[ItemID.ManaCrystal];

                            int      drawX = (int)((drawPlayer.Center.X + apos.X) - Main.screenPosition.X);
                            int      drawY = (int)((drawPlayer.MountedCenter.Y + apos.Y) - Main.screenPosition.Y);                       //gravDir
                            DrawData data  = new DrawData(texture, new Vector2(drawX, drawY), null, Color.White, (float)0, new Vector2(texture.Width / 2, texture.Height / 2), scaler, (drawPlayer.gravDir > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically), 0);
                            //data.shader = (int)drawPlayer.dye[2].dye;
                            Main.playerDrawData.Add(data);
                        }
                    }
                }
            }
        }
        static private void Player_AddBuff(On.Terraria.Player.orig_AddBuff orig, Player self, int buff, int time, bool quiet)
        {
            // 'orig' is a delegate that lets you call back into the original method.
            // 'self' is the 'this' parameter that would have been passed to the original method.

            SGAPlayer sgaply = self.SGAPly();

            if (sgaply.phaethonEye > 6 && Main.debuff[buff] && time > 60 && !SGAUtils.BlackListedBuffs(buff))
            {
                if (Main.rand.Next(3) == 0 && sgaply.AddCooldownStack(time))
                {
                    Projectile.NewProjectile(self.Center, Vector2.Zero, ModContent.ProjectileType <Items.Accessories.PhaethonEyeProcEffect>(), 0, 0, self.whoAmI);
                    return;
                }
            }
            orig(self, buff, time, quiet);
        }
Beispiel #16
0
        public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            SGAPlayer sgaplayer = player.GetModPlayer <SGAPlayer>();

            if ((item.useAmmo == AmmoID.Gel) && player.GetModPlayer <SGAPlayer>().FridgeflameCanister)
            {
                int probg = Projectile.NewProjectile(position.X + (int)(speedX * 2f), position.Y + (int)(speedY * 2f), speedX, speedY, mod.ProjectileType("IceFlames"), damage / 2, knockBack, player.whoAmI);
                Main.projectile[probg].ranged   = item.ranged;
                Main.projectile[probg].magic    = item.magic;
                Main.projectile[probg].friendly = true;
                Main.projectile[probg].hostile  = false;
                Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedByRandom(MathHelper.ToRadians(15));
                Main.projectile[probg].velocity.X = perturbedSpeed.X * 0.6f;
                Main.projectile[probg].velocity.Y = perturbedSpeed.Y * 0.6f;
                Main.projectile[probg].owner      = player.whoAmI;
                SGAprojectile modeproj = Main.projectile[probg].GetGlobalProjectile <SGAprojectile>();
                modeproj.myplayer = player;
                IdgProjectile.Sync(probg);
            }
            return(true);
        }
        static private void Player_CheckDrowning(On.Terraria.Player.orig_CheckDrowning orig, Player self)
        {
            // 'orig' is a delegate that lets you call back into the original method.
            // 'self' is the 'this' parameter that would have been passed to the original method.
            SGAPlayer sgaply = self.SGAPly();

            if (sgaply.beserk[1] > 0)
            {
                sgaply.permaDrown = true;
                if (sgaply.timer % 2 == 0)
                {
                    self.breathCD += (int)(sgaply.beserk[1] * 1.25f) - 1;
                }
                //if (self.breathCD > 300)
                //{
                //self.breathCD = 0;
                //self.breath = (int)MathHelper.Clamp(self.breath - 1, 0, self.breathMax);

                if (self.breath < 1 && sgaply.timer % 5 == 0)
                {
                    int lifeLost = Math.Max(2 + (int)sgaply.beserk[1] + sgaply.drownRate, 1);
                    self.statLife -= lifeLost;
                    CombatText.NewText(new Rectangle((int)self.position.X, (int)self.position.Y, self.width, self.height), CombatText.LifeRegen, lifeLost, false, true);

                    if (self.statLife <= 0)
                    {
                        self.statLife = 0;
                        self.KillMe(PlayerDeathReason.ByOther(1), 10.0, 0, false);
                    }
                }
                //}

                if (self.breath < 1)
                {
                    self.lifeRegenTime = 0;
                    self.breath        = 0;
                }
            }
            orig(self);
        }
Beispiel #18
0
        public override float UseTimeMultiplier(Item item, Player player)
        {
            if (item.damage < 1)
            {
                return(1f);
            }
            float     usetimetemp = 1f;
            SGAPlayer sgaplayer   = player.GetModPlayer(mod, typeof(SGAPlayer).Name) as SGAPlayer;

            if (item.pick + item.hammer + item.axe > 0)
            {
                usetimetemp *= sgaplayer.UseTimeMulPickaxe;
            }
            if (item.summon)
            {
                usetimetemp *= (1f + sgaplayer.summonweaponspeed);
            }
            if (item.thrown && item.type != ItemID.Beenade)
            {
                usetimetemp *= sgaplayer.ThrowingSpeed;
            }

            /*ModItem mitem = item.modItem;
             * bool hasshoot = false;
             * if (mitem != null)
             * {
             *  hasshoot = mitem.GetType().GetMethod("Shoot").GetMethodBody().ToString().Length > 5;
             *  Main.NewText(mitem.GetType().GetMethod("Shoot").GetMethodBody().);
             * }*/
            if (sgaplayer.MisterCreeperset)
            {
                if (item.shoot < 1 && item.melee && item.pick + item.axe + item.hammer < 1)
                {
                    usetimetemp *= 1.5f;
                }
            }

            return(usetimetemp * sgaplayer.UseTimeMul);
        }
		public override bool PreKill(Projectile projectile, int timeLeft)
		{

			Player owner = Main.player[projectile.owner];
			if (owner != null)
			{
				SGAPlayer sgaply = owner.SGAPly();
				if (sgaply != null && sgaply.SybariteGem)
				{
					if (Main.rand.Next(0, 20) == 0)
					{
						int itemid;
						if (SGAmod.CoinsAndProjectiles.TryGetValue(projectile.type, out itemid))
						{
							Item.NewItem(projectile.Center, Vector2.Zero, itemid);
						}
					}
				}

			}

			return true;
		}
        public void NinjaStashSummonProjectile(NPC npc, Player player, ref int damage, ref float knockback, ref bool crit)
        {
            SGAPlayer moddedplayer = player.GetModPlayer <SGAPlayer>();

            int ammo = -1;

            moddedplayer.LookForThrowingGear(ref ammo);

            //if (player.HasItem(ModContent.ItemType<ThrowingStars>()))
            //	ammo = ModContent.ItemType<ThrowingStars>();


            if (ammo > 0)
            {
                Item itemy = new Item();
                itemy.SetDefaults(ammo);
                int shootype = itemy.shoot;

                Vector2 anglez = new Vector2(Main.rand.Next(-8000, 8000), Main.rand.Next(-8000, -2000));
                anglez.Normalize();

                float i = Main.rand.NextFloat(90f, 260f);

                int thisoned = Projectile.NewProjectile(npc.Center + (anglez * i), anglez * -16f, shootype, damage, 0f, Main.myPlayer);
                Main.projectile[thisoned].ranged = false;
                Main.projectile[thisoned].thrown = false;


                for (float gg = 2f; gg > 0.25f; gg -= 0.6f)
                {
                    int goreIndex = Gore.NewGore(npc.Center + (anglez * i), -anglez * gg, Main.rand.Next(61, 64), 1f);
                    Main.gore[goreIndex].scale = 1.5f;
                }
                moddedplayer.ninjaStashLimit += (int)(60 / player.Throwing().thrownDamage);
                player.ConsumeItem(ammo);
            }
        }
        private static void Player_UpdateLifeRegen(On.Terraria.Player.orig_UpdateLifeRegen orig, Player self)
        {
            SGAPlayer sgaply = self.SGAPly();

            if (sgaply.jungleTemplarSet.Item2)
            {
                if (sgaply.ConsumeElectricCharge(3, 300, true))
                {
                    Vector2 playervel = self.velocity;

                    self.velocity = Vector2.Zero;
                    orig(self);
                    self.velocity = playervel;
                    return;
                }
            }

            if (((sgaply.nightmareplayer || SGAmod.DRMMode) && IdgNPC.bossAlive) || sgaply.noLifeRegen)
            {
                return;
            }

            orig(self);
        }
Beispiel #22
0
        private void BlockModdedAccessoriesPatch(ILContext context)
        {
            ILCursor c     = new ILCursor(context);
            ILLabel  label = c.DefineLabel();

            //effectively, looks like this:
            //
            //if (PlayerIsInSandstormMethod(player))
            //return;
            //
            //rest of original code below
            c.Emit(OpCodes.Ldarg_0);
            c.EmitDelegate <PlayerIsInSandstormDelegate>(BlockModdedAccessoriesMethod);
            c.Emit(OpCodes.Brfalse_S, label);
            c.Emit(OpCodes.Ret);
            c.MarkLabel(label);

            c.Index = c.Instrs.Count - 1;
            c.Emit(OpCodes.Ldarg_0);
            c.EmitDelegate <Action <Player> >((Player player) =>
            {
                SGAPlayer.PostPostUpdateEquips(player);
            });
        }
        private void OnHit(NPC npc, Player player, int damage, float knockback, bool crit, Item item, Projectile projectile, bool isproj = false)
        {
            SGAPlayer moddedplayer = player.GetModPlayer <SGAPlayer>();

            if (moddedplayer.HasGucciGauntlet())
            {
                if (player.ownedLargeGems[0] && Main.rand.Next(0, 10) == 0)
                {
                    npc.AddBuff(BuffID.ShadowFlame, 60 * 15);
                }
            }

            if (moddedplayer.flaskBuff != default && ((projectile != null && projectile.melee) || (item != null && item.melee)))
            {
                if (Main.rand.Next(0, moddedplayer.flaskBuff.Chance) == 0)
                {
                    npc.AddBuff(moddedplayer.flaskBuff.Debuff, moddedplayer.flaskBuff.Period);
                    moddedplayer.flaskBuff.OnRealHit(player, projectile, npc, damage);
                }
            }

            if (item != null && npc.life - damage < 1 && npc.lifeMax > 50)
            {
                if (item.type == mod.ItemType("Powerjack"))
                {
                    player.HealEffect(25, false);
                    player.netLife   = true;
                    player.statLife += 25;
                    if (player.statLife > player.statLifeMax2)
                    {
                        player.statLife = player.statLifeMax2;
                    }
                    NetMessage.SendData(66, -1, -1, null, player.whoAmI, (float)25f, 0f, 0f, 0, 0, 0);
                }
            }

            if (isproj)
            {
                if (projectile.minion && moddedplayer.IDGset)
                {
                    if (npc.immune[projectile.owner] > 0)
                    {
                        npc.immune[projectile.owner] = ((int)(npc.immune[projectile.owner] * 0.75f));
                    }

                    moddedplayer.digiStacks = Math.Min(moddedplayer.digiStacksMax, moddedplayer.digiStacks + (int)Math.Max((float)projectile.damage, (float)damage));
                }

                if (projectile.type == ProjectileID.CultistBossLightningOrbArc)
                {
                    immunitetolightning = projectile.localNPCHitCooldown;
                }

                bool trapdamage = false;
                if (projectile != null && projectile.trap)
                {
                    trapdamage = true;
                }


                if (trapdamage)
                {
                    if (moddedplayer.JaggedWoodenSpike)
                    {
                        if (Main.rand.Next(0, 100) < 15)
                        {
                            npc.AddBuff(mod.BuffType("MassiveBleeding"), 60 * 5);
                        }
                    }
                }

                if (moddedplayer.Mangroveset && player.ownedProjectileCounts[mod.ProjectileType("MangroveOrb")] < 4)
                {
                    if (crit && projectile.thrown)
                    {
                        player.AddBuff(BuffID.DryadsWard, 60 * 5);

                        int newDamage = damage;
                        if (newDamage > 50)
                        {
                            newDamage = 50 + (int)Math.Pow((damage - 50), 0.75f);
                        }

                        List <Projectile> itz = Idglib.Shattershots(player.Center, player.Center + (player.Center - npc.Center), new Vector2(0, 0), mod.ProjectileType("MangroveOrb"), newDamage, 8f, 120, 2, false, 0, false, 400);
                        //itz[0].damage = 30;
                        itz[0].owner = player.whoAmI; itz[0].friendly = true; itz[0].hostile = false;
                        itz[1].owner = player.whoAmI; itz[1].friendly = true; itz[1].hostile = false;
                        Main.projectile[itz[0].whoAmI].netUpdate = true;
                        Main.projectile[itz[1].whoAmI].netUpdate = true;

                        IdgProjectile.AddOnHitBuff(itz[0].whoAmI, BuffID.DryadsWardDebuff, 60 * 5);
                        IdgProjectile.AddOnHitBuff(itz[1].whoAmI, BuffID.DryadsWardDebuff, 60 * 5);

                        if (Main.netMode == 2 && itz[0].whoAmI < 200)
                        {
                            NetMessage.SendData(27, -1, -1, null, itz[0].whoAmI, 0f, 0f, 0f, 0, 0, 0);
                        }
                    }
                }
            }

            SGAWorld.overalldamagedone = ((int)damage) + SGAWorld.overalldamagedone;

            if (item != null)
            {
                if (moddedplayer.FieryheartBuff > 0)
                {
                    if (!npc.buffImmune[BuffID.Daybreak] || moddedplayer.FieryheartBuff > 15)
                    {
                        IdgNPC.AddBuffBypass(npc.whoAmI, 189, 1 * (20 + (int)(player.SGAPly().ExpertiseCollectedTotal / 250f)));
                    }
                }
            }

            if (projectile != null)
            {
                if (moddedplayer.FieryheartBuff > 0 && projectile.owner == player.whoAmI && projectile.friendly)
                {
                    if (!npc.buffImmune[BuffID.Daybreak] || moddedplayer.FieryheartBuff > 15)
                    {
                        IdgNPC.AddBuffBypass(npc.whoAmI, 189, 1 * (20 + (int)(player.SGAPly().ExpertiseCollectedTotal / 250f)));
                    }
                }
                if ((moddedplayer.CirnoWings) && projectile.owner == player.whoAmI)
                {
                    if (isproj && (projectile.magic == true && Main.rand.Next(0, 20) == 0) || projectile.coldDamage)
                    {
                        npc.AddBuff(BuffID.Frostburn, 4 * 60);
                    }
                }
                if ((moddedplayer.glacialStone) && projectile.owner == player.whoAmI && projectile.melee)
                {
                    if (isproj && projectile.melee == true)
                    {
                        npc.AddBuff(BuffID.Frostburn, Main.rand.Next(1, 6) * 60);
                    }
                }
            }

            if (moddedplayer.Redmanastar > 0)
            {
                if (isproj && projectile.magic == true)
                {
                    int[] buffids = { BuffID.OnFire, mod.BuffType("ThermalBlaze"), BuffID.Daybreak };
                    if (projectile != null && Main.rand.Next(0, 100) < 5)
                    {
                        npc.AddBuff(buffids[moddedplayer.Redmanastar - 1], 4 * 60);
                    }
                    if (projectile != null && Main.rand.Next(0, 100) < 1)
                    {
                        npc.buffImmune[buffids[moddedplayer.Redmanastar - 1]] = false;
                    }
                }
            }

            if (moddedplayer.SerratedTooth == true)
            {
                if (damage > npc.defense * 5)
                {
                    npc.AddBuff(mod.BuffType("MassiveBleeding"), Math.Min((int)(1f + ((float)damage - (float)npc.defense * 5f) * 0.02f) * 60, 60 * 5));
                }
            }

            if (moddedplayer.Blazewyrmset)
            {
                if (crit && ((item != null && item.melee && item.pick + item.axe + item.hammer < 1)) || (projectile != null && projectile.melee && (player.heldProj == projectile.whoAmI || (projectile.modProjectile != null && (projectile.modProjectile is IShieldBashProjectile || projectile.modProjectile is ITrueMeleeProjectile)))))
                {
                    if (player.SGAPly().AddCooldownStack(12 * 60))
                    {
                        Main.PlaySound(SoundID.Item45, npc.Center);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BoulderBlast"), damage * 3, knockback * 3f, player.whoAmI, 0f, 0f);
                    }
                }
            }

            if (moddedplayer.alkalescentHeart)
            {
                int[] maxcrit = { player.meleeCrit, player.rangedCrit, player.magicCrit, player.Throwing().thrownCrit };
                Array.Sort(maxcrit);
                Array.Reverse(maxcrit);
                if (crit || (projectile != null && projectile.minion && Main.rand.Next(0, 100) < maxcrit[0]))
                {
                    Point point = new Point(0, 0);
                    point.X = (!npc.HasBuff(BuffID.Poisoned) ? BuffID.Poisoned : (!npc.HasBuff(BuffID.Venom) ? BuffID.Venom : (!npc.HasBuff(ModContent.BuffType <AcidBurn>()) ? ModContent.BuffType <AcidBurn>() : -1)));
                    if (point.X > -1)
                    {
                        point.Y = (point.X == ModContent.BuffType <AcidBurn>() ? 45 : point.X == BuffID.Venom ? 200 : point.X == BuffID.Poisoned ? 300 : 0);
                        npc.AddBuff(point.X, point.Y);
                        //if (Main.rand.Next(0, 10) == 0)
                        //	player.AddBuff(point.X, point.Y/2);
                    }
                }
            }

            bool hasabuff = false;

            if (npc.HasBuff(BuffID.OnFire))
            {
                hasabuff = true;
            }
            for (int i = 0; i < SGAmod.otherimmunes.Length; i++)
            {
                if (npc.HasBuff(SGAmod.otherimmunes[i]))
                {
                    hasabuff = true;
                }
            }


            if (DosedInGas && hasabuff)
            {
                Combusted = 60 * 6;
                int buff = npc.FindBuffIndex(mod.BuffType("DosedInGas"));

                if ((isproj && Main.player[projectile.owner].GetModPlayer <SGAPlayer>().MVMBoost) || (item != null && player.GetModPlayer <SGAPlayer>().MVMBoost))
                {
                    int prog = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, Vector2.Zero.X, Vector2.Zero.Y, ProjectileID.GrenadeIII, 350, 5f, player.whoAmI);
                    Main.projectile[prog].thrown = false; Main.projectile[prog].ranged = false; Main.projectile[prog].timeLeft = 2; Main.projectile[prog].netUpdate = true;
                    IdgProjectile.Sync(prog);
                }


                if (buff > -1)
                {
                    npc.DelBuff(buff);
                    IdgNPC.AddBuffBypass(npc.whoAmI, BuffID.OnFire, 60 * 10);
                }
            }

            if (player != null && player.SGAPly().toxicity > 0 && npc.HasBuff(BuffID.Stinky))
            {
                if (Main.rand.Next(0, 50) == 0)
                {
                    SGAPlayer.SwearExplosion(npc.Center, player, (int)(damage * 0.5f));
                }
            }

            /*if (PinkyMinion>0)
             * {
             *      if ((npc.life-damage)<1 && ((projectile.penetrate<5 && projectile.penetrate >= 0) || projectile == null))
             *      {
             *              NPC[] findnpc = SGAUtils.ClosestEnemies(npc.Center, 1500, checkWalls: false, checkCanChase: false)?.ToArray();
             *              findnpc = findnpc != null ? findnpc.Where(testby => testby.type == ModContent.NPCType<NPCs.SPinkyTrue>()).ToArray() : null;
             *
             *              if (findnpc != null && findnpc.Count()>0 && findnpc[0].type == ModContent.NPCType<NPCs.SPinkyTrue>())
             *              Projectile.NewProjectile(npc.Center, Vector2.Normalize(findnpc[0].Center - npc.Center) * 10f, ModContent.ProjectileType<NPCs.PinkyMinionKilledProj>(), 500, 0);
             *      }
             * }*/
        }
Beispiel #24
0
        private bool PlayerIsInSandstormMethod(Player ply)
        {
            SGAPlayer sgaply = ply.SGAPly();

            return(sgaply.desertSet && sgaply.sandStormTimer > 0);
        }
        public static bool DrawHUD()
        {
            if (Main.gameMenu || SGAmod.Instance == null && !Main.dedServ)
            {
                return(true);
            }
            Player locply = Main.LocalPlayer;

            if (locply != null && locply.whoAmI == Main.myPlayer)
            {
                SpriteBatch spriteBatch = Main.spriteBatch;

                if (locply.HeldItem.type == SGAmod.Instance.ItemType("CaliburnCompess"))
                {
                    spriteBatch.End();
                    //Matrix Custommatrix = Matrix.CreateScale(Main.screenWidth / 1920f, Main.screenHeight / 1024f, 0f);
                    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Matrix.CreateScale(1, 1, 0f));
                    for (int i = 0; i < SGAWorld.CaliburnAlterCoordsX.Length; i += 1)
                    {
                        string[]  texs = { "SGAmod/Items/Weapons/Caliburn/CaliburnTypeA", "SGAmod/Items/Weapons/Caliburn/CaliburnTypeB", "SGAmod/Items/Weapons/Caliburn/CaliburnTypeC" };
                        Texture2D tex  = ModContent.GetTexture(texs[i]);

                        Vector2 drawOrigin = new Vector2(tex.Width, tex.Height) / 2f;

                        Vector2 drawPos = (new Vector2(Main.screenWidth, Main.screenHeight) / 2f) * Main.UIScale;

                        Vector2 Vecd       = (new Vector2(SGAWorld.CaliburnAlterCoordsX[i], SGAWorld.CaliburnAlterCoordsY[i] + 96) - (drawPos + Main.screenPosition));
                        float   pointthere = Vecd.ToRotation();
                        bool    flip       = Vecd.X > 0;

                        spriteBatch.Draw(tex, drawPos + (pointthere.ToRotationVector2() * 64f) + (pointthere.ToRotationVector2() * (float)Math.Pow(Vecd.Length(), 0.9) / 50), null, Color.White, pointthere + MathHelper.ToRadians(45) + (flip ? MathHelper.ToRadians(-90) * 3f : 0), drawOrigin, Main.UIScale, flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
                        //spriteBatch.Draw(tex, new Vector2(150, 150), null, Color.White, Main.GlobalTime, drawOrigin, 1, flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
                    }
                    spriteBatch.End();
                    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);
                }
                if (SGAmod.UsesPlasma.ContainsKey(locply.HeldItem.type))
                {
                    if (!locply.dead)
                    {
                        SGAmod    mod    = SGAmod.Instance;
                        SGAPlayer modply = locply.GetModPlayer <SGAPlayer>();
                        int       maxclip;
                        bool      check = SGAmod.UsesPlasma.TryGetValue(locply.HeldItem.type, out maxclip);

                        if (check)
                        {
                            Color     color   = Lighting.GetColor((int)locply.Center.X / 16, (int)locply.Center.Y / 16);
                            Texture2D texture = mod.GetTexture("Items/PlasmaCell");
                            int       drawX   = (int)(((0)));
                            int       drawY   = (int)(((-36)));                    //gravDir

                            spriteBatch.End();
                            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Matrix.CreateScale(Main.UIScale) * Matrix.CreateTranslation(locply.Center.X - Main.screenPosition.X, locply.Center.Y - Main.screenPosition.Y, 0));


                            float percent = ((float)modply.plasmaLeftInClip / (float)modply.plasmaLeftInClipMax);

                            //DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.Lerp(Color.Black, Color.DarkGray, 0.25f), (float)Math.PI, new Vector2(texture.Width / 2, texture.Height / 2), 1f, SpriteEffects.None, 0);
                            //DrawData data2 = new DrawData(texture, new Vector2(drawX, drawY), new Rectangle(0, 0, texture.Width, (int)((float)texture.Height * percent)), Color.White, (float)Math.PI, new Vector2(texture.Width / 2, texture.Height / 2), 1f, SpriteEffects.None, 0);

                            spriteBatch.Draw(texture, new Vector2(drawX, drawY), null, Color.Lerp(Color.Black, Color.DarkGray, 0.25f), (float)Math.PI, new Vector2(texture.Width / 2, texture.Height / 2), 1f, SpriteEffects.None, 0);
                            spriteBatch.Draw(texture, new Vector2(drawX, drawY), new Rectangle(0, 0, texture.Width, (int)((float)texture.Height * percent)), Color.White, (float)Math.PI, new Vector2(texture.Width / 2, texture.Height / 2), 1f, SpriteEffects.None, 0);
                        }
                    }
                }

                if (SGAmod.UsesClips.ContainsKey(locply.HeldItem.type))
                {
                    if (!locply.dead)
                    {
                        SGAmod    mod    = SGAmod.Instance;
                        SGAPlayer modply = locply.GetModPlayer <SGAPlayer>();
                        int       maxclip;
                        bool      check = SGAmod.UsesClips.TryGetValue(locply.HeldItem.type, out maxclip);

                        if (check)
                        {
                            Color     color   = Lighting.GetColor((int)locply.Center.X / 16, (int)locply.Center.Y / 16);
                            Texture2D texture = mod.GetTexture("AmmoHud");
                            int       drawX   = (int)(((-texture.Width / 2f)));
                            int       drawY   = (int)(((-32)));                    //gravDir

                            spriteBatch.End();
                            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Matrix.CreateScale(Main.UIScale) * Matrix.CreateTranslation(locply.Center.X - Main.screenPosition.X, locply.Center.Y - Main.screenPosition.Y, 0));


                            for (int q = 0; q < modply.ammoLeftInClip; q++)
                            {
                                //DrawData data = new DrawData(texture, new Vector2((drawX - (q * texture.Width)) + (int)((maxclip * texture.Width) / 2), drawY), null, Color.White, 0f, new Vector2(texture.Width / 2, texture.Height / 2), 1f, SpriteEffects.None, 0);
                                spriteBatch.Draw(texture, new Vector2((drawX - (q * texture.Width)) + (int)((maxclip * texture.Width) / 2), drawY), null, Color.White, 0f, new Vector2(texture.Width / 2, texture.Height / 2), 1f, SpriteEffects.None, 0);
                            }
                        }
                    }
                }

                //if (SGAmod.UsesClips.ContainsKey(locply.HeldItem.type))
                //{
                if (!locply.dead)
                {
                    SGAmod    mod    = SGAmod.Instance;
                    SGAPlayer modply = locply.GetModPlayer <SGAPlayer>();

                    float perc = (float)modply.boosterPowerLeft / (float)modply.boosterPowerLeftMax;
                    if (perc > 0)
                    {
                        spriteBatch.End();

                        Vector2 scaler = new Vector2(modply.boosterPowerLeftMax / 300f, 1);
                        int     drawX  = (int)(((locply.position.X + (locply.width / 2))) - Main.screenPosition.X);
                        int     drawY  = (int)((locply.position.Y + (locply.gravDir == 1 ? locply.height + 10 : -10)) - Main.screenPosition.Y);                   //gravDir

                        spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Matrix.CreateScale(Main.UIScale) * Matrix.CreateTranslation(drawX, drawY, 0));

                        float     drawcolortrans = MathHelper.Clamp((modply.boosterdelay + 100) / 100f, 0f, 1f);
                        Texture2D texture        = mod.GetTexture("BoostBar");
                        //DrawData data = new DrawData(texture, new Vector2((drawX - (q * texture.Width)) + (int)((maxclip * texture.Width) / 2), drawY), null, Color.White, 0f, new Vector2(texture.Width / 2, texture.Height / 2), 1f, SpriteEffects.None, 0);
                        spriteBatch.Draw(texture, new Vector2(-scaler.X - 2, 0), new Rectangle(0, 0, 2, texture.Height), Color.White * drawcolortrans, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0);
                        spriteBatch.Draw(texture, new Vector2(-scaler.X, 0), new Rectangle(2, 0, 2, texture.Height), Color.DarkGray * drawcolortrans, 0f, new Vector2(0, 0), scaler, SpriteEffects.None, 0);
                        spriteBatch.Draw(texture, new Vector2(-scaler.X, 0), new Rectangle(2, 0, 2, texture.Height), Color.Orange * drawcolortrans, 0f, new Vector2(0, 0), new Vector2(scaler.X * perc, scaler.Y), SpriteEffects.None, 0);
                        spriteBatch.Draw(texture, new Vector2(+scaler.X, 0), new Rectangle(4, 0, 2, texture.Height), Color.White * drawcolortrans, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0);
                    }
                }

                spriteBatch.End();
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.UIScaleMatrix);
            }
            return(true);
        }
Beispiel #26
0
        private bool BlockModdedAccessoriesMethod(Player ply)
        {
            SGAPlayer sgaply = ply.SGAPly();

            return(sgaply.disabledAccessories > 0);
        }
        public void DoApoco(NPC npc, Projectile projectile, Player player, Item item, ref int damage, ref float knockback, ref bool crit, int bitBoldedEffects = 7, bool always = false)
        {
            bool effectSound     = (bitBoldedEffects & (1 << 1 - 1)) != 0;
            bool effectText      = (bitBoldedEffects & (1 << 2 - 1)) != 0;
            bool effectShockwave = (bitBoldedEffects & (1 << 3 - 1)) != 0;

            SGAPlayer moddedplayer = player.GetModPlayer <SGAPlayer>();
            int       chance       = -1;

            if (projectile != null)
            {
                if (projectile.melee)
                {
                    chance = 0;
                }
                if (projectile.ranged)
                {
                    chance = 1;
                }
                if (projectile.magic)
                {
                    chance = 2;
                }
                if (projectile.thrown || projectile.Throwing().thrown)
                {
                    chance = 3;
                }
            }
            if (item != null)
            {
                if (item.melee)
                {
                    chance = 0;
                }
                if (item.ranged)
                {
                    chance = 1;
                }
                if (item.magic)
                {
                    chance = 2;
                }
                if (item.thrown || item.Throwing().thrown)
                {
                    chance = 3;
                }
            }
            if (npc != null && (always || chance > -1))
            {
                double chanceboost = 0;
                if (projectile != null)
                {
                    chanceboost += projectile.GetGlobalProjectile <SGAprojectile>().extraApocoChance;
                }

                if (always || (crit && Main.rand.Next(0, 100) < (moddedplayer.apocalypticalChance[chance] + chanceboost)))
                {
                    if (moddedplayer.HoE && projectile != null)
                    {
                        float ammount = damage;
                        if (moddedplayer.lifestealentropy > 0)
                        {
                            projectile.vampireHeal((int)((ammount * moddedplayer.apocalypticalStrength)), npc.Center);
                            moddedplayer.lifestealentropy -= ammount;
                        }
                    }

                    if (moddedplayer.ninjaSash > 2)
                    {
                        for (int i = 0; i < Main.maxProjectiles; i += 1)
                        {
                            Projectile proj = Main.projectile[i];
                            if (proj.active && proj.owner == player.whoAmI)
                            {
                                if (proj.Throwing().thrown || proj.thrown)
                                {
                                    proj.SGAProj().Embue(projectile);
                                }
                            }
                        }
                    }

                    if (moddedplayer.SybariteGem)
                    {
                        float mul     = moddedplayer.apocalypticalStrength * (((float)damage * 3f) / (float)npc.lifeMax);
                        int   ammount = (int)((float)npc.value * mul);


                        Vector2 pos = new Vector2((int)npc.position.X, (int)npc.position.Y);
                        pos += new Vector2(Main.rand.Next(npc.width), Main.rand.Next(npc.height));
                        SGAUtils.SpawnCoins(pos, ammount, 10f + Math.Min(3f * mul, 20f));
                    }

                    if (moddedplayer.dualityshades)
                    {
                        int ammo = 0;
                        for (int i = 0; i < 4; i += 1)
                        {
                            if (moddedplayer.ammoinboxes[i] > 0)
                            {
                                int  ammox = moddedplayer.ammoinboxes[i];
                                Item itemx = new Item();
                                itemx.SetDefaults(ammox);
                                if (itemx.ammo == AmmoID.Bullet)
                                {
                                    ammo = ammox;
                                    break;
                                }
                            }
                        }
                        if (ammo > 0)
                        {
                            Item itemy = new Item();
                            itemy.SetDefaults(ammo);
                            int shootype = itemy.shoot;

                            for (int i = 128; i < 260; i += 128)
                            {
                                Vector2 anglez = new Vector2(Main.rand.Next(-8000, 8000), Main.rand.Next(-8000, 8000));
                                anglez.Normalize();

                                Main.PlaySound(SoundID.Item, (int)((npc.Center.X) + (anglez.X * i)), (int)((npc.Center.Y) + (anglez.Y * i)), 25, 0.5f, Main.rand.NextFloat(-0.9f, -0.25f));

                                int thisoned = Projectile.NewProjectile(npc.Center + (anglez * i), anglez * -16f, shootype, (int)(damage * 1.50f * moddedplayer.apocalypticalStrength), 0f, Main.myPlayer);
                                Main.projectile[thisoned].ranged = false;


                                for (float gg = 4f; gg > 0.25f; gg -= 0.15f)
                                {
                                    int  dustIndex = Dust.NewDust(npc.Center + new Vector2(-8, -8) + (anglez * i), 16, 16, DustID.AncientLight, -anglez.X * gg, -anglez.Y * gg, 150, Color.Purple, 3f);
                                    Dust dust      = Main.dust[dustIndex];
                                    dust.noGravity = true;
                                }

                                player.ConsumeItemRespectInfiniteAmmoTypes(ammo);
                            }
                        }
                    }

                    if (moddedplayer.RadSuit)
                    {
                        //IrradiatedAmmount = Math.Max(IrradiatedAmmount, 25);

                        IrradiatedExplosion(npc, (int)(damage * 1f * moddedplayer.apocalypticalStrength));

                        SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_DarkMageHealImpact, (int)npc.Center.X, (int)npc.Center.Y);
                        if (sound != null)
                        {
                            sound.Pitch += 0.525f;
                        }

                        int proj;

                        if (projectile != null)
                        {
                            proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType <RadioactivePool>(), (int)(damage * 0.5f * moddedplayer.apocalypticalStrength), projectile.knockBack, projectile.owner);
                        }
                        else
                        {
                            proj = Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <RadioactivePool>(), (int)(damage * 0.5f * moddedplayer.apocalypticalStrength), knockback, player.whoAmI);
                        }

                        Main.projectile[proj].width    += 80;
                        Main.projectile[proj].height   += 80;
                        Main.projectile[proj].timeLeft += (int)(30 * moddedplayer.apocalypticalStrength);
                        Main.projectile[proj].Center   -= new Vector2(40, 40);
                        Main.projectile[proj].netUpdate = true;
                    }

                    if (moddedplayer.CalamityRune)
                    {
                        Main.PlaySound(SoundID.Item45, npc.Center);
                        int boom = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BoulderBlast"), (int)((damage * 2) * moddedplayer.apocalypticalStrength), knockback * 2f, player.whoAmI, 0f, 0f);
                        Main.projectile[boom].usesLocalNPCImmunity = true;
                        Main.projectile[boom].localNPCHitCooldown  = -1;
                        Main.projectile[boom].netUpdate            = true;
                        IdgProjectile.AddOnHitBuff(boom, BuffID.Daybreak, (int)(60f * moddedplayer.apocalypticalStrength));
                        IdgProjectile.AddOnHitBuff(boom, mod.BuffType("EverlastingSuffering"), (int)(400f * moddedplayer.apocalypticalStrength));
                    }

                    damage = (int)(damage * (3f + (moddedplayer.apocalypticalStrength - 1f)));

                    if (moddedplayer.magatsuSet && npc.HasBuff(ModContent.BuffType <Watched>()))
                    {
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <Items.Armors.Magatsu.ExplosionDarkSectorEye>(), 0, 0);

                        Point location;

                        if (projectile != null)
                        {
                            location = new Point((int)projectile.Center.X, (int)projectile.Center.Y);
                        }
                        else
                        {
                            location = new Point((int)npc.Center.X, (int)npc.Center.Y);
                        }

                        SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_WyvernScream, (int)location.X, (int)location.Y);
                        if (sound != null)
                        {
                            sound.Pitch = 0.925f;
                        }

                        foreach (NPC enemy in Main.npc.Where(testby => testby.active && !testby.dontTakeDamage && !testby.friendly && testby != npc && (testby.Center - npc.Center).LengthSquared() < 400 * 400))
                        {
                            int damazz = Main.DamageVar(damage);
                            enemy.StrikeNPC(damazz, 16, -enemy.spriteDirection, true);

                            if (Main.netMode != 0)
                            {
                                NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, damazz, 16f, (float)1, 0, 0, 0);
                            }
                        }
                    }

                    if (effectText)
                    {
                        CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), Color.DarkRed, "Apocalyptical!", true, false);
                    }
                    if (SGAConfigClient.Instance.EpicApocalypticals)
                    {
                        if (effectShockwave)
                        {
                            RippleBoom.MakeShockwave(npc.Center, 8f, 1f, 10f, 60, 1f);
                            if (SGAmod.ScreenShake < 32)
                            {
                                SGAmod.AddScreenShake(24f, 1200, player.Center);
                            }
                        }
                        if (effectSound)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/crit_hit").WithVolume(.7f).WithPitchVariance(.25f), npc.Center);
                        }
                    }
                }
            }
        }
		public override bool PreAI(Projectile projectile)
		{
		SGAprojectile modeproj=projectile.GetGlobalProjectile<SGAprojectile>();

			if (modeproj.inttime == false)
			{
				if (projectile.friendly)
				{
					Player owner = Main.player[projectile.owner];
					if (owner != null)
					{
						SGAPlayer sgaply = owner.SGAPly();
						if (sgaply.acidSet.Item2 && (projectile.Throwing().thrown || projectile.thrown))
						{
							acid = true;
						}
						if (sgaply.enchantedShieldPolish)
						{
							if (projectile.modProjectile != null && projectile.modProjectile is IShieldBashProjectile)
							{
								projectile.magic = true;
							}
						}
					}
				}
			}



			if (projectile.modProjectile!=null){

		/*if ((projectile.modProjectile).GetType().Name=="JackpotRocket"){
		projectile.velocity.Y+=0.1f;
		projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; 
		}*/

	}

			/*if (Main.player[projectile.owner]!=null);
			ply=Main.player[projectile.owner];
			if (Main.npc[projectile.owner]!=null);
			npc=Main.npc[projectile.owner];
			if (npc!=null && modeproj.inttime==true){
			if (modeproj.raindown==true && projectile.position.Y>modeproj.splithere.Y && projectile.velocity.Y>0){
			projectile.timeLeft=-1;

			}
			if (modeproj.splittingcoins==true){
			if ((projectile.position.Y>modeproj.splithere.Y && projectile.velocity.Y>0) || (projectile.position.Y<modeproj.splithere.Y && projectile.velocity.Y<0)){
			SgaLib.Shattershots(projectile.position,projectile.position+new Vector2(-100,0),new Vector2(0,0),projectile.type,projectile.damage,projectile.velocity.Length(),0,1,true,0,true,projectile.timeLeft);
			SgaLib.Shattershots(projectile.position,projectile.position+new Vector2(100,0),new Vector2(0,0),projectile.type,projectile.damage,projectile.velocity.Length(),0,1,true,0,true,projectile.timeLeft);
			//projectile.position=new Vector2(0,-900);
			projectile.timeLeft=-1;
		}}

			}*/
			if (projectile.type == 181 || projectile.type == ProjectileID.GiantBee)
			{
				if (Main.player[projectile.owner] != null)
				{
					Player ply = Main.player[projectile.owner];
					if (ply != null)
					{
						SGAPlayer modplayer = ply.GetModPlayer<SGAPlayer>();
						if (ply != null)
						{
							if (modplayer.beefield > 0)
							{
								//modeproj.enhancedbees == true
								if (modplayer.beefieldtoggle > 0)
								{
									if (projectile.velocity.Length() > 20)
									{
										projectile.velocity.Normalize();
										projectile.velocity = projectile.velocity * 0.98f;
									}
									else
									{
										projectile.velocity = projectile.velocity * 1.15f;
									}
								}
							}
						}
					}
				}
			}
		modeproj.inttime=true;
		return true;
		}
        public override void PostAI(Projectile projectile)
		{
			SGAprojectile modeproj = projectile.GetGlobalProjectile<SGAprojectile>();
				modeproj.damageReduceTime -= 1;			
			if (modeproj.damageReduce >= 0f)
            {

				if (damageReduceTime < 1)
				{
					modeproj.damageReduce /= 2f;
					if (modeproj.damageReduce < 1)
						modeproj.damageReduce = 1f;
				}
			}


			Player owner = Main.player[projectile.owner];
			if (owner != null)
			{
			SGAPlayer sgaply= owner.SGAPly();

				if (projectile.sentry && sgaply.bustlingFungus.Item1)
                {
					fungalAura += 1;
					if (fungalAura == 180)
                    {
						int proj = Projectile.NewProjectile(projectile.Center,Vector2.Zero,ModContent.ProjectileType<Items.Accessories.BungalHealingAura>(),0,0,projectile.owner,0,projectile.whoAmI+1);
						//Main.projectile[proj].ai[1] = projectile.whoAmI + 1;
					}
					if (projectile.velocity.Length() > 0.25)
                    {
						fungalAura = 0;
					}

                }
                else
                {
					fungalAura = 0;
				}


				if (projectile.melee)
				{


					//Main.NewText("test " + projectile.coldDamage);

					if (sgaply.glacialStone)
					{
						if (!owner.frostBurn && projectile.friendly && !projectile.hostile && !projectile.noEnchantments && Main.rand.Next(2 * (1 + projectile.extraUpdates)) == 0)
						{
							int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, projectile.velocity.X * 0.2f + (float)(projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, default(Color), 2f);
							Main.dust[num].noGravity = true;
							Main.dust[num].velocity *= 0.7f;
							Main.dust[num].velocity.Y -= 0.5f;
						}
						projectile.coldDamage = true;

					}

					sgaply.FlaskEffects(new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height), projectile.velocity);
				}
			}

			if (embued)
			{
				int dust = Dust.NewDust(projectile.position,projectile.width, projectile.height, DustID.AncientLight, 0f, 0f, 100, default(Color), 1f);
				Main.dust[dust].noGravity = true;
				Main.dust[dust].fadeIn = 0.6f;
				Main.dust[dust].velocity = projectile.velocity*Main.rand.NextFloat(0.25f,0.80f);
				Main.dust[dust].color = Main.hslToRgb(((float)(Main.GlobalTime / 3)+(float)projectile.whoAmI*7.16237f) % 1f, 0.9f, 0.65f);
			}

			if (acid)
            {
				if (Main.rand.Next(0, 3) == 1)
				{
					int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType<Dusts.AcidDust>());
					Main.dust[dust].scale = 0.75f;
					Main.dust[dust].noGravity = true;
					Main.dust[dust].velocity = projectile.velocity * (float)(Main.rand.Next(60, 100) * 0.01f);
				}
			}

			//SGAprojectile modeproj = projectile.GetGlobalProjectile<SGAprojectile>();
			if (projectile.owner < 255 && Main.player[projectile.owner].active && projectile.friendly && !projectile.hostile)
			{
				if (!modeproj.stackedattack)
				{
					owner.GetModPlayer<SGAPlayer>().StackAttack(ref projectile.damage, projectile);
				}
			}
			modeproj.stackedattack = true;

			if (shortlightning > 0)
			{

				for (int i = 0; i < Math.Min(shortlightning, projectile.oldPos.Length); i++)
				{
					projectile.oldPos[i].X = projectile.position.X;
					projectile.oldPos[i].Y = projectile.position.Y;
				}

			}
			if (projectile.modProjectile != null)
			{
				Player projowner = Main.player[projectile.owner];
				if (projectile.modProjectile.mod == SGAmod.Instance && projowner.active && projowner.heldProj == projectile.whoAmI)
				{
					projectile.Opacity = MathHelper.Clamp(projowner.stealth, 0.1f, 1f)*Math.Min(projectile.modProjectile is ClipWeaponReloading sub ? (float)projectile.timeLeft/20f : 1f,1f);
				}
			}
		}
        public void DoModifies(NPC npc, Player player, Projectile projectile, Item item, ref int sourcedamage, ref float knockback, ref bool crit)
        {
            SGAPlayer moddedplayer = player.GetModPlayer <SGAPlayer>();
            int       damage       = (int)(sourcedamage * damagemul);

            Projectile held = null;

            if (projectile != null)
            {
                float resist = npc.SGANPCs().pierceResist;
                if ((projectile.penetrate < 0 || projectile.penetrate > 3) && resist < 1)
                {
                    damage       = (int)(damage * resist);
                    sourcedamage = damage;
                }


                if (crit && moddedplayer.molotovLimit > 0 && projectile.Throwing().thrown)
                {
                    crit = (Main.rand.Next(10) == 0);
                }

                if (player != null && player.heldProj >= 0)
                {
                    held = Main.projectile[player.heldProj];
                }

                if (projectile.trap)
                {
                    damage += (int)(sourcedamage * (player.SGAPly().TrapDamageMul - 1f));
                }
            }

            DoApoco(npc, projectile, player, item, ref damage, ref knockback, ref crit);

            if (moddedplayer != null)
            {
                if (moddedplayer.acidSet.Item1)
                {
                    reducedDefense += (npc.poisoned ? 5 : 0) + (npc.venom ? 5 : 0) + (acidburn ? 5 : 0);
                }
            }

            damage += (int)(Math.Min(npc.defense, reducedDefense) / 2);

            if (Gourged)
            {
                damage += npc.defense / 4;
            }
            if (Sodden)
            {
                damage += (int)((float)sourcedamage * 0.33f);
            }

            if (moddedplayer != null)
            {
                if (moddedplayer.PrimordialSkull)
                {
                    if (npc.HasBuff(BuffID.OnFire))
                    {
                        damage += (int)(sourcedamage * 0.25);
                    }
                }

                if (npc.HasBuff(BuffID.Midas))
                {
                    damage += (int)(sourcedamage * 0.15f);
                }
            }

            if (item != null)
            {
                if (item.pick + item.axe + item.hammer > 0)
                {
                    if (player.HasBuff(ModContent.BuffType <TooltimePotionBuff>()))
                    {
                        knockback += 50f;
                    }
                }
            }

            if (projectile != null)
            {
                SGAprojectile modeproj   = projectile.GetGlobalProjectile <SGAprojectile>();
                Player        P          = Main.player[projectile.owner];
                bool          trapdamage = false;
                if (projectile.trap)
                {
                    trapdamage = true;
                }

                if (trapdamage)
                {
                    float totaldamage = 0f;
                    //damage += (int)((npc.defense * moddedplayer.TrapDamageAP) / 2.00);
                    totaldamage += moddedplayer.TrapDamageAP;
                    if (moddedplayer.JaggedWoodenSpike)
                    {
                        totaldamage += 0.4f;
                        //damage += (int)((npc.defense*0.4)/2.00);
                    }
                    if (moddedplayer.JuryRiggedSpikeBuckler)
                    {
                        //damage += (int)(damage * 0.1);
                        totaldamage += 0.1f;
                        //damage += (int)((npc.defense * 0.1) / 2.00);
                    }
                    totaldamage = Math.Min(totaldamage, 1f);
                    if (moddedplayer.GoldenCog)
                    {
                        npc.life = npc.life - (int)(damage * 0.10);
                        if (Main.netMode == 2)
                        {
                            NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0);
                        }
                    }
                    damage += (int)((npc.defense * totaldamage) / 2.00);
                }

                if (moddedplayer.beefield > 0 && (projectile.type == ProjectileID.Bee || projectile.type == ProjectileID.GiantBee))
                {
                    damage += (int)(Math.Min(moddedplayer.beedamagemul, 10f + (moddedplayer.beedamagemul / 50f)) * 1.5f);
                }

                if (modeproj.myplayer != null)
                {
                    P = modeproj.myplayer;
                }

                if (P != null)
                {
                    if (moddedplayer.CirnoWings == true && projectile.coldDamage)
                    {
                        damage += (int)((float)sourcedamage * 0.20f);
                    }
                }
            }

            if (moddedplayer.MisterCreeperset && item != null)
            {
                if (item.shoot < 1 && item.melee)
                {
                    if (player.velocity.Y > 1)
                    {
                        crit = true;
                    }
                }
            }

            if (moddedplayer.Blazewyrmset)
            {
                if (npc.HasBuff(mod.BuffType("ThermalBlaze")) && ((item != null && item.melee) || (projectile != null && projectile.melee)))
                {
                    damage += (int)(sourcedamage * 0.20f);
                }
            }

            if (moddedplayer.alkalescentHeart)
            {
                damage += (int)(sourcedamage * (0f + (npc.HasBuff(ModContent.BuffType <AcidBurn>()) ? 0.15f : (npc.HasBuff(BuffID.Venom) ? 0.10f : (npc.HasBuff(BuffID.Poisoned) ? 0.05f : 0)))));
            }

            SGAPlayer sgaply = player.SGAPly();

            if (sgaply.snakeEyes.Item1)
            {
                bool falsecrit = crit;
                if (!crit && Main.rand.Next(100) == 0)
                {
                    CombatText.NewText(npc.Hitbox, Color.Red, "False Crit", false, false);
                    falsecrit = true;
                }
                sgaply.snakeEyes.Item2 = falsecrit ? 0 : Math.Min(sgaply.snakeEyes.Item2 + 1, 100);
                damage += (int)(sourcedamage * (0f + (sgaply.snakeEyes.Item2 / 100f)));
            }

            if ((Main.netMode < 1 || SGAmod.SkillRun > 1) && SGAmod.SkillRun > 0)
            {
                if (sgaply.skillMananger == null)
                {
                    return;
                }

                if (item != null)
                {
                    sgaply.skillMananger.OnEnemyDamage(ref damage, ref crit, ref knockback, item, null);
                }
                if (projectile != null)
                {
                    sgaply.skillMananger.OnEnemyDamage(ref damage, ref crit, ref knockback, null, projectile);
                }
            }

            if (petrified)
            {
                if (player != null && (item?.pick > 0 || (projectile != null && player.heldProj >= 0 && player.heldProj == projectile.whoAmI && player.HeldItem.pick > 0)))
                {
                    damage = (int)(damage * 3f);
                    crit   = true;
                    Main.PlaySound(SoundID.Tink, (int)npc.Center.X, (int)npc.Center.Y, 0, 1, 0.25f);
                }
                else
                {
                    damage = (int)(damage * 0.25f);
                }
            }

            DoModifiesLateEvent?.Invoke(npc, player, projectile, item, ref sourcedamage, ref damage, ref knockback, ref crit);

            LifeSteal(npc, player, ref damage, ref knockback, ref crit);
            OnCrit(npc, projectile, player, item, ref damage, ref knockback, ref crit);

            sourcedamage = damage;
        }