diff --git a/Changes/NPCLoot.cs b/Changes/NPCLoot.cs index bdaeb9c..0ef874c 100644 --- a/Changes/NPCLoot.cs +++ b/Changes/NPCLoot.cs @@ -4,6 +4,7 @@ using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using YHTMod.Items; +using YHTMod.Items.ArcaneMissle; namespace YHTMod.Changes; @@ -14,11 +15,18 @@ public class NpcLoot : GlobalNPC int id = npc.type; if (NPCID.Sets.CountsAsCritter[id]) { - npcLoot.Add(ItemDropRule.Common(ModContent.ItemType(), 400, 1, 1)); + npcLoot.Add(ItemDropRule.Common(ModContent.ItemType(), 400)); } - if (NPCID.Plantera == id) { - npcLoot.Add(ItemDropRule.Common(ItemID.ChlorophyteOre, 1, 60, 80)); + switch (id) { + case NPCID.Plantera: + npcLoot.Add(ItemDropRule.Common(ItemID.ChlorophyteOre, 1, 60, 80)); + break; + case NPCID.Tim: + npcLoot.Add(ItemDropRule.Common(ModContent.ItemType())); + break; } + + } } diff --git a/Items/ArcaneMissle/ArcaneMissle.cs b/Items/ArcaneMissle/ArcaneMissle.cs new file mode 100644 index 0000000..139e783 --- /dev/null +++ b/Items/ArcaneMissle/ArcaneMissle.cs @@ -0,0 +1,36 @@ +using Terraria; +using Terraria.GameContent.Creative; +using Terraria.ID; +using Terraria.ModLoader; + +namespace YHTMod.Items.ArcaneMissle; + +public class ArcaneMissle : ModItem { + + public override void SetStaticDefaults() { + DisplayName.SetDefault("Arcane Missle"); + Tooltip.SetDefault( + "Magical projectile crits shoot a homing arcane missle\n" + + "Arcane missles cannot crit" + ); + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1; + } + + public override void SetDefaults() { + Item.width = 64; + Item.height = 64; + Item.accessory = true; + Item.damage = 10; + Item.rare = ItemRarityID.LightRed; + Item.DamageType = DamageClass.Magic; + Item.noMelee = true; + Item.noUseGraphic = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) { + + player.GetModPlayer().arcaneMissle = Item.damage; + + base.UpdateAccessory(player, hideVisual); + } +} \ No newline at end of file diff --git a/Items/ArcaneMissle/ArcaneMissle.png b/Items/ArcaneMissle/ArcaneMissle.png new file mode 100644 index 0000000..a3edb5c Binary files /dev/null and b/Items/ArcaneMissle/ArcaneMissle.png differ diff --git a/Items/ArcaneMissle/ArcaneMissleBehavior.cs b/Items/ArcaneMissle/ArcaneMissleBehavior.cs new file mode 100644 index 0000000..5b7c174 --- /dev/null +++ b/Items/ArcaneMissle/ArcaneMissleBehavior.cs @@ -0,0 +1,47 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace YHTMod.Items.ArcaneMissle; + +public class ArcaneMissleBehavior : GlobalNPC { + + public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit) { + if (!crit) { + base.OnHitByProjectile(npc, projectile, damage, knockback, false); + return; + } + + if (Main.netMode == NetmodeID.Server) { + return; + } + + Player player = Main.LocalPlayer; + + if (player.GetModPlayer().arcaneMissle != 0 && projectile.DamageType == DamageClass.Magic) { + // player just crit with magic weapon while having arcane missle accessory + Projectile proj = Projectile.NewProjectileDirect( + projectile.GetSource_FromThis("arcaneMissle"), + Main.LocalPlayer.position, + npc.position.DirectionFrom(Main.LocalPlayer.position), + ProjectileID.MagicMissile, + player.GetModPlayer().arcaneMissle, + 0, + Main.LocalPlayer.whoAmI + ); + proj.friendly = true; + proj.hostile = false; + proj.timeLeft = 300; + proj.maxPenetrate = 1; + proj.tileCollide = false; + proj.DamageType = DamageClass.Magic; + proj.aiStyle = ProjAIStyleID.MagicMissile; + + // Prevent crits for the missles + proj.CritChance = Int32.MinValue; + } + + base.OnHitByProjectile(npc, projectile, damage, knockback, true); + } +} \ No newline at end of file diff --git a/YhtPlayer.cs b/YhtPlayer.cs new file mode 100644 index 0000000..344c6df --- /dev/null +++ b/YhtPlayer.cs @@ -0,0 +1,15 @@ +using Terraria.ModLoader; + +namespace YHTMod; + +public class YhtPlayer : ModPlayer { + + public int arcaneMissle = 0; + + public override void ResetEffects() { + + this.arcaneMissle = 0; + + base.ResetEffects(); + } +} \ No newline at end of file diff --git a/build.txt b/build.txt index 768a618..db6e175 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,3 @@ displayName = YHT Mod author = YouHaveTrouble -version = 1.0.1 \ No newline at end of file +version = 1.1.0 \ No newline at end of file diff --git a/description.txt b/description.txt index 3568e6c..5ff56a9 100644 --- a/description.txt +++ b/description.txt @@ -1,5 +1,7 @@ Bunch of random additions ranging from QoL to random references +All new content and changes are documented on the wiki. + Wiki: https://github.com/YouHaveTrouble/YHTMod/wiki Source: https://github.com/YouHaveTrouble/YHTMod diff --git a/readme.md b/readme.md index ff66a72..b9fcbee 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,7 @@ A bunch of random additions ranging from QoL to random references +Steam workshop: https://steamcommunity.com/sharedfiles/filedetails/?id=2897350075 + Mod wiki: https://github.com/YouHaveTrouble/YHTMod/wiki Code: YouHaveTrouble