diff --git a/Content/Projectiles/MagmaBall.cs b/Content/Projectiles/MagmaBall.cs index fbb35d5..9958487 100644 --- a/Content/Projectiles/MagmaBall.cs +++ b/Content/Projectiles/MagmaBall.cs @@ -2,6 +2,7 @@ using System; using Decimation.Content.Buffs.Debuffs; using Decimation.Lib.Util; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +11,20 @@ namespace Decimation.Content.Projectiles { public class MagmaBall : DecimationProjectile { + public override string Texture => "Decimation/Content/Projectiles/MagmaBall"; + private bool HitPlayer { get => projectile.ai[0] == 1f; set => projectile.ai[0] = value ? 1 : 0; } + private bool AlternativeTexture + { + get => projectile.localAI[0] == 1f; + set => projectile.localAI[0] = value ? 1 : 0; + } + protected override void Init() { projectile.width = 22; @@ -23,6 +32,8 @@ namespace Decimation.Content.Projectiles projectile.aiStyle = -1; projectile.hostile = true; projectile.penetrate = 1; + + AlternativeTexture = Main.rand.NextBool(); } public override void AI() @@ -48,7 +59,8 @@ namespace Decimation.Content.Projectiles { if (HitPlayer) return; - DustUtils.NewDustCircle(4, projectile.position, projectile.width, projectile.height, DustID.Fire, projectile.scale * 3f); + DustUtils.NewDustCircle(4, projectile.position, projectile.width, projectile.height, DustID.Fire, + projectile.scale * 3f); Tile currentTile = Framing.GetTileSafely((int) Math.Floor(projectile.position.X / 16f), (int) Math.Ceiling(projectile.position.Y / 16f)); @@ -57,5 +69,32 @@ namespace Decimation.Content.Projectiles Main.PlaySound(SoundID.NPCDeath19, projectile.Center); } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + var frameSize = new Vector2(projectile.width, projectile.height); + string texturePath = "Content/Projectiles/MagmaBall"; + if (AlternativeTexture) texturePath += "_Alternative"; + var texture = mod.GetTexture(texturePath); + + + spriteBatch.Draw + ( + texture, + new Vector2( + projectile.position.X - Main.screenPosition.X + frameSize.X / 2, + projectile.position.Y - Main.screenPosition.Y + frameSize.Y / 2 + ), + null, + lightColor, + projectile.rotation + MathHelper.Pi * .5f, + frameSize * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f + ); + + return false; + } } } \ No newline at end of file diff --git a/Content/Projectiles/MagmaBall.png b/Content/Projectiles/MagmaBall.png index 5fd08d9..dd8f584 100644 Binary files a/Content/Projectiles/MagmaBall.png and b/Content/Projectiles/MagmaBall.png differ diff --git a/Content/Projectiles/MagmaBall_Alternative.png b/Content/Projectiles/MagmaBall_Alternative.png new file mode 100644 index 0000000..56031ad Binary files /dev/null and b/Content/Projectiles/MagmaBall_Alternative.png differ