Fixed items were always consumed.

Added possibility to add light to tiles.
Updated Shrine Altar's sprite.
This commit is contained in:
FyloZ 2020-07-09 15:47:54 -04:00
parent f106ab2738
commit 57423952bf
14 changed files with 72 additions and 54 deletions

View File

@ -1,7 +1,5 @@
using System; using Decimation.Lib.Buffs;
using Decimation.Lib.Buffs;
using Terraria; using Terraria;
using Terraria.ID;
using Terraria.ModLoader; using Terraria.ModLoader;
namespace Decimation.Content.Buffs.Debuffs namespace Decimation.Content.Buffs.Debuffs
@ -9,7 +7,10 @@ namespace Decimation.Content.Buffs.Debuffs
internal class Hyperthermic : DecimationBuff internal class Hyperthermic : DecimationBuff
{ {
protected override string DisplayName => "Hyperthermic!"; protected override string DisplayName => "Hyperthermic!";
protected override string Description => "Water, water everywhere but not a drop to drink... \nBlock mana potions use \nLowers defense by 10% \nLowers speed by 5%";
protected override string Description =>
"Water, water everywhere but not a drop to drink... \nBlock mana potions use \nLowers defense by 10% \nLowers speed by 5%";
public override bool Debuff => true; public override bool Debuff => true;
protected override void Init() protected override void Init()
@ -36,7 +37,8 @@ namespace Decimation.Content.Buffs.Debuffs
{ {
public override bool CanUseItem(Item item, Player player) public override bool CanUseItem(Item item, Player player)
{ {
return !(player.HasBuff(ModContent.BuffType<Hyperthermic>()) && item.healMana > 0); if (player.HasBuff(ModContent.BuffType<Hyperthermic>()) && item.healMana > 0) return false;
return base.CanUseItem(item, player);
} }
} }
} }

View File

@ -41,7 +41,7 @@ namespace Decimation.Content.Buffs.Debuffs
{ {
return !(item.UseSound != null && item.useStyle == 2); return !(item.UseSound != null && item.useStyle == 2);
} }
return true; return base.CanUseItem(item, player);
} }
} }
} }

View File

@ -42,7 +42,7 @@ namespace Decimation.Content.Buffs.Debuffs
{ {
return !(item.UseSound != null && item.useStyle == 2); return !(item.UseSound != null && item.useStyle == 2);
} }
return true; return base.CanUseItem(item, player);
} }
} }
} }

View File

@ -865,6 +865,7 @@ namespace Decimation.Content
DecimationPlayer modPlayer = player.GetModPlayer<DecimationPlayer>(); DecimationPlayer modPlayer = player.GetModPlayer<DecimationPlayer>();
if (item.type == ItemID.CobaltShield || item.type == ItemID.AnkhShield || if (item.type == ItemID.CobaltShield || item.type == ItemID.AnkhShield ||
item.type == ItemID.PaladinsShield || item.type == ItemID.ObsidianShield) modPlayer.HasShield = true; item.type == ItemID.PaladinsShield || item.type == ItemID.ObsidianShield) modPlayer.HasShield = true;
base.UpdateAccessory(item, player, hideVisual);
} }
} }
} }

View File

@ -142,14 +142,17 @@ namespace Decimation.Content.Items
CursedNPC.DamageBonus = 7; CursedNPC.DamageBonus = 7;
} }
} }
base.UpdateAccessory(item, player, hideVisual);
} }
public override bool CanEquipAccessory(Item item, Player player, int slot) public override bool CanEquipAccessory(Item item, Player player, int slot)
{ {
// Maximize to one cursed item at once // Maximize to one cursed item at once
DecimationPlayer modPlayer = player.GetModPlayer<DecimationPlayer>(); DecimationPlayer modPlayer = player.GetModPlayer<DecimationPlayer>();
return !modPlayer.hasCursedAccessory || if (!modPlayer.hasCursedAccessory ||
modPlayer.hasCursedAccessory && !item.GetGlobalItem<CursedItem>().Cursed; modPlayer.hasCursedAccessory && !item.GetGlobalItem<CursedItem>().Cursed) return true;
return base.CanEquipAccessory(item, player, slot);
} }
public override void NetSend(Item item, BinaryWriter writer) public override void NetSend(Item item, BinaryWriter writer)
@ -272,12 +275,7 @@ namespace Decimation.Content.Items
} }
} }
return false; return base.UseItem(item, player);
}
public override bool ConsumeItem(Item item, Player player)
{
return true;
} }
} }
} }

View File

@ -1,4 +1,6 @@
using Decimation.Lib.Items; using Decimation.Lib.Items;
using Decimation.Lib.Util;
using Terraria.DataStructures;
using Terraria.ModLoader; using Terraria.ModLoader;
namespace Decimation.Content.Items.Placeable.ShrineoftheMoltenOne namespace Decimation.Content.Items.Placeable.ShrineoftheMoltenOne
@ -7,11 +9,14 @@ namespace Decimation.Content.Items.Placeable.ShrineoftheMoltenOne
{ {
protected override string ItemName => "Shrine Altar"; protected override string ItemName => "Shrine Altar";
protected override int Tile => ModContent.TileType<Tiles.ShrineoftheMoltenOne.ShrineAltar>(); protected override int Tile => ModContent.TileType<Tiles.ShrineoftheMoltenOne.ShrineAltar>();
protected override DrawAnimation Animation => new DrawAnimationVertical(5, 6);
protected override void InitPlaceable() protected override void InitPlaceable()
{ {
item.width = 66; item.width = 68;
item.height = 32; item.height = 42;
item.maxStack = 1;
item.rare = Rarity.Red.GetRarityValue();
} }
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 B

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -45,7 +45,7 @@ namespace Decimation.Content.Synergies
Main.projectile[proj].friendly = true; Main.projectile[proj].friendly = true;
} }
return true; return base.UseItem(item, player);
} }
} }

View File

@ -1,37 +1,39 @@
using Decimation.Content.Items; using Decimation.Content.Items.Boss.Arachnus;
using Decimation.Content.Items.Boss.Arachnus;
using Decimation.Content.NPCs.Arachnus; using Decimation.Content.NPCs.Arachnus;
using Decimation.Lib.Tiles;
using Decimation.Lib.Util;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System;
using Terraria; using Terraria;
using Terraria.DataStructures; using Terraria.DataStructures;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader; using Terraria.ModLoader;
using Terraria.ObjectData; using Terraria.ObjectData;
using Terraria.World.Generation;
namespace Decimation.Content.Tiles.ShrineoftheMoltenOne namespace Decimation.Content.Tiles.ShrineoftheMoltenOne
{ {
class ShrineAltar : ModTile class ShrineAltar : DecimationMultiTile
{ {
public override void SetDefaults() public override Color MapColor => new Color(33, 28, 25);
public override int TileItem => ModContent.ItemType<Items.Placeable.ShrineoftheMoltenOne.ShrineAltar>();
public override TileObjectData Style => TileObjectData.Style5x4;
public override int? Height => 3;
public override Point16 Origin => new Point16(2, 1);
public override string Name => "Shrine Altar";
public override int DustType => DustID.LavaMoss;
public override int? AnimationFrameCount => 6;
public override int? AnimationFrameHeight => 54;
public override bool HasLight => true;
private readonly Vector3 _lightColor = LightingUtils.Rgb255ToRgb1(255, 155, 48);
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
{ {
Main.tileSolidTop[Type] = false; r = _lightColor.X;
Main.tileFrameImportant[Type] = true; g = _lightColor.Y;
Main.tileNoAttach[Type] = true; b = _lightColor.Z;
TileObjectData.newTile.CopyFrom(TileObjectData.Style5x4);
TileObjectData.newTile.Height = 2;
TileObjectData.newTile.Origin = new Point16(1, 1);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 };
TileObjectData.addTile(Type);
ModTranslation name = CreateMapEntryName();
name.SetDefault("Shrine Altar");
AddMapEntry(new Color(33, 28, 25), name);
dustType = DustID.LavaMoss;
disableSmartCursor = true;
} }
public override void RightClick(int i, int j) public override bool NewRightClick(int i, int j)
{ {
Player player = Main.LocalPlayer; Player player = Main.LocalPlayer;
Item[] inventory = player.inventory; Item[] inventory = player.inventory;
@ -62,6 +64,8 @@ namespace Decimation.Content.Tiles.ShrineoftheMoltenOne
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<Arachnus>()); NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<Arachnus>());
} }
} }
return inventoryContainAmulet;
} }
public override void MouseOver(int i, int j) public override void MouseOver(int i, int j)
@ -72,11 +76,6 @@ namespace Decimation.Content.Tiles.ShrineoftheMoltenOne
player.showItemIcon2 = ModContent.ItemType<MoltenArachnidsAmulet>(); player.showItemIcon2 = ModContent.ItemType<MoltenArachnidsAmulet>();
} }
public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
Item.NewItem(i * 16, j * 16, 80, 32, ModContent.ItemType<Items.Placeable.ShrineoftheMoltenOne.ShrineAltar>());
}
public override bool CanKillTile(int i, int j, ref bool blockDamaged) public override bool CanKillTile(int i, int j, ref bool blockDamaged)
{ {
return DecimationWorld.downedArachnus; return DecimationWorld.downedArachnus;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -12,7 +12,7 @@ namespace Decimation.Content.Tiles
public override string Name => "Titan Forge"; public override string Name => "Titan Forge";
public override Color MapColor => new Color(104, 140, 183); public override Color MapColor => new Color(104, 140, 183);
public override int DustType => DustID.Iron; public override int DustType => DustID.Iron;
public override int AnimationFrameCount => 8; public override int? AnimationFrameCount => 8;
public override int? AnimationFrameHeight => 54; public override int? AnimationFrameHeight => 54;
public override int TileItem => ModContent.ItemType<Items.Placeable.TitanForge>(); public override int TileItem => ModContent.ItemType<Items.Placeable.TitanForge>();
} }

View File

@ -17,7 +17,6 @@
item.autoReuse = true; item.autoReuse = true;
item.useTurn = true; item.useTurn = true;
InitPlaceable(); InitPlaceable();
item.createTile = Tile; item.createTile = Tile;

View File

@ -40,15 +40,24 @@ namespace Decimation.Lib.Tiles
TileObjectData.newTile.CoordinateHeights = CoordinateHeights; TileObjectData.newTile.CoordinateHeights = CoordinateHeights;
TileObjectData.newTile.CoordinateWidth = CoordinateWidth; TileObjectData.newTile.CoordinateWidth = CoordinateWidth;
TileObjectData.newTile.CoordinatePadding = CoordinatePadding; TileObjectData.newTile.CoordinatePadding = CoordinatePadding;
TileObjectData.newTile.Origin = Origin;
if (AnchorBottom) if (AnchorBottom)
TileObjectData.newTile.AnchorBottom = TileObjectData.newTile.AnchorBottom =
new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width - 1, 0); new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width - 1, 0);
TileObjectData.addTile(Type); TileObjectData.addTile(Type);
// TODO not working
// if (AnimationFrameCount.HasValue && !AnimationFrameHeight.HasValue)
// {
// AnimationFrameHeight = (16 + TileObjectData.newTile.CoordinatePadding) * TileObjectData.newTile.Height;
// }
_width = TileObjectData.newTile.Width * 16; _width = TileObjectData.newTile.Width * 16;
_height = TileObjectData.newTile.Height * 16; _height = TileObjectData.newTile.Height * 16;
} }
public override void KillMultiTile(int i, int j, int frameX, int frameY) public override void KillMultiTile(int i, int j, int frameX, int frameY)
{ {
Item.NewItem(i * 16, j * 16, _width, _height, TileItem); Item.NewItem(i * 16, j * 16, _width, _height, TileItem);

View File

@ -10,11 +10,12 @@ namespace Decimation.Lib.Tiles
public virtual bool SolidTop { get; set; } = false; public virtual bool SolidTop { get; set; } = false;
public virtual bool TilesCanAttach { get; set; } = false; public virtual bool TilesCanAttach { get; set; } = false;
public virtual bool DisableSmartCursor { get; set; } = false; public virtual bool DisableSmartCursor { get; set; } = false;
public virtual bool HasLight { get; } = false;
public virtual float MineResistance { get; set; } = 1f; public virtual float MineResistance { get; set; } = 1f;
public virtual int DustType { get; } = 0; public virtual int DustType { get; } = 0;
public virtual int AnimationFrameCount { get; } = 0; public virtual int? AnimationFrameCount { get; } = null;
public virtual int AnimationFps { get; } = 5; public virtual int AnimationFps { get; } = 5;
public virtual int? AnimationFrameHeight { get; } = null; public virtual int? AnimationFrameHeight { get; set; }
public virtual string Name { get; } = null; public virtual string Name { get; } = null;
public virtual int MinimumPickaxePower { get; set; } = 0; public virtual int MinimumPickaxePower { get; set; } = 0;
@ -26,12 +27,12 @@ namespace Decimation.Lib.Tiles
Main.tileSolid[Type] = Solid; Main.tileSolid[Type] = Solid;
Main.tileSolidTop[Type] = SolidTop; Main.tileSolidTop[Type] = SolidTop;
Main.tileNoAttach[Type] = !TilesCanAttach; Main.tileNoAttach[Type] = !TilesCanAttach;
Main.tileLighted[Type] = HasLight;
minPick = MinimumPickaxePower; minPick = MinimumPickaxePower;
mineResist = MineResistance; mineResist = MineResistance;
dustType = DustType; dustType = DustType;
drop = TileItem; drop = TileItem;
disableSmartCursor = DisableSmartCursor; disableSmartCursor = DisableSmartCursor;
if (AnimationFrameHeight.HasValue) animationFrameHeight = AnimationFrameHeight.Value;
if (Name == null) if (Name == null)
{ {
@ -45,6 +46,8 @@ namespace Decimation.Lib.Tiles
} }
InitTile(); InitTile();
if (AnimationFrameHeight.HasValue) animationFrameHeight = AnimationFrameHeight.Value;
} }
public override void NumDust(int i, int j, bool fail, ref int num) public override void NumDust(int i, int j, bool fail, ref int num)
@ -54,6 +57,8 @@ namespace Decimation.Lib.Tiles
public override void AnimateTile(ref int frame, ref int frameCounter) public override void AnimateTile(ref int frame, ref int frameCounter)
{ {
if (!AnimationFrameCount.HasValue) return;
frameCounter++; frameCounter++;
if (frameCounter > AnimationFps) if (frameCounter > AnimationFps)
{ {