From 4a0f37f65269bde24b3e35b531fd7feffa085882 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Wed, 7 Dec 2022 23:44:15 +0100 Subject: [PATCH 1/4] arcane missle initial logic --- Items/ArcaneMissle/ArcaneMissle.cs | 31 ++++++++++++++++++++++ Items/ArcaneMissle/ArcaneMissleBehavior.cs | 21 +++++++++++++++ YhtPlayer.cs | 15 +++++++++++ 3 files changed, 67 insertions(+) create mode 100644 Items/ArcaneMissle/ArcaneMissle.cs create mode 100644 Items/ArcaneMissle/ArcaneMissleBehavior.cs create mode 100644 YhtPlayer.cs diff --git a/Items/ArcaneMissle/ArcaneMissle.cs b/Items/ArcaneMissle/ArcaneMissle.cs new file mode 100644 index 0000000..f8ccf74 --- /dev/null +++ b/Items/ArcaneMissle/ArcaneMissle.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.GameContent.Creative; +using Terraria.ModLoader; + +namespace YHTMod.Items.ArcaneMissle; + +public class ArcaneMissle : ModItem { + + public override void SetStaticDefaults() { + DisplayName.SetDefault("Arcane Missle"); + Tooltip.SetDefault("Magic damage crits have a chance to shoot a homing arcane missle"); + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1; + } + + public override void SetDefaults() { + Item.width = 64; + Item.height = 64; + Item.accessory = true; + Item.damage = 10; + Item.DamageType = DamageClass.Magic; + Item.noMelee = true; + Item.noUseGraphic = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) { + + player.GetModPlayer().arcaneMissle = true; + + base.UpdateAccessory(player, hideVisual); + } +} \ No newline at end of file diff --git a/Items/ArcaneMissle/ArcaneMissleBehavior.cs b/Items/ArcaneMissle/ArcaneMissleBehavior.cs new file mode 100644 index 0000000..591994d --- /dev/null +++ b/Items/ArcaneMissle/ArcaneMissleBehavior.cs @@ -0,0 +1,21 @@ +using Terraria; +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; + } + Player player = Main.LocalPlayer; + + if (player.GetModPlayer().arcaneMissle && projectile.DamageType == DamageClass.Magic) { + // player just crit with magic weapon while having arcane missle accessory equipped + } + + 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..0e71015 --- /dev/null +++ b/YhtPlayer.cs @@ -0,0 +1,15 @@ +using Terraria.ModLoader; + +namespace YHTMod; + +public class YhtPlayer : ModPlayer { + + public bool arcaneMissle = false; + + public override void ResetEffects() { + + this.arcaneMissle = false; + + base.ResetEffects(); + } +} \ No newline at end of file From eb1bf9014d4e03e0713c06364b872c957c965ebb Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Wed, 14 Dec 2022 23:45:26 +0100 Subject: [PATCH 2/4] working arcane missle --- Changes/NPCLoot.cs | 14 +++++++--- Items/ArcaneMissle/ArcaneMissle.cs | 9 +++++-- Items/ArcaneMissle/ArcaneMissleBehavior.cs | 30 ++++++++++++++++++++-- YhtPlayer.cs | 4 +-- 4 files changed, 48 insertions(+), 9 deletions(-) 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 index f8ccf74..139e783 100644 --- a/Items/ArcaneMissle/ArcaneMissle.cs +++ b/Items/ArcaneMissle/ArcaneMissle.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.GameContent.Creative; +using Terraria.ID; using Terraria.ModLoader; namespace YHTMod.Items.ArcaneMissle; @@ -8,7 +9,10 @@ public class ArcaneMissle : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Arcane Missle"); - Tooltip.SetDefault("Magic damage crits have a chance to shoot a homing arcane missle"); + Tooltip.SetDefault( + "Magical projectile crits shoot a homing arcane missle\n" + + "Arcane missles cannot crit" + ); CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1; } @@ -17,6 +21,7 @@ public class ArcaneMissle : ModItem { Item.height = 64; Item.accessory = true; Item.damage = 10; + Item.rare = ItemRarityID.LightRed; Item.DamageType = DamageClass.Magic; Item.noMelee = true; Item.noUseGraphic = true; @@ -24,7 +29,7 @@ public class ArcaneMissle : ModItem { public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetModPlayer().arcaneMissle = true; + player.GetModPlayer().arcaneMissle = Item.damage; base.UpdateAccessory(player, hideVisual); } diff --git a/Items/ArcaneMissle/ArcaneMissleBehavior.cs b/Items/ArcaneMissle/ArcaneMissleBehavior.cs index 591994d..5b7c174 100644 --- a/Items/ArcaneMissle/ArcaneMissleBehavior.cs +++ b/Items/ArcaneMissle/ArcaneMissleBehavior.cs @@ -1,4 +1,6 @@ +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace YHTMod.Items.ArcaneMissle; @@ -10,10 +12,34 @@ public class ArcaneMissleBehavior : GlobalNPC { base.OnHitByProjectile(npc, projectile, damage, knockback, false); return; } + + if (Main.netMode == NetmodeID.Server) { + return; + } + Player player = Main.LocalPlayer; - if (player.GetModPlayer().arcaneMissle && projectile.DamageType == DamageClass.Magic) { - // player just crit with magic weapon while having arcane missle accessory equipped + 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); diff --git a/YhtPlayer.cs b/YhtPlayer.cs index 0e71015..344c6df 100644 --- a/YhtPlayer.cs +++ b/YhtPlayer.cs @@ -4,11 +4,11 @@ namespace YHTMod; public class YhtPlayer : ModPlayer { - public bool arcaneMissle = false; + public int arcaneMissle = 0; public override void ResetEffects() { - this.arcaneMissle = false; + this.arcaneMissle = 0; base.ResetEffects(); } From bf556d059f87815a007e73ddbbc4381636fc45f6 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Wed, 21 Dec 2022 00:08:02 +0100 Subject: [PATCH 3/4] arcane missle sprite --- Items/ArcaneMissle/ArcaneMissle.png | Bin 0 -> 3444 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Items/ArcaneMissle/ArcaneMissle.png diff --git a/Items/ArcaneMissle/ArcaneMissle.png b/Items/ArcaneMissle/ArcaneMissle.png new file mode 100644 index 0000000000000000000000000000000000000000..a3edb5cd455dd73f76d3b82339fc57a091118319 GIT binary patch literal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Q@@Vo=H1&|1yB%nX- z*b0#((5#_XX3q2NIvXGXFqt-9IsnwQ0V2-Vab}eSIvzGcWE;Twkpy6TY7MCy006pA zV&9z4d|Oum2>>fLU3vhhI|wk;2JrUnqZ(HMg?FImBk#bI0GwBeptiwI@ftiEfN`P~ zM?~ zUl)EOWFyxqyB-H0-x$F%JUfI>M993=pzg;cpNDjV0~o7w_g@7V-n zo1^3gW|as!-}B$MGhU7WZ$S4aTp9_G05ET0X#wB~5YIT&9YnqB(XC!P>;Gvdm%ulN zyz8(P@FrNF5D7x{3dlmfwPpa=zH--&&KF1fjt6vR13<_GfbAc^-_ij`T1LBHCi zbp!y&ixfsWoA##OLo_aufp`GBp?TjU>|6BnJiSYR1V99>`L=fs0Cf*FeHgOHOMs@pY3e0- zUjsu@sJB3%rs=#?(s<*j_22aij-D$4aFb8VMx=UlyC!|KR|23WT|M0&eYG1e;nY+1 z6|y~V+hWYRe`=*`+`*G5-uRl+(A~&W0yvaQ0MvzSyZw4o0d?!(qm3vbhZirPJ^Es( zN7m?j0UEdP#u Date: Wed, 21 Dec 2022 00:08:21 +0100 Subject: [PATCH 4/4] update descriptions --- build.txt | 2 +- description.txt | 2 ++ readme.md | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) 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