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.ID;
using Terraria.ModLoader;
namespace Decimation.Content.Buffs.Debuffs
@ -9,7 +7,10 @@ namespace Decimation.Content.Buffs.Debuffs
internal class Hyperthermic : DecimationBuff
{
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;
protected override void Init()
@ -21,13 +22,13 @@ namespace Decimation.Content.Buffs.Debuffs
public override void Update(Player player, ref int buffIndex)
{
player.statDefense = (int)(player.statDefense * 0.90f);
player.statDefense = (int) (player.statDefense * 0.90f);
player.moveSpeed *= 0.95f;
}
public override void Update(NPC npc, ref int buffIndex)
{
npc.defense = (int)(npc.defense * 0.90f);
npc.defense = (int) (npc.defense * 0.90f);
npc.velocity *= 0.95f;
}
}
@ -36,7 +37,8 @@ namespace Decimation.Content.Buffs.Debuffs
{
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 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 true;
return base.CanUseItem(item, player);
}
}
}

View File

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

View File

@ -1,4 +1,6 @@
using Decimation.Lib.Items;
using Decimation.Lib.Util;
using Terraria.DataStructures;
using Terraria.ModLoader;
namespace Decimation.Content.Items.Placeable.ShrineoftheMoltenOne
@ -7,11 +9,14 @@ namespace Decimation.Content.Items.Placeable.ShrineoftheMoltenOne
{
protected override string ItemName => "Shrine Altar";
protected override int Tile => ModContent.TileType<Tiles.ShrineoftheMoltenOne.ShrineAltar>();
protected override DrawAnimation Animation => new DrawAnimationVertical(5, 6);
protected override void InitPlaceable()
{
item.width = 66;
item.height = 32;
item.width = 68;
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;
}
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.Lib.Tiles;
using Decimation.Lib.Util;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.World.Generation;
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;
Main.tileFrameImportant[Type] = true;
Main.tileNoAttach[Type] = true;
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;
r = _lightColor.X;
g = _lightColor.Y;
b = _lightColor.Z;
}
public override void RightClick(int i, int j)
public override bool NewRightClick(int i, int j)
{
Player player = Main.LocalPlayer;
Item[] inventory = player.inventory;
@ -51,17 +53,19 @@ namespace Decimation.Content.Tiles.ShrineoftheMoltenOne
if (Main.netMode == 1)
{
ModPacket packet = mod.GetPacket();
packet.Write((byte)DecimationModMessageType.SpawnBoss);
packet.Write((byte) DecimationModMessageType.SpawnBoss);
packet.Write(ModContent.NPCType<Arachnus>());
packet.Write(player.whoAmI);
packet.Send();
}
else if (Main.netMode == 0)
{
Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
Main.PlaySound(15, (int) player.position.X, (int) player.position.Y, 0);
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<Arachnus>());
}
}
return inventoryContainAmulet;
}
public override void MouseOver(int i, int j)
@ -72,14 +76,9 @@ namespace Decimation.Content.Tiles.ShrineoftheMoltenOne
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)
{
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 Color MapColor => new Color(104, 140, 183);
public override int DustType => DustID.Iron;
public override int AnimationFrameCount => 8;
public override int? AnimationFrameCount => 8;
public override int? AnimationFrameHeight => 54;
public override int TileItem => ModContent.ItemType<Items.Placeable.TitanForge>();
}

View File

@ -16,7 +16,6 @@
item.useStyle = 1;
item.autoReuse = true;
item.useTurn = true;
InitPlaceable();

View File

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

View File

@ -10,11 +10,12 @@ namespace Decimation.Lib.Tiles
public virtual bool SolidTop { get; set; } = false;
public virtual bool TilesCanAttach { 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 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? AnimationFrameHeight { get; } = null;
public virtual int? AnimationFrameHeight { get; set; }
public virtual string Name { get; } = null;
public virtual int MinimumPickaxePower { get; set; } = 0;
@ -26,12 +27,12 @@ namespace Decimation.Lib.Tiles
Main.tileSolid[Type] = Solid;
Main.tileSolidTop[Type] = SolidTop;
Main.tileNoAttach[Type] = !TilesCanAttach;
Main.tileLighted[Type] = HasLight;
minPick = MinimumPickaxePower;
mineResist = MineResistance;
dustType = DustType;
drop = TileItem;
disableSmartCursor = DisableSmartCursor;
if (AnimationFrameHeight.HasValue) animationFrameHeight = AnimationFrameHeight.Value;
if (Name == null)
{
@ -45,6 +46,8 @@ namespace Decimation.Lib.Tiles
}
InitTile();
if (AnimationFrameHeight.HasValue) animationFrameHeight = AnimationFrameHeight.Value;
}
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)
{
if (!AnimationFrameCount.HasValue) return;
frameCounter++;
if (frameCounter > AnimationFps)
{