diff --git a/Content/Items/Weapons/Arachnus/ChainStynger.cs b/Content/Items/Weapons/Arachnus/ChainStynger.cs index 2578b2b..82c6b72 100644 --- a/Content/Items/Weapons/Arachnus/ChainStynger.cs +++ b/Content/Items/Weapons/Arachnus/ChainStynger.cs @@ -12,7 +12,7 @@ namespace Decimation.Content.Items.Weapons.Arachnus protected override string ItemTooltip => "Unleashe molten ashes upon your foes."; protected override DamageType DamagesType => DamageType.Ranged; protected override int Damages => 800; - protected override string Projectile => "MoltenStyngerBolt"; + protected override string ProjectileName => "MoltenStyngerBolt"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/Arachnus/GlaiveWeaver.cs b/Content/Items/Weapons/Arachnus/GlaiveWeaver.cs index 0dd43df..1d35228 100644 --- a/Content/Items/Weapons/Arachnus/GlaiveWeaver.cs +++ b/Content/Items/Weapons/Arachnus/GlaiveWeaver.cs @@ -9,7 +9,7 @@ namespace Decimation.Content.Items.Weapons.Arachnus protected override string ItemName => "Glaive Weaver"; protected override string ItemTooltip => "Your palm burns as you wield this godly weapon."; protected override int Damages => 850; - protected override string Projectile => "ArchingSolarBlade"; + protected override string ProjectileName => "ArchingSolarBlade"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/Arachnus/Infernolizer.cs b/Content/Items/Weapons/Arachnus/Infernolizer.cs index d7aaea4..90e11a5 100644 --- a/Content/Items/Weapons/Arachnus/Infernolizer.cs +++ b/Content/Items/Weapons/Arachnus/Infernolizer.cs @@ -13,7 +13,7 @@ namespace Decimation.Content.Items.Weapons.Arachnus protected override int Damages => 880; protected override DamageType DamagesType => DamageType.Magic; protected override bool VanillaProjectile => true; - protected override string Projectile => "HeatRay"; + protected override string ProjectileName => "HeatRay"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/Bloodshot/BloodStream.cs b/Content/Items/Weapons/Bloodshot/BloodStream.cs index 7d6b96d..c645bc1 100644 --- a/Content/Items/Weapons/Bloodshot/BloodStream.cs +++ b/Content/Items/Weapons/Bloodshot/BloodStream.cs @@ -13,7 +13,7 @@ namespace Decimation.Content.Items.Weapons.Bloodshot protected override string ItemTooltip => "Bathe your enemies in boiling blood."; protected override DamageType DamagesType => DamageType.Magic; protected override int Damages => 14; - protected override string Projectile => "BloodBeamFriendly"; + protected override string ProjectileName => "BloodBeamFriendly"; protected override void InitWeapon() diff --git a/Content/Items/Weapons/Bloodshot/Umbra.cs b/Content/Items/Weapons/Bloodshot/Umbra.cs index 5ad8db8..f4a9088 100644 --- a/Content/Items/Weapons/Bloodshot/Umbra.cs +++ b/Content/Items/Weapons/Bloodshot/Umbra.cs @@ -14,7 +14,7 @@ namespace Decimation.Content.Items.Weapons.Bloodshot protected override string ItemTooltip => "Turns wooden arrows into siphon arrows."; protected override DamageType DamagesType => DamageType.Ranged; protected override int Damages => 20; - protected override string Projectile => "WoodenArrowFriendly"; + protected override string ProjectileName => "WoodenArrowFriendly"; protected override bool VanillaProjectile => true; protected override void InitWeapon() diff --git a/Content/Items/Weapons/Bloodshot/VampiricShiv.cs b/Content/Items/Weapons/Bloodshot/VampiricShiv.cs index 805aead..849bb26 100644 --- a/Content/Items/Weapons/Bloodshot/VampiricShiv.cs +++ b/Content/Items/Weapons/Bloodshot/VampiricShiv.cs @@ -13,7 +13,7 @@ namespace Decimation.Content.Items.Weapons.Bloodshot protected override string ItemName => "Vampiric Shiv"; protected override string ItemTooltip => "Heal 10% of damages inflicted"; protected override int Damages => 12; - protected override string Projectile => "Tooth"; + protected override string ProjectileName => "Tooth"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/HourHand.cs b/Content/Items/Weapons/HourHand.cs index 91abd89..3dda6e2 100644 --- a/Content/Items/Weapons/HourHand.cs +++ b/Content/Items/Weapons/HourHand.cs @@ -10,7 +10,7 @@ namespace Decimation.Content.Items.Weapons protected override string ItemName => "Hour Hand"; protected override string ItemTooltip => "The sands of time flow in your favor!"; protected override int Damages => 45; - protected override string Projectile => "HourHandProjectile"; + protected override string ProjectileName => "HourHandProjectile"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/MultigrainSword.cs b/Content/Items/Weapons/MultigrainSword.cs index 7049ad7..45ef1e5 100644 --- a/Content/Items/Weapons/MultigrainSword.cs +++ b/Content/Items/Weapons/MultigrainSword.cs @@ -11,7 +11,7 @@ namespace Decimation.Content.Items.Weapons protected override string ItemName => "Multigrain Sword"; protected override string ItemTooltip => "Smells like honeysuckle"; protected override int Damages => 30; - protected override string Projectile => "Stinger"; + protected override string ProjectileName => "Stinger"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/RodofLightning.cs b/Content/Items/Weapons/RodofLightning.cs index 26e82fc..9ec38da 100644 --- a/Content/Items/Weapons/RodofLightning.cs +++ b/Content/Items/Weapons/RodofLightning.cs @@ -7,7 +7,7 @@ namespace Decimation.Content.Items.Weapons protected override string ItemName => "Rod of Lightning"; protected override int Damages => 90; protected override DamageType DamagesType => DamageType.Magic; - protected override string Projectile => "LightningSphere"; + protected override string ProjectileName => "LightningSphere"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/Slimer.cs b/Content/Items/Weapons/Slimer.cs new file mode 100644 index 0000000..b8f8f38 --- /dev/null +++ b/Content/Items/Weapons/Slimer.cs @@ -0,0 +1,39 @@ +using Decimation.Content.Projectiles; +using Decimation.Lib.Items; +using Decimation.Lib.Util; +using Decimation.Lib.Util.Builder; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace Decimation.Content.Items.Weapons +{ + public class Slimer : DecimationWeapon + { + protected override string ItemName => "The Slimer"; + protected override string ItemTooltip => "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(); + + protected override void InitWeapon() + { + item.CloneDefaults(ItemID.SlimeGun); + item.width = 42; + item.height = 26; + item.value = Item.buyPrice(silver: 40); + item.rare = Rarity.Green.GetRarityValue(); + } + + protected override ModRecipe GetRecipe() + { + return new RecipeBuilder(this) + .WithIngredient(ItemID.SlimeGun) + .WithIngredient(ItemID.Gel, 50) + .WithIngredient(ItemID.ArcheryPotion) + .WithIngredient(ItemID.MudBlock, 25) + .WithStation(TileID.Anvils) + .Build(); + } + } +} \ No newline at end of file diff --git a/Content/Items/Weapons/Slimer.png b/Content/Items/Weapons/Slimer.png new file mode 100644 index 0000000..9c4d876 Binary files /dev/null and b/Content/Items/Weapons/Slimer.png differ diff --git a/Content/Items/Weapons/Sling.cs b/Content/Items/Weapons/Sling.cs index 81b1d3d..abb61e8 100644 --- a/Content/Items/Weapons/Sling.cs +++ b/Content/Items/Weapons/Sling.cs @@ -13,7 +13,7 @@ namespace Decimation.Content.Items.Weapons protected override string ItemTooltip => "Uses pebbles and marbles as ammo"; protected override DamageType DamagesType => DamageType.Throw; protected override int Damages => 9; - protected override string Ammo => "Pebble"; + protected override string AmmoName => "Pebble"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/SlingshotWood.cs b/Content/Items/Weapons/SlingshotWood.cs index f3ef313..eda376a 100644 --- a/Content/Items/Weapons/SlingshotWood.cs +++ b/Content/Items/Weapons/SlingshotWood.cs @@ -12,7 +12,7 @@ namespace Decimation.Content.Items.Weapons protected override string ItemTooltip => "Uses pebbles and marbles as ammo"; protected override DamageType DamagesType => DamageType.Ranged; protected override int Damages => 7; - protected override string Ammo => "Pebble"; + protected override string AmmoName => "Pebble"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/TitanicGatliStynger.cs b/Content/Items/Weapons/TitanicGatliStynger.cs index cd3f80c..3ba5a62 100644 --- a/Content/Items/Weapons/TitanicGatliStynger.cs +++ b/Content/Items/Weapons/TitanicGatliStynger.cs @@ -16,7 +16,7 @@ namespace Decimation.Content.Items.Weapons protected override string ItemTooltip => "Feel the rage of Kronos by your side."; protected override DamageType DamagesType => DamageType.Ranged; protected override int Damages => 950; - protected override string Projectile => "TitanicStyngerBolt"; + protected override string ProjectileName => "TitanicStyngerBolt"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/TitanicPike.cs b/Content/Items/Weapons/TitanicPike.cs index 08d54ef..5dd1738 100644 --- a/Content/Items/Weapons/TitanicPike.cs +++ b/Content/Items/Weapons/TitanicPike.cs @@ -12,7 +12,7 @@ namespace Decimation.Content.Items.Weapons { protected override string ItemName => "Titanic Pike"; protected override int Damages => 120; - protected override string Projectile => "TitanicPikeProjectile"; + protected override string ProjectileName => "TitanicPikeProjectile"; protected override void InitWeapon() { diff --git a/Content/Items/Weapons/VampiricEdge.cs b/Content/Items/Weapons/VampiricEdge.cs index 45bf207..ff22fd7 100644 --- a/Content/Items/Weapons/VampiricEdge.cs +++ b/Content/Items/Weapons/VampiricEdge.cs @@ -16,7 +16,7 @@ namespace Decimation.Content.Items.Weapons protected override string ItemName => "Vampiric Edge"; protected override int Damages => 54; - protected override string Projectile => "Tooth"; + protected override string ProjectileName => "Tooth"; protected override void InitWeapon() { diff --git a/Content/Projectiles/GreenSlime.cs b/Content/Projectiles/GreenSlime.cs new file mode 100644 index 0000000..02ce68a --- /dev/null +++ b/Content/Projectiles/GreenSlime.cs @@ -0,0 +1,130 @@ +using Decimation.Content.Buffs.Debuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace Decimation.Content.Projectiles +{ + public class GreenSlime : DecimationProjectile + { + private static readonly int SlimedBuff = ModContent.BuffType(); + + public override string Texture => "Terraria/Projectile_" + ProjectileID.SlimeGun; + + protected override void Init() + { + projectile.CloneDefaults(ProjectileID.SlimeGun); + projectile.aiStyle = -1; + } + + public override void AI() + { + projectile.scale -= 0.015f; + if (projectile.scale <= 0f) + { + projectile.velocity *= 5f; + projectile.oldVelocity = projectile.velocity; + projectile.Kill(); + } + + if (projectile.ai[0] > 3f) + { + if (projectile.owner == Main.myPlayer) + { + Rectangle projRectangle = new Rectangle((int) projectile.position.X, (int) projectile.position.Y, + projectile.width, projectile.height); + for (int n = 0; n < 200; n++) + if (Main.npc[n].active && !Main.npc[n].dontTakeDamage && Main.npc[n].lifeMax > 1) + { + Rectangle npcRectangle = new Rectangle((int) Main.npc[n].position.X, + (int) Main.npc[n].position.Y, Main.npc[n].width, Main.npc[n].height); + if (projRectangle.Intersects(npcRectangle)) + { + Main.npc[n].AddBuff(SlimedBuff, 1500); + projectile.Kill(); + } + } + + for (int p = 0; p < 255; p++) + if (p != projectile.owner && Main.player[p].active && !Main.player[p].dead) + { + Rectangle playerRectangle = new Rectangle((int) Main.player[p].position.X, + (int) Main.player[p].position.Y, Main.player[p].width, Main.player[p].height); + if (projRectangle.Intersects(playerRectangle)) + { + Main.player[p].AddBuff(SlimedBuff, 1500, false); + projectile.Kill(); + } + } + } + + projectile.ai[0] += Main.rand.Next(0, 5); + if (projectile.ai[0] > 30f) projectile.velocity.Y += 0.1f; + + int dustAlpha = 175; + Color dustColor = new Color(0, 255, 60, 100); + for (int i = 0; i < 6; i++) + { + Vector2 val57 = projectile.velocity * i / 6f; + int num622 = 6; + int dust = Dust.NewDust(projectile.position + Vector2.One * 6f, projectile.width - num622 * 2, + projectile.height - num622 * 2, 4, 0f, 0f, dustAlpha, dustColor, 1.2f); + Dust dust96; + Dust dust2; + if (Main.rand.Next(2) == 0) + { + dust96 = Main.dust[dust]; + dust2 = dust96; + dust2.alpha += 25; + } + + if (Main.rand.Next(2) == 0) + { + dust96 = Main.dust[dust]; + dust2 = dust96; + dust2.alpha += 25; + } + + if (Main.rand.Next(2) == 0) + { + dust96 = Main.dust[dust]; + dust2 = dust96; + dust2.alpha += 25; + } + + Main.dust[dust].noGravity = true; + dust96 = Main.dust[dust]; + dust2 = dust96; + dust2.velocity *= 0.3f; + dust96 = Main.dust[dust]; + dust2 = dust96; + dust2.velocity += projectile.velocity * 0.5f; + Main.dust[dust].position = projectile.Center; + Main.dust[dust].position.X -= val57.X; + Main.dust[dust].position.Y -= val57.Y; + dust96 = Main.dust[dust]; + dust2 = dust96; + dust2.velocity *= 0.2f; + } + + if (Main.rand.Next(4) == 0) + { + int num624 = 6; + int num625 = Dust.NewDust(projectile.position + Vector2.One * 6f, projectile.width - num624 * 2, + projectile.height - num624 * 2, 4, 0f, 0f, dustAlpha, dustColor, 1.2f); + Dust dust97 = Main.dust[num625]; + Dust dust2 = dust97; + dust2.velocity *= 0.5f; + dust97 = Main.dust[num625]; + dust2 = dust97; + dust2.velocity += projectile.velocity * 0.5f; + } + } + else + { + projectile.ai[0] += 1f; + } + } + } +} \ No newline at end of file diff --git a/Lib/Items/DecimationWeapon.cs b/Lib/Items/DecimationWeapon.cs index 12da818..94e643d 100644 --- a/Lib/Items/DecimationWeapon.cs +++ b/Lib/Items/DecimationWeapon.cs @@ -1,55 +1,11 @@ -using Decimation.Lib.Util; +using System; +using Decimation.Lib.Util; using Terraria; namespace Decimation.Lib.Items { public abstract class DecimationWeapon : DecimationItem { - protected virtual DamageType DamagesType { get; } = DamageType.Melee; - protected virtual string Projectile { get; } = null; - protected virtual string Ammo { get; } = null; - protected virtual bool VanillaProjectile { get; } = false; - protected virtual bool VanillaAmmo { get; } = false; - - protected abstract int Damages { get; } - protected abstract void InitWeapon(); - - protected override void Init() - { - this.item.useStyle = 1; - this.item.autoReuse = false; - this.item.useTurn = true; - this.item.maxStack = 1; - - switch (this.DamagesType) - { - case DamageType.Magic: - this.item.magic = true; - break; - case DamageType.Ranged: - this.item.ranged = true; - break; - case DamageType.Throw: - this.item.thrown = true; - break; - default: - this.item.melee = true; - break; - } - - InitWeapon(); - - this.item.damage = this.Damages; - - if (this.Projectile != null) - this.item.shoot = ItemUtils.GetIdFromName(this.Projectile, typeof(Projectile), this.VanillaProjectile); - - if (this.Ammo != null) - this.item.useAmmo = ItemUtils.GetIdFromName(this.Ammo, typeof(Item), this.VanillaAmmo); - - if (this.item.melee) this.item.noMelee = false; - } - public enum DamageType { Melee, @@ -57,5 +13,55 @@ namespace Decimation.Lib.Items Throw, Ranged } + + protected virtual DamageType DamagesType { get; } = DamageType.Melee; + [Obsolete("Use ProjectileId instead")] protected virtual string ProjectileName { get; } = null; + protected virtual int ProjectileId { get; } = -1; + [Obsolete("Use AmmoId instead")] protected virtual string AmmoName { get; } = null; + protected virtual int AmmoId { get; } = -1; + [Obsolete] protected virtual bool VanillaProjectile { get; } = false; + [Obsolete] protected virtual bool VanillaAmmo { get; } = false; + + protected abstract int Damages { get; } + protected abstract void InitWeapon(); + + protected override void Init() + { + item.useStyle = 1; + item.autoReuse = false; + item.useTurn = true; + item.maxStack = 1; + + switch (DamagesType) + { + case DamageType.Magic: + item.magic = true; + break; + case DamageType.Ranged: + item.ranged = true; + break; + case DamageType.Throw: + item.thrown = true; + break; + default: + item.melee = true; + break; + } + + InitWeapon(); + + item.damage = Damages; + + if (ProjectileName != null) + item.shoot = + ItemUtils.GetIdFromName(ProjectileName, typeof(Projectile), VanillaProjectile); + if (ProjectileId > -1) item.shoot = ProjectileId; + + if (AmmoName != null) + item.useAmmo = ItemUtils.GetIdFromName(AmmoName, typeof(Item), VanillaAmmo); + if (AmmoId > -1) item.ammo = AmmoId; + + if (item.melee) item.noMelee = false; + } } } \ No newline at end of file