Decimation_Mod/Content/Tiles/ShrineoftheMoltenOne/RedHotSpike.cs

57 lines
2.0 KiB
C#

using Decimation.Content.Buffs.Buffs;
using Decimation.Content.Buffs.Debuffs;
using Decimation.Lib.Tiles;
using Decimation.Lib.Util;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;
namespace Decimation.Content.Tiles.ShrineoftheMoltenOne
{
class RedHotSpike : DecimationFramedTile
{
public override Color MapColor => new Color(196, 35, 0);
public override int TileItem => ModContent.ItemType<Items.Placeable.ShrineoftheMoltenOne.RedHotSpike>();
public override int DustType => DustID.Stone;
public override bool MergeDirt => true;
public override bool HasLight => true;
private readonly Vector3 _lightColor = LightingUtils.Rgb255ToRgb1(255, 155, 48);
protected override void InitFramedTile()
{
TileID.Sets.DrawsWalls[Type] = true;
TileID.Sets.NotReallySolid[Type] = true;
}
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
{
r = _lightColor.X;
g = _lightColor.Y;
b = _lightColor.Z;
}
public override bool Dangersense(int i, int j, Player player) => true;
public override void NearbyEffects(int i, int j, bool closer)
{
Player player = Main.LocalPlayer;
float playerX = player.position.X;
float playerY = player.position.Y;
if (playerX / 16 - i <= 2 && playerX / 16 - i >= -2 && playerY / 16 - j <= 2 && playerY / 16 - j >= -4.3f)
player.AddBuff(ModContent.BuffType<Singed>(), 300);
if (playerX / 16 - i <= 1 && playerX / 16 - i >= -1.25f && playerY / 16 - j <= 1.1f && playerY / 16 - j >= -3.3f)
player.Hurt(PlayerDeathReason.LegacyDefault(), 100, 0);
}
public override bool CanKillTile(int i, int j, ref bool blockDamaged)
{
return DecimationWorld.downedArachnus;
}
}
}