Made spell books have a color associated with them, and have it where this is now a particle effect system. Needs to be ported to it's own Sun Drop Mod

This commit is contained in:
Joshua Navarro 2017-02-24 21:52:57 -08:00
parent da0edd662a
commit 2a76f772f9
11 changed files with 214 additions and 88 deletions

View File

@ -0,0 +1,131 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewModdingAPI;
using StardewValley;
using System;
using System.Collections.Generic;
namespace Revitalize.Aesthetics
{
public class WeatherDebrisPlus
{
public Rectangle sourceRect;
public bool blowing;
private Vector2 position;
private int which;
private float dx;
private float dy;
private int animationIntervalOffset;
public WeatherDebrisPlus(Vector2 position,Rectangle SourceRect, int animationOffset, int which, float rotationVelocity, float dx, float dy)
{
this.position = position;
this.which = which;
this.dx = dx;
this.dy = dy;
sourceRect = SourceRect;
animationIntervalOffset = animationOffset;
}
public WeatherDebrisPlus(Vector2 position, Rectangle SourceRect, int animationOffset, int which, float rotationVelocity, float dx, float dy,bool yup)
{
this.position = position;
this.which = which;
this.dx = dx;
this.dy = dy;
// sourceRect = SourceRect;
animationIntervalOffset = animationOffset;
Log.AsyncC(this.dx);
Log.AsyncC(this.dy);
switch (which)
{
case 0:
this.sourceRect = new Rectangle(352, 1184, 16, 16);
this.animationIntervalOffset = (Game1.random.Next(25) - 12) * 2;
return;
case 1:
this.sourceRect = new Rectangle(352, 1200, 16, 16);
this.animationIntervalOffset = (Game1.random.Next(25) - 12) * 2;
return;
case 2:
this.sourceRect = new Rectangle(352, 1216, 16, 16);
this.animationIntervalOffset = (Game1.random.Next(25) - 12) * 2;
return;
case 3:
this.sourceRect = new Rectangle(391 + 4 * Game1.random.Next(5), 1236, 4, 4);
return;
case 4:
this.sourceRect = new Rectangle(338, 400, 8, 8);
return;
default:
return;
}
}
public new void update()
{
this.update(false);
}
public new void update(bool slow)
{
this.position.X = this.position.X + (this.dx + (slow ? 0f : WeatherDebris.globalWind));
this.position.Y = this.position.Y + (this.dy - (slow ? 0f : -0.5f));
if (this.dy < 0f && !this.blowing)
{
this.dy += 0.01f;
}
if (!Game1.fadeToBlack && Game1.fadeToBlackAlpha <= 0f)
{
if (this.position.X < (float)(-(float)Game1.tileSize - Game1.tileSize / 4))
{
this.position.X = (float)Game1.viewport.Width;
this.position.Y = (float)Game1.random.Next(0, Game1.viewport.Height - Game1.tileSize);
}
if (this.position.Y > (float)(Game1.viewport.Height + Game1.tileSize / 4))
{
this.position.X = (float)Game1.random.Next(0, Game1.viewport.Width);
this.position.Y = (float)(-(float)Game1.tileSize);
this.dy = (float)Game1.random.Next(-15, 10) / (slow ? ((Game1.random.NextDouble() < 0.1) ? 5f : 200f) : 50f);
this.dx = (float)Game1.random.Next(-10, 0) / (slow ? 200f : 50f);
}
else if (this.position.Y < (float)(-(float)Game1.tileSize))
{
this.position.Y = (float)Game1.viewport.Height;
this.position.X = (float)Game1.random.Next(0, Game1.viewport.Width);
}
}
if (this.blowing)
{
this.dy -= 0.01f;
if (Game1.random.NextDouble() < 0.006 || this.dy < -2f)
{
this.blowing = false;
}
}
else if (!slow && Game1.random.NextDouble() < 0.001 && Game1.currentSeason != null && (Game1.currentSeason.Equals("spring") || Game1.currentSeason.Equals("summer")))
{
this.blowing = true;
}
}
public void draw(SpriteBatch b)
{
b.Draw(Game1.mouseCursors, this.position, new Rectangle?(this.sourceRect), Color.White, 0f, Vector2.Zero, 3f, SpriteEffects.None, 1E-06f);
}
}
}

View File

@ -25,6 +25,7 @@ using Microsoft.Xna.Framework.Input;
using xTile; using xTile;
using Revitalize.Persistance; using Revitalize.Persistance;
using Revitalize.Draw; using Revitalize.Draw;
using Revitalize.Aesthetics;
namespace Revitalize namespace Revitalize
{ {
@ -77,6 +78,8 @@ namespace Revitalize
StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick; StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick;
StardewModdingAPI.Events.GraphicsEvents.OnPreRenderHudEvent += GraphicsEvents_OnPreRenderHudEvent; StardewModdingAPI.Events.GraphicsEvents.OnPreRenderHudEvent += GraphicsEvents_OnPreRenderHudEvent;
StardewModdingAPI.Events.GraphicsEvents.OnPostRenderHudEvent += draw;
//StardewModdingAPI.Events.TimeEvents.DayOfMonthChanged += Util.WaterAllCropsInAllLocations; //StardewModdingAPI.Events.TimeEvents.DayOfMonthChanged += Util.WaterAllCropsInAllLocations;
@ -89,6 +92,14 @@ namespace Revitalize
Log.AsyncG("Revitalize: Running on API Version: " +StardewModdingAPI.Constants.ApiVersion); Log.AsyncG("Revitalize: Running on API Version: " +StardewModdingAPI.Constants.ApiVersion);
} }
private void draw(object sender, EventArgs e)
{
foreach(WeatherDebrisPlus w in Lists.thisWeatherDebris)
{
w.draw(Game1.spriteBatch);
}
}
private void GraphicsEvents_OnPreRenderHudEvent(object sender, EventArgs e) private void GraphicsEvents_OnPreRenderHudEvent(object sender, EventArgs e)
{ {
if (gameLoaded == true) if (gameLoaded == true)
@ -130,6 +141,12 @@ namespace Revitalize
Lists.loadAllLists(); Lists.loadAllLists();
Util.WaterAllCropsInAllLocations(); Util.WaterAllCropsInAllLocations();
} }
foreach(WeatherDebrisPlus w in Lists.thisWeatherDebris)
{
// Log.AsyncM("COUNT" + Lists.thisWeatherDebris.Count);
w.update();
}
} }
@ -296,7 +313,9 @@ namespace Revitalize
objShopList.Add(new StardewValley.Object(497, 1)); objShopList.Add(new StardewValley.Object(497, 1));
objShopList.Add(new StardewValley.Object(498, 1)); objShopList.Add(new StardewValley.Object(498, 1));
objShopList.Add(new StardewValley.Object(770, 1)); objShopList.Add(new StardewValley.Object(770, 1));
objShopList.Add(new Spell(0, Vector2.Zero, new Resources.DataNodes.SpellFunctionDataNode(new Spell.spellFunction(Magic.MagicFunctions.showRedMessage),1))); Spell k;
Dictionaries.spellList.TryGetValue(0, out k);
objShopList.Add(k);
foreach (var v in objShopList) foreach (var v in objShopList)
{ {
newInventory.Add(v); newInventory.Add(v);
@ -334,13 +353,30 @@ namespace Revitalize
if (e.KeyPressed.ToString() == "V") if (e.KeyPressed.ToString() == "V")
{ {
// Game1.showEndOfNightStuff(); newDebris();
Magic.MagicMonitor.consumeMagic(5);
} }
} }
public void newDebris()
{
// Game1.debrisWeather.Add(new WeatherDebris(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), 0, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f));
// Game1.debrisWeather.Add(new WeatherDebrisPlus(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), new Rectangle(338, 400, 8, 8),0,999, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f));
// WeatherDebris w = new WeatherDebris();
// Game1.debrisWeather.Add(new WeatherDebris(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), 0, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f));
// WeatherDebris w = new WeatherDebris(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), 0, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f);
WeatherDebrisPlus w= new WeatherDebrisPlus(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), new Rectangle(338, 400, 8, 8), 0, 4, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f,true);
Lists.thisWeatherDebris.Add(w);
Game1.isDebrisWeather = true;
// Game1.updateDebrisWeatherForMovement(Game1.debrisWeather);
// Game1.windGust = 0.15f;
Log.AsyncC("WIND");
}
} }
} }

View File

@ -26,7 +26,8 @@ namespace Revitalize.Objects
public int spellCostModifierInt; public int spellCostModifierInt;
public float spellCostModifierPercent; public float spellCostModifierPercent;
public Color bookColor;
public int spellIndex;
public override string Name public override string Name
{ {
get get
@ -48,6 +49,7 @@ namespace Revitalize.Objects
lightsOn = false; lightsOn = false;
lightColor = Color.Black; lightColor = Color.Black;
thisType = this.GetType(); thisType = this.GetType();
} }
public Spell() public Spell()
@ -56,10 +58,11 @@ namespace Revitalize.Objects
} }
public Spell(int which, Vector2 Tile, SpellFunctionDataNode spellFunction, int InventoryMaxSize = 0, bool isRemovable = true) public Spell(int which,Vector2 Tile, SpellFunctionDataNode spellFunction, Color tomeColor,int textureIndex=0, int InventoryMaxSize = 0, bool isRemovable = true)
{ {
InitializeBasics(InventoryMaxSize, Tile); InitializeBasics(InventoryMaxSize, Tile);
spellIndex = which;
bookColor = tomeColor;
magicToCast.Add(spellFunction); magicToCast.Add(spellFunction);
removable = isRemovable; removable = isRemovable;
this.lightColor = Color.Black; this.lightColor = Color.Black;
@ -117,7 +120,7 @@ namespace Revitalize.Objects
this.updateDrawPosition(); this.updateDrawPosition();
this.rotations = Convert.ToInt32(array[4]); this.rotations = Convert.ToInt32(array[4]);
this.price = Convert.ToInt32(array[5]); this.price = Convert.ToInt32(array[5]);
this.parentSheetIndex = which; this.parentSheetIndex = textureIndex ;
try try
{ {
@ -135,9 +138,10 @@ namespace Revitalize.Objects
} }
public Spell(int which, Vector2 Tile, List<SpellFunctionDataNode> spellFunctions, int InventoryMaxSize = 0, bool isRemovable = true) public Spell(int which, Vector2 Tile, List<SpellFunctionDataNode> spellFunctions,Color tomeColor,int textureIndex=0, int InventoryMaxSize = 0, bool isRemovable = true)
{ {
bookColor = tomeColor;
spellIndex = which;
InitializeBasics(InventoryMaxSize, Tile); InitializeBasics(InventoryMaxSize, Tile);
foreach(var v in spellFunctions) { foreach(var v in spellFunctions) {
@ -200,7 +204,7 @@ namespace Revitalize.Objects
this.updateDrawPosition(); this.updateDrawPosition();
this.rotations = Convert.ToInt32(array[4]); this.rotations = Convert.ToInt32(array[4]);
this.price = Convert.ToInt32(array[5]); this.price = Convert.ToInt32(array[5]);
this.parentSheetIndex = which; this.parentSheetIndex = textureIndex;
try try
{ {
@ -276,25 +280,18 @@ namespace Revitalize.Objects
//DONT USE THIS BASE IT IS TERRIBLE //DONT USE THIS BASE IT IS TERRIBLE
public override bool clicked(Farmer who) public override bool clicked(Farmer who)
{ {
// castMagic();
// Game1.showRedMessage("THIS IS CLICKED!!!");
//var mState = Microsoft.Xna.Framework.Input.Mouse.GetState();
if (removable == false) return false; if (removable == false) return false;
Game1.haltAfterCheck = false; Game1.haltAfterCheck = false;
if (this.Decoration_type == 11 && who.ActiveObject != null && who.ActiveObject != null && this.heldObject == null) if (this.Decoration_type == 11 && who.ActiveObject != null && who.ActiveObject != null && this.heldObject == null)
{ {
// Game1.showRedMessage("Why1?");
return false; return false;
} }
if (this.heldObject == null && (who.ActiveObject == null || !(who.ActiveObject is Spell))) if (this.heldObject == null && (who.ActiveObject == null || !(who.ActiveObject is Spell)))
{ {
if (Game1.player.currentLocation is FarmHouse) if (Game1.player.currentLocation is FarmHouse)
{ {
//
Util.addItemToInventoryAndCleanTrackedList(this); Util.addItemToInventoryAndCleanTrackedList(this);
removeLights(this.thisLocation); removeLights(this.thisLocation);
this.lightsOn = false; this.lightsOn = false;
@ -305,8 +302,6 @@ namespace Revitalize.Objects
} }
else else
{ {
// return true;
// this.heldObject = new Spell(parentSheetIndex, Vector2.Zero, this.lightColor, this.inventoryMaxSize);
Util.addItemToInventoryAndCleanTrackedList(this); Util.addItemToInventoryAndCleanTrackedList(this);
removeLights(this.thisLocation); removeLights(this.thisLocation);
this.lightsOn = false; this.lightsOn = false;
@ -318,8 +313,6 @@ namespace Revitalize.Objects
} }
if (this.heldObject != null && who.addItemToInventoryBool(this.heldObject, false)) if (this.heldObject != null && who.addItemToInventoryBool(this.heldObject, false))
{ {
// Game1.showRedMessage("Why3?");
// if(this.heldObject!=null) Game1.player.addItemByMenuIfNecessary((Item)this.heldObject);
Util.addItemToInventoryAndCleanTrackedList(this); Util.addItemToInventoryAndCleanTrackedList(this);
this.heldObject.performRemoveAction(this.tileLocation, who.currentLocation); this.heldObject.performRemoveAction(this.tileLocation, who.currentLocation);
this.heldObject = null; this.heldObject = null;
@ -330,64 +323,12 @@ namespace Revitalize.Objects
return true; return true;
} }
return false; return false;
} }
public virtual bool RightClicked(Farmer who) public virtual bool RightClicked(Farmer who)
{ {
// castMagic();
// Game1.showRedMessage("THIS IS CLICKED!!!");
//var mState = Microsoft.Xna.Framework.Input.Mouse.GetState();
/*
Game1.haltAfterCheck = false;
if (this.Decoration_type == 11 && who.ActiveObject != null && who.ActiveObject != null && this.heldObject == null)
{
// Game1.showRedMessage("Why1?");
return false;
}
if (this.heldObject == null && (who.ActiveObject == null || !(who.ActiveObject is Spell)))
{
if (Game1.player.currentLocation is FarmHouse)
{
//
Game1.player.addItemByMenuIfNecessary(this);
removeLights(this.thisLocation);
this.lightsOn = false;
Game1.playSound("coin");
// this.flaggedForPickUp = true;
return true;
}
else
{
// return true;
// this.heldObject = new Spell(parentSheetIndex, Vector2.Zero, this.lightColor, this.inventoryMaxSize);
Game1.player.addItemByMenuIfNecessary(this);
removeLights(this.thisLocation);
this.lightsOn = false;
Game1.playSound("coin");
return true;
}
}
if (this.heldObject != null && who.addItemToInventoryBool(this.heldObject, false))
{
// Game1.showRedMessage("Why3?");
// if(this.heldObject!=null) Game1.player.addItemByMenuIfNecessary((Item)this.heldObject);
Util.addItemToInventoryElseDrop(this);
this.heldObject.performRemoveAction(this.tileLocation, who.currentLocation);
this.heldObject = null;
Game1.playSound("coin");
removeLights(this.thisLocation);
this.lightsOn = false;
return true;
}
*/
return false; return false;
} }
@ -1056,7 +997,7 @@ namespace Revitalize.Objects
public override void drawWhenHeld(SpriteBatch spriteBatch, Vector2 objectPosition, Farmer f) public override void drawWhenHeld(SpriteBatch spriteBatch, Vector2 objectPosition, Farmer f)
{ {
spriteBatch.Draw(this.TextureSheet, objectPosition, new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f)); spriteBatch.Draw(this.TextureSheet, objectPosition, new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), this.bookColor, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
if (f.ActiveObject != null && f.ActiveObject.Name.Contains("=")) if (f.ActiveObject != null && f.ActiveObject.Name.Contains("="))
{ {
spriteBatch.Draw(Game1.objectSpriteSheet, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f)); spriteBatch.Draw(Game1.objectSpriteSheet, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
@ -1074,18 +1015,19 @@ namespace Revitalize.Objects
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber) public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber)
{ {
spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * this.getScaleSize() * scaleSize, SpriteEffects.None, layerDepth);
spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect),this.bookColor, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * this.getScaleSize() * scaleSize, SpriteEffects.None, layerDepth);
} }
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f) public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
{ {
if (x == -1) if (x == -1)
{ {
spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, this.drawPosition), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f)); spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, this.drawPosition), new Rectangle?(this.sourceRect), this.bookColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
} }
else else
{ {
spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), (float)(y * Game1.tileSize - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)))), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f)); spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), (float)(y * Game1.tileSize - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)))), new Rectangle?(this.sourceRect), this.bookColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
} }
if (this.heldObject != null) if (this.heldObject != null)
{ {
@ -1094,19 +1036,20 @@ namespace Revitalize.Objects
(this.heldObject as Spell).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - (this.heldObject as Spell).sourceRect.Height * Game1.pixelZoom - Game1.tileSize / 4))), (float)(this.boundingBox.Bottom - 7) / 10000f, alpha); (this.heldObject as Spell).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - (this.heldObject as Spell).sourceRect.Height * Game1.pixelZoom - Game1.tileSize / 4))), (float)(this.boundingBox.Bottom - 7) / 10000f, alpha);
return; return;
} }
spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 5 / 6)), new Rectangle?(Game1.shadowTexture.Bounds), Color.White * alpha, 0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)this.boundingBox.Bottom / 10000f); spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 5 / 6)), new Rectangle?(Game1.shadowTexture.Bounds), this.bookColor * alpha, 0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)this.boundingBox.Bottom / 10000f);
spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))), new Rectangle?(Game1.currentLocation.getSourceRectForObject(this.heldObject.ParentSheetIndex)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.boundingBox.Bottom + 1) / 10000f); spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))), new Rectangle?(Game1.currentLocation.getSourceRectForObject(this.heldObject.ParentSheetIndex)), this.bookColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.boundingBox.Bottom + 1) / 10000f);
} }
} }
public override void drawAtNonTileSpot(SpriteBatch spriteBatch, Vector2 location, float layerDepth, float alpha = 1f) public override void drawAtNonTileSpot(SpriteBatch spriteBatch, Vector2 location, float layerDepth, float alpha = 1f)
{ {
spriteBatch.Draw(TextureSheet, location, new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth); spriteBatch.Draw(TextureSheet, location, new Rectangle?(this.sourceRect), this.bookColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
} }
public override Item getOne() public override Item getOne()
{ {
Spell Spell = new Spell(this.parentSheetIndex, this.tileLocation, magicToCast , this.inventoryMaxSize); Spell Spell = new Spell(this.spellIndex, this.tileLocation, magicToCast ,this.bookColor, this.parentSheetIndex);
Log.AsyncG(this.bookColor);
/* /*
drawPosition = this.drawPosition; drawPosition = this.drawPosition;
defaultBoundingBox = this.defaultBoundingBox; defaultBoundingBox = this.defaultBoundingBox;

View File

@ -27,6 +27,8 @@ namespace Revitalize.Resources
public static Dictionary<string, SeedDataNode> seedList; public static Dictionary<string, SeedDataNode> seedList;
public static Dictionary<int, Spell> spellList; public static Dictionary<int, Spell> spellList;
public static Dictionary<string, WeatherDebris> weatherDebrisDictionary;
public static void initializeDictionaries() public static void initializeDictionaries()
{ {
acceptedTypes = new Dictionary<string, SerializerDataNode>(); acceptedTypes = new Dictionary<string, SerializerDataNode>();
@ -34,6 +36,7 @@ namespace Revitalize.Resources
interactionTypes = new Dictionary<string, interactFunction>(); interactionTypes = new Dictionary<string, interactFunction>();
seedList = new Dictionary<string, SeedDataNode>(); seedList = new Dictionary<string, SeedDataNode>();
spellList = new Dictionary<int, Spell>(); spellList = new Dictionary<int, Spell>();
weatherDebrisDictionary = new Dictionary<string, WeatherDebris>();
fillAllDictionaries(); fillAllDictionaries();
} }
@ -44,6 +47,7 @@ namespace Revitalize.Resources
fillQuaryList(); fillQuaryList();
fillSeedList(); fillSeedList();
fillSpellList(); fillSpellList();
fillWeatherDebrisList();
} }
@ -96,15 +100,22 @@ namespace Revitalize.Resources
Spell book; Spell book;
//add in a single spell book to my system //add in a single spell book to my system
book = new Spell(0, Vector2.Zero, new SpellFunctionDataNode(null,1)); book = new Spell(0, Vector2.Zero, new SpellFunctionDataNode(null,1),Color.Aqua,0);
book.magicToCast.Clear(); book.magicToCast.Clear();
book.magicToCast.Add(new SpellFunctionDataNode(new Spell.spellFunction(Magic.MagicFunctions.showRedMessage), 1)); book.magicToCast.Add(new SpellFunctionDataNode(new Spell.spellFunction(Magic.MagicFunctions.showRedMessage), 1));
spellList.Add(book.parentSheetIndex, book); spellList.Add(0, book);
//finish adding in a single spell book //finish adding in a single spell book
} }
public static void fillWeatherDebrisList()
{
WeatherDebris w = new WeatherDebris(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), 0, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f);
weatherDebrisDictionary.Add("Pink Flower Petal", w);
}
} }
} }

View File

@ -1,4 +1,5 @@
using StardewModdingAPI; using Revitalize.Aesthetics;
using StardewModdingAPI;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -15,11 +16,14 @@ namespace Revitalize.Resources
public static List<Revitalize.CoreObject> trackedObjectList; public static List<Revitalize.CoreObject> trackedObjectList;
public static List<WeatherDebrisPlus> thisWeatherDebris;
public static void initializeAllLists() public static void initializeAllLists()
{ {
trackedTerrainFeatures = new List<DataNodes.TrackedTerrainDataNode>(); trackedTerrainFeatures = new List<DataNodes.TrackedTerrainDataNode>();
trackedTerrainFeaturesDummyList = new List<DataNodes.TrackedTerrainDummyDataNode>(); trackedTerrainFeaturesDummyList = new List<DataNodes.TrackedTerrainDummyDataNode>();
trackedObjectList = new List<CoreObject>(); trackedObjectList = new List<CoreObject>();
thisWeatherDebris = new List<WeatherDebrisPlus>();
} }
public static void loadAllLists() public static void loadAllLists()

View File

@ -50,6 +50,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Aesthetics\WeatherDebrisPlus.cs" />
<Compile Include="Class1.cs" /> <Compile Include="Class1.cs" />
<Compile Include="CoreObject.cs" /> <Compile Include="CoreObject.cs" />
<Compile Include="Draw\ThingsToDraw.cs" /> <Compile Include="Draw\ThingsToDraw.cs" />

View File

@ -766,9 +766,9 @@ namespace Revitalize
dynamic obj = JObject.Parse(data); dynamic obj = JObject.Parse(data);
Spell d = new Spell(); Spell d = new Spell();
d.parentSheetIndex = obj.parentSheetIndex; d.spellIndex = obj.spellIndex;
Spell spell = new Spell(); Spell spell = new Spell();
bool b = Dictionaries.spellList.TryGetValue(d.parentSheetIndex, out spell); bool b = Dictionaries.spellList.TryGetValue(d.spellIndex, out spell);
Spell k =(Spell) spell.getOne(); Spell k =(Spell) spell.getOne();
if (b == true) return k; if (b == true) return k;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB