diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 4fb6b8ce29..f984f176d0 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -46,6 +46,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Tiles.Ores; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -91,6 +92,9 @@ namespace CalamityMod.CalPlayer } OldPositions[0] = Player.position; + // Tile effects for touching tiles + HandleTileEffects(); + // Hurt the nearest NPC to the mouse if using the burning mouse. if (blazingCursorDamage || blazingCursorVisuals) HandleBlazingMouseEffects(); @@ -484,6 +488,36 @@ namespace CalamityMod.CalPlayer #endregion #region Misc Effects + private void HandleTileEffects() + { + foreach (Point touchedTile in Collision.GetEntityEdgeTiles(Player)) + { + Tile tile = Main.tile[touchedTile]; + if (tile != null && tile.HasTile && tile.HasUnactuatedTile) + { + if (tile.TileType == ModContent.TileType()) + { + //player.AddBuff(ModContent.BuffType(), 2); + Player.AddBuff(BuffID.Electrified, 300); + AuricOre.Animate = true; + Player.RemoveAllGrapplingHooks(); + //if (!Player.immune) + { + var velocity = Vector2.Normalize(Player.Center - touchedTile.ToWorldCoordinates()); + Player.Hurt(PlayerDeathReason.ByCustomReason(Player.name + " was not worthy"), 100, 0); + Player.velocity += velocity * 50f; // Adjust to make it more or less insane + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1")); + } + break; + } + if (tile.TileType == ModContent.TileType()) + { + Player.AddBuff(ModContent.BuffType(), 2); + break; + } + } + } + } private void HandleBlazingMouseEffects() { // The sigil's brightness slowly fades away every frame if not incinerating anything. diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index c61058c0ab..e62e7fb3e6 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.Ores ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Aerialite Ore"); - AddMapEntry(new Color(103, 103, 186), name); + AddMapEntry(new Color(145, 255, 255), name); MineResist = 2f; MinPick = 65; HitSound = SoundID.Tink; diff --git a/Tiles/Ores/AerialiteOreDisenchanted.cs b/Tiles/Ores/AerialiteOreDisenchanted.cs index 8bab128b49..ac5c577e36 100644 --- a/Tiles/Ores/AerialiteOreDisenchanted.cs +++ b/Tiles/Ores/AerialiteOreDisenchanted.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.Ores DustType = 33; //ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Aerialite Ore"); + name.SetDefault("Disenchanted Aerialite Ore"); AddMapEntry(new Color(204, 170, 81), name); MineResist = 2f; MinPick = 65; diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index bd60f48c6a..45d6c82349 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -70,11 +70,11 @@ namespace CalamityMod.Tiles.Ores b = 0.07f; } - public override void FloorVisuals(Player player) - { - player.AddBuff(ModContent.BuffType(), 2); - base.FloorVisuals(player); - } + //public override void FloorVisuals(Player player) + //{ + // player.AddBuff(ModContent.BuffType(), 2); + // base.FloorVisuals(player); + //} public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index 31de72297d..a01967be19 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -1,16 +1,27 @@ using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Tiles.Astral; using Terraria; using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; +using ReLogic.Content; +using Terraria.ObjectData; +using Microsoft.Xna.Framework.Graphics; +using Terraria.DataStructures; namespace CalamityMod.Tiles.Ores { public class AuricOre : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AuricMine", 3); + public static bool Animate; + internal static Texture2D GlowTexture; public override void SetStaticDefaults() { + if (!Main.dedServ) + GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/AuricOreGlow", AssetRequestMode.ImmediateLoad).Value; + AnimationFrameHeight = 270; Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -45,9 +56,67 @@ namespace CalamityMod.Tiles.Ores public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.20f; - g = 0.16f; - b = 0.00f; + if (!Animate) + {return;} + r = 0.48f; + g = 0.80f; + b = 0.93f; + } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + if (!Animate) + {return;} + frameCounter++; + if (frameCounter > 4) + { + frameCounter = 0; + frame++; + if (frame > 7) + { + Animate = false; + frame = 0; + } + } + } + /*public override void FloorVisuals(Player player) + { + //player.AddBuff(ModContent.BuffType(), 2); + player.AddBuff(BuffID.Electrified, 300); + base.FloorVisuals(player); + Animate = true; + player.RemoveAllGrapplingHooks(); + }*/ + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Ores/AuricOreGlow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(225, 255, 255, 255)); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + { + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.IsHalfBlock) + { + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; } } } diff --git a/Tiles/Ores/AuricOre.png b/Tiles/Ores/AuricOre.png index b61dcaafe6..15f0aa2a5e 100644 Binary files a/Tiles/Ores/AuricOre.png and b/Tiles/Ores/AuricOre.png differ diff --git a/Tiles/Ores/AuricOreGlow.png b/Tiles/Ores/AuricOreGlow.png new file mode 100644 index 0000000000..2b8417d30d Binary files /dev/null and b/Tiles/Ores/AuricOreGlow.png differ