diff --git a/Buffs/ScourgeBuff.cs b/Buffs/ScourgeBuff.cs new file mode 100644 index 0000000..69a83c6 --- /dev/null +++ b/Buffs/ScourgeBuff.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace DubNation.Buffs +{ + public class ScourgeBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Scourge Minion"); + Description.SetDefault("The scourge minion will fight for you"); + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + player.buffTime[buffIndex] = 18000; + } + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/ScourgeBuff.png b/Buffs/ScourgeBuff.png new file mode 100644 index 0000000..eaee879 Binary files /dev/null and b/Buffs/ScourgeBuff.png differ diff --git a/Items/ChlorophyteStaff.cs b/Items/ChlorophyteStaff.cs index 0d39c1f..c579a97 100644 --- a/Items/ChlorophyteStaff.cs +++ b/Items/ChlorophyteStaff.cs @@ -25,7 +25,7 @@ public override void SetDefaults() item.useAnimation = 36; item.useStyle = ItemUseStyleID.SwingThrow; item.value = 10; - item.rare = ItemRarityID.Blue; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item1; item.mana = 10; item.noMelee = true; @@ -45,7 +45,6 @@ public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ChlorophyteBar, 9); - recipe.AddIngredient(ItemID.TurtleShell, 1); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/ScourgeStaff.cs b/Items/ScourgeStaff.cs new file mode 100644 index 0000000..fa7b57c --- /dev/null +++ b/Items/ScourgeStaff.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + + +namespace DubNation.Items +{ + public class ScourgeStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge Staff"); + Tooltip.SetDefault("Summons a scourge minion to fight for you"); + ItemID.Sets.GamepadWholeScreenUseRange[item.type] = true; + ItemID.Sets.LockOnIgnoresCollision[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 8; + item.width = 40; + item.height = 40; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = ItemUseStyleID.SwingThrow; + item.value = 10; + item.rare = ItemRarityID.White; + item.UseSound = SoundID.Item1; + item.mana = 1; + item.noMelee = true; + item.summon = true; + item.buffType = ModContent.BuffType(); + item.shoot = ModContent.ProjectileType(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + player.AddBuff(item.buffType, 2); + position = Main.MouseWorld; + return true; + } + + public override void AddRecipes() + { + Mod calamity = ModLoader.GetMod("CalamityMod"); + if (calamity != null) + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(calamity.ItemType("VictoryShard"), 4); + recipe.AddIngredient(ItemID.SandBlock, 10); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + } +} diff --git a/Items/ScourgeStaff.png b/Items/ScourgeStaff.png new file mode 100644 index 0000000..cb9c065 Binary files /dev/null and b/Items/ScourgeStaff.png differ diff --git a/Items/ShroomiteStaff.cs b/Items/ShroomiteStaff.cs index 9e9f63a..b3e64ca 100644 --- a/Items/ShroomiteStaff.cs +++ b/Items/ShroomiteStaff.cs @@ -18,14 +18,14 @@ public override void SetStaticDefaults() public override void SetDefaults() { - item.damage = 30; + item.damage = 40; item.width = 40; item.height = 40; item.useTime = 36; item.useAnimation = 36; item.useStyle = ItemUseStyleID.SwingThrow; item.value = 10; - item.rare = ItemRarityID.Blue; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item1; item.mana = 10; item.noMelee = true; @@ -44,8 +44,7 @@ public override bool Shoot(Player player, ref Vector2 position, ref float speedX public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ChlorophyteBar, 9); - recipe.AddIngredient(ItemID.TurtleShell, 1); + recipe.AddIngredient(ItemID.ShroomiteBar, 9); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/SpectreStaff.cs b/Items/SpectreStaff.cs index 355e0bd..917f140 100644 --- a/Items/SpectreStaff.cs +++ b/Items/SpectreStaff.cs @@ -25,7 +25,7 @@ public override void SetDefaults() item.useAnimation = 36; item.useStyle = ItemUseStyleID.SwingThrow; item.value = 10; - item.rare = ItemRarityID.Blue; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item1; item.mana = 10; item.noMelee = true; diff --git a/Items/WoodStaff.cs b/Items/WoodStaff.cs index c86561b..eae4dc4 100644 --- a/Items/WoodStaff.cs +++ b/Items/WoodStaff.cs @@ -45,7 +45,7 @@ public override bool Shoot(Player player, ref Vector2 position, ref float speedX public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Wood, 12); + recipe.AddRecipeGroup("Wood", 12); recipe.AddTile(TileID.WorkBenches); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Projectiles/ScourgeMinion.cs b/Projectiles/ScourgeMinion.cs new file mode 100644 index 0000000..8e14457 --- /dev/null +++ b/Projectiles/ScourgeMinion.cs @@ -0,0 +1,102 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace DubNation.Projectiles +{ + public class ScourgeMinion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge Minion"); + // Sets the amount of frames this minion has on its spritesheet + Main.projFrames[projectile.type] = 1; + // This is necessary for right-click targeting + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + + // These below are needed for a minion + // Denotes that this projectile is a pet or minion + Main.projPet[projectile.type] = true; + // This is needed so your minion can properly spawn when summoned and replaced when other minions are summoned + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + // Don't mistake this with "if this is true, then it will automatically home". It is just for damage reduction for certain NPCs + ProjectileID.Sets.Homing[projectile.type] = true; + } + + public sealed override void SetDefaults() + { + projectile.width = 40; + projectile.height = 100; + // Makes the minion go through tiles freely + projectile.tileCollide = true; + + // These below are needed for a minion weapon + // Only controls if it deals damage to enemies on contact (more on that later) + projectile.friendly = true; + // Only determines the damage type + projectile.minion = true; + // Amount of slots this minion occupies from the total minion slots available to the player (more on that later) + projectile.minionSlots = 1f; + // Needed so the minion doesn't despawn on collision with enemies or tiles + projectile.penetrate = -1; + } + + // Here you can decide if your minion breaks things like grass or pots + public override bool? CanCutTiles() + { + return false; + } + + // This is mandatory if your minion deals contact damage (further related stuff in AI() in the Movement region) + public override bool MinionContactDamage() + { + return true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + + #region Active check + // This is the "active check", makes sure the minion is alive while the player is alive, and despawns if not + if (player.dead || !player.active) + { + player.ClearBuff(ModContent.BuffType()); + } + if (player.HasBuff(ModContent.BuffType())) + { + projectile.timeLeft = 2; + } + #endregion + + #region Movement + Vector2 down = new Vector2(0, 1); + projectile.velocity = (projectile.velocity + down); + #endregion + + #region Animation and visuals + // So it will lean slightly towards the direction it's moving + projectile.rotation = projectile.velocity.X * 0.05f; + + // This is a simple "loop through all frames from top to bottom" animation + int frameSpeed = 5; + projectile.frameCounter++; + if (projectile.frameCounter >= frameSpeed) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + } + + // Some visuals here + Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 0.78f); + #endregion + + } + } +} diff --git a/Projectiles/ScourgeMinion.png b/Projectiles/ScourgeMinion.png new file mode 100644 index 0000000..4ff46a6 Binary files /dev/null and b/Projectiles/ScourgeMinion.png differ diff --git a/Projectiles/ShroomiteProjectile.cs b/Projectiles/ShroomiteProjectile.cs index 1fe8a15..0522f60 100644 --- a/Projectiles/ShroomiteProjectile.cs +++ b/Projectiles/ShroomiteProjectile.cs @@ -24,5 +24,10 @@ public override bool MinionContactDamage() { return true; } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.Kill(); + return true; + } } } diff --git a/build.txt b/build.txt index 9dffb77..4290a8a 100644 --- a/build.txt +++ b/build.txt @@ -1,4 +1,4 @@ displayName = DubNation author = Penguin -version = 0.3.0 +version = 0.3.1 homepage = https://github.com/Nick-NCSU/DubNationMod \ No newline at end of file