Skip to content

Commit

Permalink
finish wyvern campfire
Browse files Browse the repository at this point in the history
  • Loading branch information
direwolf420 committed Sep 8, 2019
1 parent 823efee commit 31f8c0b
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 19 deletions.
19 changes: 19 additions & 0 deletions Base/AssExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using AssortedCrazyThings.NPCs.CuteSlimes;
using Microsoft.Xna.Framework;

namespace AssortedCrazyThings.Base
{
/// <summary>
/// contains Extensions for some basic tasks
/// </summary>
public static class AssExtensions
{
/// <summary>
/// Returns the average value between the RGB (ignoring A)
/// </summary>
public static float GetAverage(this Color color)
{
return (color.R + color.G + color.B) / 3f;
}
}
}
9 changes: 7 additions & 2 deletions Dusts/GlitterDust.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Terraria;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace AssortedCrazyThings.Dusts
Expand All @@ -8,7 +9,6 @@ namespace AssortedCrazyThings.Dusts
/// </summary>
public abstract class GlitterDustBase : ModDust
{

public override void OnSpawn(Dust dust)
{
//dust.velocity *= 0.4f;
Expand All @@ -28,6 +28,11 @@ public override bool Update(Dust dust)
}
return false;
}

public override Color? GetAlpha(Dust dust, Color lightColor)
{
return Color.White * ((255f - dust.alpha) / 255f);
}
}

public class GlitterDust15 : GlitterDustBase { }
Expand Down
2 changes: 1 addition & 1 deletion Items/Accessories/Useful/EverburningCandelabra.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class EverburningCandelabra : ModItem
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Everburning Candelabra");
Tooltip.SetDefault("Inflicts various forms of fire damage on all attacks");
Tooltip.SetDefault("Applies various forms of fire damage to all attacks");
}

public override void SetDefaults()
Expand Down
2 changes: 1 addition & 1 deletion Items/Accessories/Useful/EverburningCandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class EverburningCandle : ModItem
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Everburning Candle");
Tooltip.SetDefault("Inflicts fire damage on all attacks");
Tooltip.SetDefault("Applies fire damage to all attacks");
}

public override void SetDefaults()
Expand Down
2 changes: 1 addition & 1 deletion Items/Accessories/Useful/EverburningCursedCandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class EverburningCursedCandle : ModItem
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Everburning Cursed Candle");
Tooltip.SetDefault("Inflicts cursed fire damage on all attacks");
Tooltip.SetDefault("Applies cursed fire damage to all attacks");
}

public override void SetDefaults()
Expand Down
2 changes: 1 addition & 1 deletion Items/Accessories/Useful/EverburningShadowflameCandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class EverburningShadowflameCandle : ModItem
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Everburning Shadowflame Candle");
Tooltip.SetDefault("Inflicts shadowflame damage on all attacks");
Tooltip.SetDefault("Applies shadowflame damage to all attacks");
}

public override void SetDefaults()
Expand Down
2 changes: 1 addition & 1 deletion Items/Accessories/Useful/EverfrozenCandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class EverfrozenCandle : ModItem
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Everfrozen Candle");
Tooltip.SetDefault("Inflicts frostburn damage on all attacks");
Tooltip.SetDefault("Applies frostburn damage to all attacks");
}

public override void SetDefaults()
Expand Down
15 changes: 12 additions & 3 deletions Items/Placeable/WyvernCampfireItem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using AssortedCrazyThings.Tiles;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AssortedCrazyThings.Items.Placeable
Expand All @@ -14,8 +15,8 @@ public override void SetStaticDefaults()

public override void SetDefaults()
{
item.width = 28;
item.height = 28;
item.width = 32;
item.height = 18;
item.maxStack = 99;
item.useTurn = true;
item.autoReuse = true;
Expand All @@ -28,6 +29,14 @@ public override void SetDefaults()
item.createTile = mod.TileType<WyvernCampfireTile>();
}

//TODO wyvern recipe
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.anyWood = true;
recipe.AddIngredient(ItemID.Wood, 10);
recipe.AddIngredient(mod.ItemType<CaughtDungeonSoulFreed>(), 5);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file modified Items/Placeable/WyvernCampfireItem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public override void SetDefaults()
public override Color? GetAlpha(Color lightColor)
{
if (Color == default(Color)) return lightColor;
float average = (lightColor.R + lightColor.G + lightColor.B) / 3;
float average = lightColor.GetAverage();
return Color * (average * (255 - projectile.alpha) / 65025f) * 0.7f;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AssortedCrazyThings.Items.Weapons;
using AssortedCrazyThings.Base;
using AssortedCrazyThings.Items.Weapons;
using AssortedCrazyThings.Projectiles.Pets;
using Microsoft.Xna.Framework;
using System.IO;
Expand Down Expand Up @@ -97,7 +98,7 @@ public override void Kill(int timeLeft)
public override Color? GetAlpha(Color lightColor)
{
if (Color == default(Color)) return lightColor;
float average = (lightColor.R + lightColor.G + lightColor.B) / 3;
float average = lightColor.GetAverage();
Color color = Color * PulsatingAlpha * (average / 255f);
if (color.A > 220) color.A = 220;
return color;
Expand Down
1 change: 1 addition & 0 deletions Tiles/SlimeBeaconTile.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using AssortedCrazyThings.Items.Placeable;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
Expand Down
45 changes: 39 additions & 6 deletions Tiles/WyvernCampfireTile.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AssortedCrazyThings.Items.Placeable;
using AssortedCrazyThings.Base;
using AssortedCrazyThings.Items.Placeable;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
Expand Down Expand Up @@ -105,7 +106,37 @@ public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
animate = Main.tileFrame[Type] * animationFrameHeight;
}
Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(tile.frameX, tile.frameY + animate, 16, height), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
Color color = Lighting.GetColor(i, j);
Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero;
pos.Y += 2;
Rectangle frame = new Rectangle(tile.frameX, tile.frameY + animate, 16, height);
Main.spriteBatch.Draw(texture, pos, frame, color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);

texture = null;
Color transparent = Color.Transparent;
if (TileID.Sets.HasOutlines[Type] && Collision.InTileBounds(i, j, Main.TileInteractionLX, Main.TileInteractionLY, Main.TileInteractionHX, Main.TileInteractionHY) && Main.SmartInteractTileCoords.Contains(new Point(i, j)))
{
int average = (int)color.GetAverage();
bool selected = false;
if (Main.SmartInteractTileCoordsSelected.Contains(new Point(i, j)))
{
selected = true;
}
if (average > 10)
{
texture = Main.highlightMaskTexture[Type];
if (selected)
{
transparent = new Color(average, average, average / 3, average);
}
else
{
transparent = new Color(average / 2, average / 2, average / 2, average);
}
}
if (texture != null) Main.spriteBatch.Draw(texture, pos, frame, transparent, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);

}

if (tile.frameY == 0 && Main.rand.NextBool() && !Main.gamePaused && Main.instance.IsActive && (!Lighting.UpdateEveryFrame || Main.rand.NextBool(4)))
{
Expand Down Expand Up @@ -142,17 +173,19 @@ public override void HitWire(int i, int j)
change = -animationFrameHeight;
}

Tile tile;
for (int l = x; l < x + 3; l++)
{
for (int m = y; m < y + 2; m++)
{
if (Main.tile[l, m] == null)
tile = Main.tile[l, m];
if (tile == null)
{
Main.tile[l, m] = new Tile();
tile = new Tile();
}
if (Main.tile[l, m].active() && Main.tile[l, m].type == Type)
if (tile.active() && tile.type == Type)
{
Main.tile[l, m].frameY = (short)(Main.tile[l, m].frameY + change);
tile.frameY = (short)(tile.frameY + change);
}
}
}
Expand Down
Binary file modified Tiles/WyvernCampfireTile_Highlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 31f8c0b

Please sign in to comment.