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)); }
private int DrawBuffIconDust(On.Terraria.Main.orig_DrawBuffIcon orig, int drawBuffText, int i, int b, int x, int y) { drawBuffText = orig(drawBuffText, i, b, x, y); // i = index of buff; b = buff type if (b == ModContent.BuffType <StageII>()) { if (Main.rand.NextBool(2)) { float scale = Main.rand.NextFloat(0.7f, 0.9f); Vector2 pos = new Vector2(Main.rand.Next(x + 2, x + 28), y - 2); Vector2 vel = new Vector2(0, -0.7f * scale); Vector2 accel = new Vector2(0, -0.07f * scale); StageIIDusts.Add(new StageIIDust(pos, vel, accel, scale)); } } StageIIDusts.ForEach(d => d.Update()); StageIIDusts.RemoveAll(d => !d.Active); StageIIDusts.ForEach(d => d.Draw(Main.spriteBatch)); return(drawBuffText); }