From 2bb7ef39353567b50504327cb967e21e2b894ac9 Mon Sep 17 00:00:00 2001 From: FyloZ Date: Thu, 11 Jun 2020 19:44:56 -0400 Subject: [PATCH] Added Sundial (WIP) --- Content/DecimationPlayer.cs | 6 +- Content/Items/Weapons/DuneWyrm/Sundial.cs | 28 +++++ Content/Items/Weapons/DuneWyrm/Sundial.png | Bin 0 -> 759 bytes Content/Items/Weapons/Slimer.cs | 3 +- Content/Projectiles/DuneWyrm/Sundial.cs | 127 +++++++++++++++++++++ Content/Projectiles/DuneWyrm/Sundial.png | Bin 0 -> 1503 bytes 6 files changed, 161 insertions(+), 3 deletions(-) create mode 100644 Content/Items/Weapons/DuneWyrm/Sundial.cs create mode 100644 Content/Items/Weapons/DuneWyrm/Sundial.png create mode 100644 Content/Projectiles/DuneWyrm/Sundial.cs create mode 100644 Content/Projectiles/DuneWyrm/Sundial.png diff --git a/Content/DecimationPlayer.cs b/Content/DecimationPlayer.cs index cf03da9..18f524a 100644 --- a/Content/DecimationPlayer.cs +++ b/Content/DecimationPlayer.cs @@ -346,7 +346,8 @@ namespace Decimation.Content if (AmuletSlotItem.type == ModContent.ItemType() && Main.rand.NextBool(25)) CrystalAmuletEffect(); - if (this.HasEquippedAccessory(ModContent.ItemType()) || this.HasEquippedAccessory(ModContent.ItemType())) + if (this.HasEquippedAccessory(ModContent.ItemType()) || + this.HasEquippedAccessory(ModContent.ItemType())) { player.AddBuff(BuffID.Panic, 300); SpawnWaspNecklaceWasps(); @@ -394,7 +395,8 @@ namespace Decimation.Content if (AmuletSlotItem.type == ModContent.ItemType() && Main.rand.NextBool(25)) CrystalAmuletEffect(); - if (this.HasEquippedAccessory(ModContent.ItemType()) || this.HasEquippedAccessory(ModContent.ItemType())) + if (this.HasEquippedAccessory(ModContent.ItemType()) || + this.HasEquippedAccessory(ModContent.ItemType())) { player.AddBuff(BuffID.Panic, 300); SpawnWaspNecklaceWasps(); diff --git a/Content/Items/Weapons/DuneWyrm/Sundial.cs b/Content/Items/Weapons/DuneWyrm/Sundial.cs new file mode 100644 index 0000000..860cbd9 --- /dev/null +++ b/Content/Items/Weapons/DuneWyrm/Sundial.cs @@ -0,0 +1,28 @@ +using Decimation.Lib.Items; +using Decimation.Lib.Util; +using Terraria.ModLoader; + +namespace Decimation.Content.Items.Weapons.DuneWyrm +{ + public class Sundial : DecimationWeapon + { + protected override string ItemName => "Sundial"; + protected override int Damages => 15; + protected override DamageType DamagesType => DamageType.Magic; + protected override int ProjectileId => ModContent.ProjectileType(); + + protected override void InitWeapon() + { + item.width = 36; + item.height = 42; + item.shootSpeed = 1f; + item.mana = 10; // TODO + item.autoReuse = true; + item.useStyle = 5; + item.useTime = 24; + item.useAnimation = 24; + item.crit = 15; + item.rare = Rarity.LightRed.GetRarityValue(); + } + } +} \ No newline at end of file diff --git a/Content/Items/Weapons/DuneWyrm/Sundial.png b/Content/Items/Weapons/DuneWyrm/Sundial.png new file mode 100644 index 0000000000000000000000000000000000000000..30b9fc91d273c7b30079dd4eeab7e8fd0215e700 GIT binary patch literal 759 zcmV=G@0WflC+sxOcPY_`I+D zv~v_VjpOMe9|Z$cS{ecq`}+wbO(2WQZ@v5{#^&IU%zl8)8$)IQNhX>fHX(B|L%+VU z8Sy7Qt*}*h+w;Rv!2t0msVV#AX+mbc8vp8@cg9}B-~2M;#mQXG8ZrZjK>F?{k>T^X z8rY@b4cN7=9z(Ad{=lyb7sHNz48oELS%v&?)>UQ(5P>k`p0+C< zBbqZd``bGrQw+x18t^jfDl-F!K&X+(ZKs9!-c#82WEE`f(i_;`XgO@8Y}{jpOoc0p z-1*sc7$oE}Rn}cEV>o0KwL7%DNjvFhB*7!w^WAA0OHWxn0D15 zH6yhmeUH9>oa5~-cfB(WaU0-U)G9LvNDfU+J7k7^M{1`#=&Eoz1)ies$?}~%#ayC za(QQ`mOHbS8D|sw4X3)CRp~UC(vUeoL@t4GkI^zC6Y@M;X8!9#<^aisOx``njZbQ8 zsC6AVX&pG7cGOPIDk~TuYG$hUFF?w^Av2SAnmm^?DN{z|`vT?w$(1$Jj+!e2={^@Q p3yA;U@ct-WCiyx~F=PeM34o+enILKb "The Slimer"; - protected override string ItemTooltip => "Doesn't hurt, but this stuff is sticky!"; + protected override string ItemTooltip => "Shoots a stream of sticky green slime\n" + + "Doesn't hurt, but this stuff is sticky!"; protected override int Damages => 0; protected override DamageType DamagesType => DamageType.Ranged; protected override int ProjectileId => ModContent.ProjectileType(); diff --git a/Content/Projectiles/DuneWyrm/Sundial.cs b/Content/Projectiles/DuneWyrm/Sundial.cs new file mode 100644 index 0000000..03543d4 --- /dev/null +++ b/Content/Projectiles/DuneWyrm/Sundial.cs @@ -0,0 +1,127 @@ +using System.Collections.Generic; +using Decimation.Lib.Items; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; + +namespace Decimation.Content.Projectiles.DuneWyrm +{ + public class Sundial : DecimationProjectile + { + private static readonly IDictionary ProjectilesIndex = new Dictionary(); + private static readonly IDictionary ProjectilesCount = new Dictionary(); + private static readonly int IndexResetCounterMax = 60; + + protected override int AnimationFrames => 12; + protected override int AnimationFps => 1; + protected override DecimationWeapon.DamageType DamageType => DecimationWeapon.DamageType.Magic; + protected override int Damages => 15; + + private int ProjectileIndex + { + get + { + if (!ProjectilesIndex.ContainsKey(Owner)) ProjectilesIndex[Owner] = -1; + return ProjectilesIndex[Owner]; + } + set + { + int index = value; + if (index > AnimationFrames) index = AnimationFrames; + ProjectilesIndex[Owner] = index; + } + } + + private int Count + { + get + { + if (!ProjectilesCount.ContainsKey(Owner)) Count = -1; + return ProjectilesCount[Owner]; + } + set => ProjectilesCount[Owner] = value; + } + + private int Index + { + get => (int) projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + + private int Owner + { + get => (int) projectile.localAI[1]; + set => projectile.localAI[1] = value; + } + + private bool EndOfLife => projectile.timeLeft < IndexResetCounterMax || projectile.penetrate <= 1; + + protected override void Init() + { + projectile.width = 20; + projectile.height = 22; + projectile.timeLeft = 180 + IndexResetCounterMax; + projectile.aiStyle = -1; + projectile.tileCollide = false; + projectile.knockBack = 7; + + Owner = projectile.owner; + if (Count++ == 0) ProjectileIndex = 0; + Index = ++ProjectileIndex; + + projectile.penetrate = Index + 1; + } + + public override bool PreKill(int timeLeft) + { + Count -= 1; + + return true; + } + + public override bool PreAI() + { + projectile.frame = Index - 1; + if (projectile.frame >= AnimationFrames) projectile.frame = AnimationFrames - 1; + + return true; + } + + + public override void AI() + { + if (EndOfLife) + { + projectile.velocity = Vector2.Zero; + projectile.penetrate = -1; + projectile.damage = 0; + projectile.alpha = 0; + } + else + { + Lighting.AddLight(projectile.Center, 0, 0.8f, 1); + projectile.velocity.Normalize(); + projectile.velocity *= Index; + + if (Index >= 6) projectile.damage = 25; + if (Index >= 12) projectile.damage = 35; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Index == 1) target.AddBuff(BuffID.Slow, 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Index == 1) target.AddBuff(BuffID.Slow, 300); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + return !EndOfLife; // projectile.alpha = 0 does not always work? + } + } +} \ No newline at end of file diff --git a/Content/Projectiles/DuneWyrm/Sundial.png b/Content/Projectiles/DuneWyrm/Sundial.png new file mode 100644 index 0000000000000000000000000000000000000000..3f6b84d7cfcc12171807d876a55749e6ead984ed GIT binary patch literal 1503 zcmV<51t9u~P)l5VQlZMFJ#%$iWZ3zz2c=0SO?%10)gv1VNY&ym>eWL;w%~$OHiLd3$xP-I}WD zomroS{lVOwYkPLOySjS%c7Lz%bMWZZ-|e^me0;fI`uy2@#Se4?JbM0YW7x@?x0`=U zmRc4z2R!}oVq@9iiJmP+NSNSV0NU^=By=D5hir4qRuDMM&A1B}gx3O4>O@>p+1KQCiF7tkiD8U0+06iK5B@anK$Sc=>cnL6ILbxJcp z)%bD5q_xXvaY^o4j*Yv2`GA;Jko68h=1QV(2FTonah6R|OEh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