private static void DrawLayer(PlayerDrawInfo drawInfo) { if (Main.netMode == NetmodeID.Server) { return; } DBTPlayer dbtPlayer = drawInfo.drawPlayer.GetModPlayer <DBTPlayer>(); AuraAppearance aura = dbtPlayer.GetAura(); if (aura == null) { return; } int auraHeight = aura.Information.GetHeight(dbtPlayer); Texture2D auraTexture = aura.Information.GetTexture(dbtPlayer); Rectangle auraRectangle = new Rectangle(0, auraHeight * dbtPlayer.AuraFrameIndex, auraTexture.Width, auraHeight); float scale = aura.Information.GetAuraScale(dbtPlayer); Tuple <float, Vector2> rotationAndPosition = aura.Information.GetRotationAndPosition(dbtPlayer); SamplerState samplerState = dbtPlayer.GetPlayerSamplerState(); aura.Information.BlendState.SetSpriteBatchForPlayerLayerCustomDraw(samplerState); Main.spriteBatch.Draw(auraTexture, rotationAndPosition.Item2 - Main.screenPosition, auraRectangle, Color.White, rotationAndPosition.Item1, new Vector2(aura.Information.GetWidth(dbtPlayer), aura.Information.GetHeight(dbtPlayer)) * 0.5f, scale, SpriteEffects.None, 0f); samplerState.ResetSpriteBatchForPlayerDrawLayers(); }
public override void ModifyDrawInfo(Player player, Mod mod, ref PlayerDrawInfo drawInfo) { //custom race's default color values and clothing styles go here var modPlayer = player.GetModPlayer <MrPlagueRaces.MrPlagueRacesPlayer>(); Item familiarshirt = new Item(); familiarshirt.SetDefaults(ItemID.FamiliarShirt); Item familiarpants = new Item(); familiarpants.SetDefaults(ItemID.FamiliarPants); if (modPlayer.resetDefaultColors) { modPlayer.resetDefaultColors = false; player.hairColor = new Color(90, 87, 250); player.skinColor = new Color(204, 204, 204); player.eyeColor = new Color(94, 62, 44); player.shirtColor = new Color(219, 70, 44); player.underShirtColor = new Color(170, 75, 191); player.pantsColor = new Color(108, 99, 110); player.shoeColor = new Color(40, 37, 41); player.skinVariant = 3; if (player.armor[1].type < ItemID.IronPickaxe && player.armor[2].type < ItemID.IronPickaxe) { player.armor[1] = familiarshirt; player.armor[2] = familiarpants; } } }
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { if (player.HasBuff(BuffType <Potions.OneupBuff>()) && Main.rand.NextBool(7)) { Dust.NewDust(player.position, 10, 10, 74); } }
public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (HasJotaroCap(player)) { drawInfo.headArmorShader = 0; } }
public override void ModifyDrawInfo(Player player, Mod mod, ref PlayerDrawInfo drawInfo) { var modPlayer = player.GetModPlayer <MrPlagueRaces.MrPlagueRacesPlayer>(); Item familiarshirt = new Item(); familiarshirt.SetDefaults(ItemID.FamiliarShirt); Item familiarpants = new Item(); familiarpants.SetDefaults(ItemID.FamiliarPants); if (modPlayer.resetDefaultColors && Main.gameMenu) { modPlayer.resetDefaultColors = false; player.hairColor = new Color(209, 169, 90); player.skinColor = new Color(208, 199, 181); player.eyeColor = new Color(209, 21, 25); player.shirtColor = new Color(219, 70, 44); player.underShirtColor = new Color(170, 75, 191); player.pantsColor = new Color(108, 99, 110); player.skinVariant = 8; if (player.armor[1].type < ItemID.IronPickaxe && player.armor[2].type < ItemID.IronPickaxe) { player.armor[1] = familiarshirt; player.armor[2] = familiarpants; } } }
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { if (overheatingPlayer) { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, DustID.Fire, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 2f);
public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (redTimer > 0) { Color playerColor = drawInfo.bodyColor; float bloodColor = redTimer; float red = playerColor.R / 255f; float green = playerColor.B / 255f; float blue = playerColor.G / 255f; if (Main.dayTime) { drawInfo.bodyColor = new Color(Utils.Clamp((Math.Abs(bloodColor - 1)), 0f, red), Utils.Clamp((Math.Abs(bloodColor - 1)), 0f, green), Utils.Clamp((Math.Abs(bloodColor - 1)), 0f, blue)); drawInfo.legColor = new Color(Utils.Clamp((Math.Abs(bloodColor - 1)), 0f, red), Utils.Clamp((Math.Abs(bloodColor - 1)), 0f, green), Utils.Clamp((Math.Abs(bloodColor - 1)), 0f, blue)); drawInfo.faceColor = new Color(Utils.Clamp((Math.Abs(bloodColor - 1)), 0f, red), Utils.Clamp((Math.Abs(bloodColor - 1)), 0f, green), Utils.Clamp((Math.Abs(bloodColor - 1)), 0f, blue)); } else { drawInfo.bodyColor = new Color(Utils.Clamp(bloodColor, red, 1f), green, blue); drawInfo.legColor = new Color(Utils.Clamp(bloodColor, red, 1f), green, blue); drawInfo.faceColor = new Color(Utils.Clamp(bloodColor, red, 1f), green, blue); } player.immuneNoBlink = true; redTimer -= 0.02f; } }
public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (stealth < 1.0f) { float scale = stealth; scale = MathHelper.Clamp(stealth, 0.0f, 1.0f); drawInfo.eyeWhiteColor = Color.Multiply(drawInfo.eyeWhiteColor, scale); drawInfo.eyeColor = Color.Multiply(drawInfo.eyeColor, scale); drawInfo.hairColor = Color.Multiply(drawInfo.hairColor, scale); drawInfo.faceColor = Color.Multiply(drawInfo.faceColor, scale); drawInfo.bodyColor = Color.Multiply(drawInfo.bodyColor, scale); drawInfo.legColor = Color.Multiply(drawInfo.legColor, scale); drawInfo.shirtColor = Color.Multiply(drawInfo.shirtColor, scale); drawInfo.underShirtColor = Color.Multiply(drawInfo.underShirtColor, scale); drawInfo.pantsColor = Color.Multiply(drawInfo.pantsColor, scale); drawInfo.shoeColor = Color.Multiply(drawInfo.shoeColor, scale); drawInfo.headGlowMaskColor = Color.Multiply(drawInfo.headGlowMaskColor, scale); drawInfo.bodyGlowMaskColor = Color.Multiply(drawInfo.bodyGlowMaskColor, scale); drawInfo.legGlowMaskColor = Color.Multiply(drawInfo.legGlowMaskColor, scale); drawInfo.armGlowMaskColor = Color.Multiply(drawInfo.armGlowMaskColor, scale); drawInfo.upperArmorColor = Color.Multiply(drawInfo.upperArmorColor, scale); drawInfo.lowerArmorColor = Color.Multiply(drawInfo.lowerArmorColor, scale); drawInfo.middleArmorColor = Color.Multiply(drawInfo.middleArmorColor, scale); // 减少仇恨 player.aggro = -500; } }
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { if (DarkArtsBuff) { if (Main.rand.NextBool(1)) { for (int i = 0; i < 2; i++) { int dust = Dust.NewDust(drawInfo.position, 30, 30, ModContent.DustType <VoidDust>(), Main.rand.Next(-10, 10), 0f, 0, Color.Black); Main.dust[dust].scale = 1.5f; Main.dust[dust].noGravity = true; } } r = 0f; g = 0f; b = 0f; } if (SoulPowered) { for (int i = 0; i < 1; i++) { int dust = Dust.NewDust(drawInfo.position, 30, 30, DustID.WhiteTorch, 0f, 0f, 0, Color.White); Main.dust[dust].scale = 1f; Main.dust[dust].noGravity = true; } } }
public static void DrawItemGlowMask(Texture2D texture, PlayerDrawInfo info) { Item item = info.drawPlayer.HeldItem; if (info.shadow != 0f || info.drawPlayer.frozen || ((info.drawPlayer.itemAnimation <= 0 || item.useStyle == 0) && (item.holdStyle <= 0 || info.drawPlayer.pulley)) || item.type <= 0 || info.drawPlayer.dead || item.noUseGraphic || (info.drawPlayer.wet && item.noWet)) { return; } Main.playerDrawData.Add ( new DrawData ( texture, info.itemLocation - Main.screenPosition, new Rectangle(0, 0, texture.Width, texture.Height), new Color(250, 250, 250, item.alpha), info.drawPlayer.itemRotation, new Vector2 ( texture.Width * 0.5f * (1 - info.drawPlayer.direction), info.drawPlayer.gravDir == -1f ? 0 : texture.Height ), item.scale, info.spriteEffects, 0 ) ); }
public static DrawData AmmoGunDrawData(PlayerDrawInfo drawInfo, string ammoCounterSprite, int yOffset, float angleInRadians) { Player drawPlayer = drawInfo.drawPlayer; Mod mod = Highlander.Instance; HighlanderPlayer modPlayer = drawPlayer.GetModPlayer <HighlanderPlayer>(); float scale = 1f; Texture2D texture = mod.GetTexture(ammoCounterSprite); int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); int drawY = (int)(drawInfo.position.Y + yOffset + 70 - Main.screenPosition.Y); if (drawPlayer.mount.Active) { MountData data = drawPlayer.mount._data; Vector2 pos = new Vector2(); pos.Y += data.heightBoost; pos += drawInfo.position; int smoothOffset = (int)((drawInfo.position - Main.screenPosition) - (drawPlayer.position - Main.screenPosition)).Y + data.heightBoost; drawX = (int)(pos.X + drawPlayer.width / 2f - Main.screenPosition.X); drawY = (int)(pos.Y + yOffset - smoothOffset + 70 - Main.screenPosition.Y); } return(new DrawData(texture, new Vector2(drawX, drawY), new Rectangle(0, 0, texture.Width, texture.Height), Color.White, angleInRadians, new Vector2(texture.Width / 2f, texture.Height / 2f), scale, SpriteEffects.None, 0)); }
public void DrawHeld(PlayerDrawInfo drawInfo, Color color, float rotation, float scale, Vector2 playerCenter) { try { Player player = Main.player[Main.myPlayer]; Vector2 position = new Vector2(4f * player.direction, -4f).RotatedBy(rotation) + playerCenter; if (LocalTexture == null) { //Removing references to SetDefaults //item.SetDefaults(); return; } SpriteEffects effects = player.direction > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; DrawData draw = new DrawData(LocalTexture, position, null, Lighted ? Color.White : color, rotation, new Vector2(player.direction > 0 ? 0 : LocalTexture.Width, LocalTexture.Height), scale, effects, 0); for (int i = 0; i < Main.playerDrawData.Count; i += 1) { if (Main.playerDrawData[i].texture != Main.itemTexture[player.inventory[player.selectedItem].type]) { continue; } Main.playerDrawData.Insert(i, draw); return; } Main.playerDrawData.Add(draw); } catch (SystemException e) { ModLoader.GetMod(Constants.ModName).Logger.InfoFormat(e.ToString()); } }
public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (player.dashDelay < 0) { player.headRotation = (float)(Math.PI / 2) * player.direction; } }
public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { #region 透明 if (透明程度 < 1 && 装备_蘑菇头甲) { float sFLOAT = 透明程度; sFLOAT = MathHelper.Clamp(透明程度, 0, 1); drawInfo.eyeColor = Color.Multiply(drawInfo.eyeColor, sFLOAT); drawInfo.legColor = Color.Multiply(drawInfo.legColor, sFLOAT); drawInfo.bodyColor = Color.Multiply(drawInfo.bodyColor, sFLOAT); drawInfo.faceColor = Color.Multiply(drawInfo.faceColor, sFLOAT); drawInfo.hairColor = Color.Multiply(drawInfo.hairColor, sFLOAT); drawInfo.shoeColor = Color.Multiply(drawInfo.shoeColor, sFLOAT); drawInfo.pantsColor = Color.Multiply(drawInfo.pantsColor, sFLOAT); drawInfo.shirtColor = Color.Multiply(drawInfo.shirtColor, sFLOAT); drawInfo.eyeWhiteColor = Color.Multiply(drawInfo.eyeWhiteColor, sFLOAT); drawInfo.lowerArmorColor = Color.Multiply(drawInfo.lowerArmorColor, sFLOAT); drawInfo.upperArmorColor = Color.Multiply(drawInfo.upperArmorColor, sFLOAT); drawInfo.underShirtColor = Color.Multiply(drawInfo.underShirtColor, sFLOAT); drawInfo.armGlowMaskColor = Color.Multiply(drawInfo.armGlowMaskColor, sFLOAT); drawInfo.legGlowMaskColor = Color.Multiply(drawInfo.legGlowMaskColor, sFLOAT); drawInfo.middleArmorColor = Color.Multiply(drawInfo.middleArmorColor, sFLOAT); drawInfo.bodyGlowMaskColor = Color.Multiply(drawInfo.bodyGlowMaskColor, sFLOAT); drawInfo.headGlowMaskColor = Color.Multiply(drawInfo.headGlowMaskColor, sFLOAT); } #endregion }
public static void DrawLayer(PlayerDrawInfo drawInfo) { Skin.visible = false; float XOffset; SpriteEffects spriteEffects; if (drawInfo.drawPlayer.direction == 1) { spriteEffects = SpriteEffects.None; XOffset = 2.1f; } else { spriteEffects = SpriteEffects.FlipHorizontally; XOffset = 2f; } float drawX = (drawInfo.position.X + drawInfo.drawPlayer.width / XOffset - Main.screenPosition.X); // when looking right, add 3 float drawY = (drawInfo.position.Y + drawInfo.drawPlayer.height / 0.08f - Main.screenPosition.Y) + 25; Color color = Lighting.GetColor((int)drawInfo.drawPlayer.position.X / 16, (int)drawInfo.drawPlayer.position.Y / 16, drawInfo.drawPlayer.skinColor); Main.spriteBatch.Draw(_customBodySkin, new Vector2(drawX, drawY), drawInfo.drawPlayer.bodyFrame, color, 0, new Vector2(_customBodySkin.Width / 2f, _customBodySkin.Height / 2f), 1f, spriteEffects, 0); }
public void DrawArmorLayer(PlayerDrawInfo info) { if (info.drawPlayer.GetModPlayer <StarlightPlayer>().empowered) { ArmorHelper.QuickDrawBodyFramed(info, AssetDirectory.VanityItem + "AncientStarwoodChest_Body_Alt", 1, new Vector2(10, 18)); } }
public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { foreach (SkillData sd in GetSkillsUnderEffect) { sd.GetBase.UpdateAnimation(player, sd); } }
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { if (Cometspark) { if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) { int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, DustID.Electric, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default, 1.5f);
public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (DyeSlot.Item.stack > 0 && (EquipSlot.Item.wingSlot > 0 || VanitySlot.Item.wingSlot > 0)) { drawInfo.wingShader = DyeSlot.Item.dye; } }
public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (ShoeDyeSlot.Item.stack > 0 && (EquipShoeSlot.Item.shoeSlot > 0 || VanityShoeSlot.Item.shoeSlot > 0)) { drawInfo.shoeShader = ShoeDyeSlot.Item.dye; } }
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { if (redTimer > 0.8) { Dust.NewDust(player.position, player.width, player.height, 183); } }
public void DrawArmorLayer(PlayerDrawInfo info)//custom drawing the hat (todo) { if (info.drawPlayer.GetModPlayer <StarlightPlayer>().empowered) { ArmorHelper.QuickDrawHeadFramed(info, AssetDirectory.StarwoodItem + "StarwoodHat_Head_Alt", 1, new Vector2(10, 18)); } }
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { if (player.FindBuffIndex(mod.BuffType("Frostfire")) >= 0) { if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) { int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 135, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; Main.playerDrawDust.Add(dust); } r *= 0.1f; g *= 0.2f; b *= 0.7f; fullBright = true; } else if (player.FindBuffIndex(mod.BuffType("Solarfire")) >= 0) { if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) { int num41 = Dust.NewDust(new Vector2(drawInfo.position.X - 2f, drawInfo.position.Y - 2f), player.width + 4, player.height + 4, 6, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Microsoft.Xna.Framework.Color), 3f); Main.dust[num41].noGravity = true; Dust dust2 = Main.dust[num41]; dust2.velocity *= 1.8f; Dust dust3 = Main.dust[num41]; dust3.velocity.Y = dust3.velocity.Y - 0.5f; Main.playerDrawDust.Add(num41); } g *= 0.6f; b *= 0.7f; fullBright = true; } }
public override void Draw(Player player, SkillData rawdata, PlayerDrawInfo pdi) { SummonQueenBeeData data = (SummonQueenBeeData)rawdata; if (!Main.NPCLoaded[Terraria.ID.NPCID.QueenBee]) { Main.instance.LoadNPC(Terraria.ID.NPCID.QueenBee); } Texture2D texture = Main.npcTexture[Terraria.ID.NPCID.QueenBee]; float Opacity = 1f; if (data.Time < 60) { Opacity = data.Time * (1f / 60); } else if (data.Time >= 60 * (BeeSummonTime + 1)) { Opacity = (60 - (data.Time - 60 * (BeeSummonTime + 1))) * (1f / 60); } if (Opacity < 0) { Opacity = 0; } Rectangle drawRect = new Rectangle(0, 0, texture.Width, texture.Height / Main.npcFrameCount[Terraria.ID.NPCID.QueenBee]); drawRect.Y = drawRect.Height * data.FrameID; Vector2 Origin = new Vector2(drawRect.Width * 0.5f, drawRect.Height * 0.5f); Terraria.DataStructures.DrawData dd = new Terraria.DataStructures.DrawData(texture, data.Position - Main.screenPosition, drawRect, Lighting.GetColor((int)(data.Position.X * (1f / 16)), (int)(data.Position.Y * (1f / 16)), Color.Cyan) * Opacity, 0f, Origin, 1f, (data.Direction > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None), 0); Main.playerDrawData.Insert(0, dd); }
public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) //i just really dont want to fix the sprite issues. { if (drawInfo.drawPlayer.legs == mod.GetEquipSlot("DraedonLeggings", EquipType.Legs)) { drawInfo.legColor = Color.Transparent; drawInfo.legGlowMaskColor = Color.Transparent; drawInfo.pantsColor = Color.Transparent; } if (drawInfo.drawPlayer.body == mod.GetEquipSlot("DraedonChestplate", EquipType.Body)) { drawInfo.armGlowMaskColor = Color.Transparent; drawInfo.bodyColor = Color.Transparent; drawInfo.bodyGlowMaskColor = Color.Transparent; drawInfo.shirtColor = Color.Transparent; drawInfo.underShirtColor = Color.Transparent; } if (drawInfo.drawPlayer.head == mod.GetEquipSlot("DraedonHelmet", EquipType.Head)) { drawInfo.eyeColor = Color.Transparent; drawInfo.eyeWhiteColor = Color.Transparent; drawInfo.faceColor = Color.Transparent; drawInfo.hairColor = Color.Transparent; drawInfo.headGlowMaskColor = Color.Transparent; } }
//You actually need this in order to apply the texture to the player public override void ModifyDrawLayers(List <PlayerLayer> layers) { //If the selected item is the Midas Sprayer draw it if (player.inventory[player.selectedItem].type == mod.ItemType("MidasSprayer")) { //Making a draw information PlayerDrawInfo drawInfo = default(PlayerDrawInfo); //Make an instance of Draw Info Vector2 Position = player.position; //Make a variable Position for player position drawInfo.drawPlayer = player; //The draw info's player is the player drawInfo.position = player.position; //Draw position is the player's position drawInfo.shadow = 0f; //Set the shadow as a 0 float shadow = 0f; //Make another variable shadow as 0 also //Get a vector for the player position Vector2 vector = player.position + (player.itemLocation - player.position); drawInfo.itemLocation = vector; //Get the alpha of the surrounding area //player.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)player.width * 0.5) / 16, (int)((double)Position.Y + (double)player.height * 0.5) / 16, Color.White), shadow); //Make draw data of value DrawData value = default(DrawData); //Putting the texture up //Getting the color of the player Color color12 = player.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)player.width * 0.5) / 16, (int)((double)Position.Y + (double)player.height * 0.5) / 16, Color.White), shadow); SpriteEffects spriteEffects = SpriteEffects.None; //Setting so there is no Sprite Effects Texture2D MidasBackpack = mod.GetTexture("Items/Usables/MidasBackpack"); //Getting the texture //Putting up the draw data value = new DrawData(MidasBackpack, new Vector2((float)((int)(Position.X - Main.screenPosition.X + (float)(player.width / 2) - (float)(9 * player.direction))) + -4f * (float)player.direction, (float)((int)(Position.Y - Main.screenPosition.Y + (float)(player.height / 2) + 2f * player.gravDir + -8f * player.gravDir))), new Rectangle?(new Rectangle(0, 0, MidasBackpack.Width, MidasBackpack.Height)), color12, player.bodyRotation, new Vector2((float)(MidasBackpack.Width / 2), (float)(MidasBackpack.Height / 2)), 1f, spriteEffects, 0); value.shader = 5; //Set shader as value 5, which is the shader in which the elf melter backpack uses. Main.playerDrawData.Add(value); } }
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { if (eFlames) { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("EtherealFlame"), player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; Main.playerDrawDust.Add(dust); } r *= 0.1f; g *= 0.2f; b *= 0.7f; fullBright = true; } if (nonStopParty && drawInfo.shadow == 0f && Main.rand.NextBool(6)) // checking shadow == 0 helps avoid spawning extra dust because of extra shadow draws. { int dustIndex = Dust.NewDust(drawInfo.position + new Vector2(drawInfo.drawPlayer.width / 2 - 2, -30), 4, 4, 219, 0f, 0f, 100, default(Color), 1f); Dust dust = Main.dust[dustIndex]; dust.velocity.X = Main.rand.NextFloat(-1f, 1f); dust.velocity.Y = Main.rand.NextFloat(-3, -1.5f); dust.scale = 1f + Main.rand.NextFloat(-.030f, .031f); Main.playerDrawDust.Add(dustIndex); } }
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { #region Rampant Bleeding Dust if (RBleed) { if (RBleedStacks <= 5) { if (Main.rand.NextFloat() <= .1f) { Dust.NewDustDirect(player.position - new Vector2(2f, 2f), player.width, player.height, DustID.Blood, 0f, 0f, 0, new Color(255, 255, 255), 1f); } } else if (RBleedStacks > 5 && RBleedStacks <= 10) { if (Main.rand.NextFloat() <= .2f) { Dust.NewDustDirect(player.position - new Vector2(2f, 2f), player.width, player.height, DustID.Blood, 0f, 0f, 0, new Color(255, 255, 255), 1f); } } else if (RBleedStacks > 10 && RBleedStacks <= 20) { if (Main.rand.NextFloat() <= .4f) { Dust.NewDustDirect(player.position - new Vector2(2f, 2f), player.width, player.height, DustID.Blood, 0f, 0f, 0, new Color(255, 255, 255), 1f); } } else if (RBleedStacks > 20) { Dust.NewDustDirect(player.position - new Vector2(2f, 2f), player.width, player.height, DustID.Blood, 0f, 0f, 0, new Color(255, 255, 255), 1f); } } #endregion Rampant Bleeding Dust }
public static DrawData AutonomousOrbData(PlayerDrawInfo drawInfo, string autonomousOrb, int yOffset, float angleInRadians) { Player drawPlayer = drawInfo.drawPlayer; Mod mod = Highlander.Instance; HighlanderPlayer modPlayer = drawPlayer.GetModPlayer <HighlanderPlayer>(); var dye = drawPlayer.dye[0]; // Tick up the hat effect timer modPlayer.hatEffectTime = (short)((modPlayer.hatEffectTime + 1) % 47); short timer = modPlayer.hatEffectTime; float scale = 1f; Texture2D texture = mod.GetTexture(autonomousOrb); int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X); int drawY = (int)(drawInfo.position.Y + yOffset + 70 - Main.screenPosition.Y); int numFrames = 1; int currFrame = 0; if (drawPlayer.mount.Active) { MountData data = drawPlayer.mount._data; Vector2 pos = new Vector2(); pos.Y += data.heightBoost; pos += drawInfo.position; drawX = (int)(pos.X + drawPlayer.width / 2f - Main.screenPosition.X); drawY = (int)(pos.Y + yOffset + 70 - Main.screenPosition.Y); } if (timer <= 14) { //currFrame = 0; drawY -= 0; } else if (timer <= 23) { //currFrame = 1; drawY -= 1; } else if (timer <= 38) { //currFrame = 2; drawY -= 2; } else if (timer <= 47) { //currFrame = 3; drawY -= 1; } Rectangle frame = new Rectangle(0, currFrame * texture.Height / numFrames, texture.Width, texture.Height / numFrames); int cX = (int)(drawPlayer.position.X / 16f); int cY = (int)((drawPlayer.position.Y) / 16f); Color color = Lighting.GetColor(cX, cY, Color.White); return(new DrawData(texture, new Vector2(drawX, drawY), frame, color, angleInRadians, new Vector2(texture.Width / 2f, texture.Height / 2f), scale, SpriteEffects.None, 0)); }
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { if (eFlames) { if (Main.rand.Next(4) == 0 && drawInfo.shadow == 0f) { int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, mod.DustType("EtherealFlame"), player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 100, default(Color), 3f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.8f; Main.dust[dust].velocity.Y -= 0.5f; Main.playerDrawDust.Add(dust); } r *= 0.1f; g *= 0.2f; b *= 0.7f; fullBright = true; } }