From edeb0ec5ca183946ca30f07b8f23a2ca78cbae0d Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sun, 24 May 2020 21:14:00 -0400 Subject: [PATCH 1/8] added gastric belcher staff --- Buffs/Summon/GastricBelcherBuff.cs | 36 ++ Buffs/Summon/GastricBelcherBuff.png | Bin 0 -> 752 bytes CalPlayer/CalamityPlayer.cs | 2 + Items/TreasureBags/LeviathanBag.cs | 2 + Items/Weapons/Summon/GastricBelcherStaff.cs | 73 ++++ Items/Weapons/Summon/GastricBelcherStaff.png | Bin 0 -> 1258 bytes ModSupport/WeakReferenceSupport.cs | 3 +- NPCs/Leviathan/Leviathan.cs | 2 + Projectiles/Summon/GastricBelcher.cs | 352 +++++++++++++++++++ Projectiles/Summon/GastricBelcher.png | Bin 0 -> 2951 bytes Projectiles/Summon/GastricBelcherBubble.cs | 44 +++ Projectiles/Summon/GastricBelcherBubble.png | Bin 0 -> 436 bytes Projectiles/Summon/GastricBelcherVomit.cs | 66 ++++ Projectiles/Summon/GastricBelcherVomit.png | Bin 0 -> 437 bytes Projectiles/Summon/GastricBelcherVomit2.png | Bin 0 -> 421 bytes Projectiles/Summon/GastricBelcherVomit3.png | Bin 0 -> 447 bytes 16 files changed, 579 insertions(+), 1 deletion(-) create mode 100644 Buffs/Summon/GastricBelcherBuff.cs create mode 100644 Buffs/Summon/GastricBelcherBuff.png create mode 100644 Items/Weapons/Summon/GastricBelcherStaff.cs create mode 100644 Items/Weapons/Summon/GastricBelcherStaff.png create mode 100644 Projectiles/Summon/GastricBelcher.cs create mode 100644 Projectiles/Summon/GastricBelcher.png create mode 100644 Projectiles/Summon/GastricBelcherBubble.cs create mode 100644 Projectiles/Summon/GastricBelcherBubble.png create mode 100644 Projectiles/Summon/GastricBelcherVomit.cs create mode 100644 Projectiles/Summon/GastricBelcherVomit.png create mode 100644 Projectiles/Summon/GastricBelcherVomit2.png create mode 100644 Projectiles/Summon/GastricBelcherVomit3.png diff --git a/Buffs/Summon/GastricBelcherBuff.cs b/Buffs/Summon/GastricBelcherBuff.cs new file mode 100644 index 0000000000..e45bba25a9 --- /dev/null +++ b/Buffs/Summon/GastricBelcherBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class GastricBelcherBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Gastric Aberration"); + Description.SetDefault("The aquatic aberration will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.gastricBelcher = true; + } + if (!modPlayer.gastricBelcher) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/GastricBelcherBuff.png b/Buffs/Summon/GastricBelcherBuff.png new file mode 100644 index 0000000000000000000000000000000000000000..7a81dd519c9a23b2759270b31a2e92fb6eb5fd59 GIT binary patch literal 752 zcmVPx#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00KTqL_t(o!{wJxNK{c2#(!gvEN7T; z7-J$(N1H%{$fBrhQ`DlG0&(L;0>O<)#Nf7QkuF-qAQZKZ7PV`U(ISGtBC&=dNwd^R z7ZEw-Oi!ghIxXJZ8O~+K$rf_MZ}rYS=bp>??sw09*X8#50GLmwGOQuoUY`q~Y%Lcp z1Q(D2sN1rP^=?c7&Zu-hcQBK=YZ+0CZ$d zt}0>kt-?$cgE#%WPlJVGYC_LTmQ`F!FrR3)~9jdutz=v;5mI5fVoi*kne!1Gd4wRS!uXU*f*k5TjnyL zV<`{>@_U?2ID2gM#6;YN+I>#^#}@!p`|E|jE7tqJFc6nARUJ+t*B81S_3M4082lBE zR*bz3i~beQe4CV!dm{k&4u!?Aeg7!{*IG{i`8_XHxp|$?{*e|AUClFDjill-fw}{3 zYKez<3NT2Q@=jA6jF?qA1$0DqpPQNO}5h5!Hn5_CmabVXQ6 iMmkS&X=QG7VRUJ4ZU8ZaSnTfr0000(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Equipment DropHelper.DropItem(player, ModContent.ItemType()); diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs new file mode 100644 index 0000000000..4e5b46bd14 --- /dev/null +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -0,0 +1,73 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class GastricBelcherStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gastric Belcher Staff"); + Tooltip.SetDefault("Summons aquatic aberrations to protect you\n" + + "Aberrations fire vomit at nearby enemies with every third attack firing bubbles"); + } + + public override void SetDefaults() + { + item.damage = 70; + item.mana = 10; + item.width = 66; + item.height = 70; + item.useTime = item.useAnimation = 20; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 1f; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; + item.UseSound = SoundID.Item76; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + item.autoReuse = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + player.itemTime = item.useTime; + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float directionX = Main.mouseX + Main.screenPosition.X - playerPos.X; + float directionY = Main.mouseY + Main.screenPosition.Y - playerPos.Y; + if (player.gravDir == -1f) + { + directionY = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; + } + Vector2 spinningpoint = new Vector2(directionX, directionY); + float dist = spinningpoint.Length(); + if ((float.IsNaN(spinningpoint.X) && float.IsNaN(spinningpoint.Y)) || (spinningpoint.X == 0f && spinningpoint.Y == 0f)) + { + spinningpoint.X = player.direction; + spinningpoint.Y = 0f; + dist = item.shootSpeed; + } + else + { + dist = item.shootSpeed / dist; + } + spinningpoint.X *= dist; + spinningpoint.Y *= dist; + playerPos.X = Main.mouseX + Main.screenPosition.X; + playerPos.Y = Main.mouseY + Main.screenPosition.Y; + spinningpoint = spinningpoint.RotatedBy(Math.PI / 2D, default); + Projectile.NewProjectile(playerPos + spinningpoint, spinningpoint, type, damage, knockBack, player.whoAmI, 0f, 1f); + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/GastricBelcherStaff.png b/Items/Weapons/Summon/GastricBelcherStaff.png new file mode 100644 index 0000000000000000000000000000000000000000..11b0ee087acce2f9d2e838038db6ce893df80b58 GIT binary patch literal 1258 zcmVPx#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00cNmL_t(&-tCynZ&Xzr$3LetL*I7V zO3KvMKBT0L)j}0%@DYIpi49v9urRu-sMxSHjWOy%qajTkOdM$TLS zAoE93<~4E3sP`TN4)Vc}l!=)&^}1o;Nd@rdZBdsU)s;s5SE(NWcrW@A0G-{B0&wP) zPYl1Q=<@&^Ixc(T<5$0tit`gv4)1ag?F|(wxd$BN2ZsR|I5t$&?c&KX3t+apLjmlt zM89?HQzJz)qCQj6S)+YscocxnZoNnBbHPTw;rIyv=ED;ER#Te-P;)l`FEOBF-)d^3 zaD|zW#NN5@=YYJL=o3^UbRj%$0rYpt-dXl6dnX=A|lFQvZOZkI=1%)K|<=FDqG zRLMIGsD@VgF?Yj)d~7<7w*H<&{%?-vjC$=qdg!e2f3WiakY^(Hrl{5K?^@QLnZ5Vs z!{Y$>S|3vY*;_XaxAJGeiTyx8R@(6_02%FIBcFTxDP@0)I@vMow!bcA?ec2?o_qHV z046@W0>J(w)wZWFpjAmDUCK1_I`*}dJp-yB=P`8OcjvaOIGq&Ty(KrGz!Q=crmsaT z$TPOw{~`dBtv?w9M6RwB9eC_)41l`IM*vtjdITt7!k&jd58V3iAr-2#b$DscsK`$L zA}h4jDec5w1OV00ssJ)+Crh*d4%=Q|9N1HIz_(6IcG=$8U9>)b@(L4L-JHGWy2F$` z1Iiz&HDce%{(>P{X+m_{z5BJf?+qQnAOO>egay#sVKR|imifgRlVi@D3+Lk@2DIHL^4c^5^)*2N7E{HMzdS9m-&iB}fq1WEtD1p$YL@#n zZ!zG<{W7sZMY2|vR0X;?ZZ9r5AAP>35kb4Uvv)u000tnMObu2SV=}YPjYExZggREX>V=- UF@#v`?*IS*07*qoM6N<$g5GgcqW}N^ literal 0 HcmV?d00001 diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 08933814c5..435ca73151 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -344,7 +344,7 @@ namespace CalamityMod { BossDifficulty.TryGetValue("Leviathan", out float order); List bosses = new List() { NPCType(), NPCType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = "By killing an unknown entity in the Ocean Biome"; string despawn = CalamityUtils.ColorMessage("The aquatic entities sink back beneath the ocean depths.", new Color(0x7F, 0xFF, 0xD4)); @@ -844,6 +844,7 @@ namespace CalamityMod //Entropy's Vigil is a bruh moment sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List() { ProjectileType(), ProjectileType()}); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index eff39b30d3..73bdd0b73f 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -627,6 +628,7 @@ namespace CalamityMod.NPCs.Leviathan DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Equipment DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs new file mode 100644 index 0000000000..a262d973a0 --- /dev/null +++ b/Projectiles/Summon/GastricBelcher.cs @@ -0,0 +1,352 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class GastricBelcher : ModProjectile + { + private bool initialized = false; + private int bubbleCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gastric Belcher"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + //Set namespaces + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = projectile.Calamity(); + + //On spawn effects + if (!initialized) + { + //Set constants + modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); + modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + //Spawn dust + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 33, + 89 + }); + Vector2 direction = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f; + direction = direction.RotatedBy((double)((dustIndex - (dustAmt / 2f - 1f)) * MathHelper.TwoPi / dustAmt), default) + projectile.Center; + Vector2 dustVel = direction - projectile.Center; + int water = Dust.NewDust(direction + dustVel, 0, 0, randomDust, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity = dustVel; + } + initialized = true; + } + + //Flexible minion damage update + if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(modProj.spawnedPlayerMinionProjectileDamageValue / + modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); + projectile.damage = damage2; + } + + //Update frames + if (projectile.frameCounter++ % 6 == 0) + { + projectile.frame++; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + //Set up buff and timeLeft + bool typeCheck = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (typeCheck) + { + if (player.dead) + { + modPlayer.gastricBelcher = false; + } + if (modPlayer.gastricBelcher) + { + projectile.timeLeft = 2; + } + } + + //Anti sticky movement to prevent overlapping minions + float antiStickMvt = 0.05f; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + bool correctMinion = proj.type == ModContent.ProjectileType(); + if (projIndex != projectile.whoAmI && proj.active && proj.owner == projectile.owner && correctMinion && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) + { + if (projectile.position.X < proj.position.X) + { + projectile.velocity.X -= antiStickMvt; + } + else + { + projectile.velocity.X += antiStickMvt; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= antiStickMvt; + } + else + { + projectile.velocity.Y += antiStickMvt; + } + } + } + + //Find a target + float maxDistance = 700f; + Vector2 targetVec = projectile.position; + Vector2 half = new Vector2(0.5f); + bool foundTarget = false; + //If targeting something, prioritize that enemy + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + //Adding a check on the NPC's size allows it to target big things like Providence + Vector2 sizeCheck = npc.position + npc.Size * half; + //Check if blocks are in the way + bool collisionCheck = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + //Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && targetDist < maxDistance && collisionCheck) + { + maxDistance = targetDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + else + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + bool collisionCheck = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && targetDist < maxDistance && collisionCheck) + { + maxDistance = targetDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + } + + //If too far, make the minion start returning to the player. + float returnDist = 1000f; + if (foundTarget) + { + //Max travel distance increases if targeting something + returnDist = 2200f; + } + if (Vector2.Distance(player.Center, projectile.Center) > returnDist) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + + //If a target is found, move toward it + if (foundTarget && projectile.ai[0] == 0f) + { + Vector2 vecToTarget = targetVec - projectile.Center; + float targetDist = vecToTarget.Length(); + vecToTarget.Normalize(); + //If farther than 200 pixels, move toward it + if (targetDist > 200f) + { + float speedMult = (targetDist > 400f) ? 12f : (targetDist > 250) ? 6f : 3f; + vecToTarget *= speedMult; + projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + } + //Otherwise, back it up slowly + else + { + float speedMult = -3f; + vecToTarget *= speedMult; + projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + } + } + + //If not targeting something, act passively + else + { + bool returningToPlayer = false; + if (!returningToPlayer) + { + returningToPlayer = projectile.ai[0] == 1f; + } + //Move faster if actively returning to the player + float speedMult = 10f; + if (returningToPlayer) + { + speedMult = 21f; + } + Vector2 vecToPlayer = player.Center - projectile.Center + new Vector2(0f, -60f); + float playerDist = vecToPlayer.Length(); + //Slow down if near the player + if (playerDist < 200f && speedMult > 8f) + { + speedMult = 1f; + } + //If close enough to the player, return to normal + if (playerDist < 150f && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + //If abnormally far, teleport to the player + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - (projectile.width / 2f); + projectile.position.Y = player.Center.Y - (projectile.height / 2f); + projectile.netUpdate = true; + } + //Move toward player if more than 70 pixels away + if (playerDist > 70f) + { + vecToPlayer.Normalize(); + vecToPlayer *= speedMult; + projectile.velocity = (projectile.velocity * 40f + vecToPlayer) / 41f; + } + //Move if still + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + + //Update sprite direction and rotation + if (foundTarget) + { + projectile.spriteDirection = projectile.direction = ((targetVec.X - projectile.Center.X) > 0).ToDirectionInt(); + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi), 0.1f); + } + else + { + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + } + + //Increment attack cooldown + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += Main.rand.Next(1, 4); + } + //Set the minion to be ready for attack + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + //Return if on attack cooldown, has no target, or returning to the player + if (projectile.ai[0] != 0f || !foundTarget || projectile.ai[1] != 0f) + return; + + if (Main.myPlayer == projectile.owner) + { + //Play vomit sound + if (modPlayer.soundCooldown <= 0) + { + Main.PlaySound(SoundID.NPCKilled, (int)projectile.Center.X, (int)projectile.Center.Y, 13, 0.5f, 0f); + modPlayer.soundCooldown = Main.rand.Next(120, 180); + } + + //Increment the attack counter + projectile.ai[1]++; + + int projType = ModContent.ProjectileType(); + + //Calculate the general velocity + Vector2 velocity = targetVec - projectile.Center; + velocity.Normalize(); + + //Add some inaccuracy for the vomit projectiles + float vomitSpeedMult = 16f; + Vector2 vomitVel = velocity * vomitSpeedMult; + vomitVel.Y += Main.rand.NextFloat(-30f, 30f) * 0.05f; + vomitVel.X += Main.rand.NextFloat(-30f, 30f) * 0.05f; + + //Fire the vomit projectile + Projectile.NewProjectile(projectile.Center, vomitVel, projType, projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(3), 0f); + + //Fire 5 bubbles for every three attacks + if (bubbleCounter++ % 3 == 2) + { + for (int projCount = 0; projCount < 5; projCount++) + { + //Add a shotgun spread to the bubbles + float bubbleSpeedMult = 14f; + Vector2 bubbleVel = velocity * bubbleSpeedMult; + bubbleVel.Y += Main.rand.NextFloat(-50f, 50f) * 0.05f; + bubbleVel.X += Main.rand.NextFloat(-50f, 50f) * 0.05f; + + Projectile.NewProjectile(projectile.Center, bubbleVel, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + projectile.netUpdate = true; + } + } + + //This minion does no contact damage + public override bool CanDamage() => false; + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = frameHeight * projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/GastricBelcher.png b/Projectiles/Summon/GastricBelcher.png new file mode 100644 index 0000000000000000000000000000000000000000..f5fd2d0d20679eb7aebba2d272142f03cf6a76c1 GIT binary patch literal 2951 zcmV;23wZR2P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;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KvH05ODE?C$^o002ovPDHLkV1k&&!s7q{ literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/GastricBelcherBubble.cs b/Projectiles/Summon/GastricBelcherBubble.cs new file mode 100644 index 0000000000..786a429c28 --- /dev/null +++ b/Projectiles/Summon/GastricBelcherBubble.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class GastricBelcherBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gastric Bubble"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = projectile.height = 18; + projectile.minion = true; + projectile.timeLeft = 180; + projectile.aiStyle = 72; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + Vector2 center = projectile.Center; + for (int dustIndex = 0; dustIndex < 10; ++dustIndex) + { + int scalar = (int)(10 * projectile.ai[1]); + int bubble = Dust.NewDust(projectile.Center - Vector2.One * scalar, scalar * 2, scalar * 2, 212, 0.0f, 0.0f, 0, new Color(), 1f); + Dust dust = Main.dust[bubble]; + Vector2 dustVec = Vector2.Normalize(dust.position - projectile.Center); + dust.position = projectile.Center + dustVec * scalar * projectile.scale; + dust.velocity = dustIndex >= 30 ? dustVec * Main.rand.Next(45, 91) / 10f : dustVec * dust.velocity.Length(); + dust.color = Main.hslToRgb(0.4f + Main.rand.NextFloat() * 0.2f, 0.9f, 0.5f); + dust.color = Color.Lerp(dust.color, Color.White, 0.3f); + dust.noGravity = true; + dust.scale = 0.7f; + } + } + } +} diff --git a/Projectiles/Summon/GastricBelcherBubble.png b/Projectiles/Summon/GastricBelcherBubble.png new file mode 100644 index 0000000000000000000000000000000000000000..c919f9c2d54524254ff3c838b2e7b0174e9552ad GIT binary patch literal 436 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|mUKs7M+SzC{oH>NS%G}U;vjb? zhIQv;UIIA^$sR$z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD8ZKG z?e4JZuHmxlWjh7m!sjy z76yg*J(f%l7YQ>b+@H=Ma#Ny#W2u2tQDG!w!uEe93~TcqiTcgo&Jglkm|@@fS8NLB z%y+qjncQ5*ImzS1-znLO#m7^sT#V*k%l#eS>v~xIvhuIh3$FV!?vS^s;*Aeq8NU3v zaWY4Z`7MOb-(hfZvRtC|J*LEu}qaesV~;fHS@=lbSwGQ z3MX^&OH7T5R&29&Vsn_2-}HNh&!T<(d`$9TKO_Qv3IM}LsKhk_h& 16f) + { + projectile.velocity.Y = 16f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y); + //Dust effect + int splash = 0; + while (splash < 4) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 233, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); + splash += 1; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture; + switch (projectile.ai[0]) + { + case 1f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GastricBelcherVomit2"); + break; + case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GastricBelcherVomit3"); + break; + default: texture = Main.projectileTexture[projectile.type]; + break; + } + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/GastricBelcherVomit.png b/Projectiles/Summon/GastricBelcherVomit.png new file mode 100644 index 0000000000000000000000000000000000000000..6e22f7d0390b3488c3c38db10dd50e4859899924 GIT binary patch literal 437 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|mUKs7M+SzC{oH>NS%G}U;vjb? zhIQv;UIIA^$sR$z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD8ZKG z?e4orqeZ0Ra!)JMd$P`ya!JHiCmAS0^36DMZ zG$cG^%qe2seZ|R7;7EgFXpg{dRjy59g(|yOWFA{T^Z17uKlkU~+w){mDEsWITr*NG z-;wvqzRJ?}nCH&D?*}J&L}^Yo`Cjhux@7N!AD4bJygg^|f0aUGK%mVcR~5%-_tOh* z&VO3UzPRSz<_Z_Zj4R>wU!Ht;!*D0oR-{9E@0JIVHH(Z+DzTm~N%J;Y^yJeU37+GT ze9zT0A0B%>TmAFz{=elHWP1+W%Ts-~T6LlE<*2O=Vj>==vdY`;ryo(}a#Y~HbuWVX z{QCUXbNu(FEO)3`w5e`(@Wbo=n>7C=%GEOYm_{=4{d{l(7(hZLt`R`w>1O3$l$n}W bl30?NpT}U>67l9eP?o{d)z4*}Q$iB}z8|n6 literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/GastricBelcherVomit2.png b/Projectiles/Summon/GastricBelcherVomit2.png new file mode 100644 index 0000000000000000000000000000000000000000..717b9e9ebe07b4b5bc79cadbed73e893303c2f44 GIT binary patch literal 421 zcmeAS@N?(olHy`uVBq!ia0vp^LO?9Q!3HFy+4N(86id3JuOkD)#(wTUiL5|AV{wqX z6T`Z5GB1G~g=CK)Uj~LMH3o);76yi2K%s^g3=E|P3=FRl7#OT(FffQ0%-I!a1C(G( z@^*J&_z!{$_AZ|c6#4Aw;uvCaI@xDSP~ri$lqHrDATZD7???IBdscCoD>E}QAAV~c zF9{N!A+drbB7w)!P>&4=+T7Rg``f;&r4a}g8iWh3KKAeA_y5Yfd#d!D$~}9!Wq?|l z4^Oh~2WgdHxvKc*ySe9RI0D=u$pQ~~G z|N3=54+t!pb!JPUU~+AP9MGh+HFx)Y=5}4Uic6YHUTk%UzkAPyJ#F*mB{0~2^Rug9 z3_i~h>i^WB$?$?VV;rByjGBKRxsSFw#mMx4jC#M%@zbL}$>l3vD={oT;r&50@kcPw q`$8qI5kTbWX60X$nVMIUSdy8a$6(kJ@#Z~Hmci52&t;ucLK6VY$CP;h literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/GastricBelcherVomit3.png b/Projectiles/Summon/GastricBelcherVomit3.png new file mode 100644 index 0000000000000000000000000000000000000000..83ec95521f7990900109bdb9d7660eaa4224794d GIT binary patch literal 447 zcmeAS@N?(olHy`uVBq!ia0vp^B0wy}!3HFwFZ>e#QY`6?zK#qG8~eHcB(ehejKx9j zP7LeL$-D$|6p}rHd>I(3)EF2VS{N990fib~Fff!FFfhDIU|_JC!N4G1FlSew4N!tD z$=lt9;Xep2*t>i(&?H_@7sn8b(_5z)W;reDe}!N1fnw>JX^ZkYK&MH^X6zf&HfL^RM28$~>oTT;iZrKU%|1C Date: Tue, 26 May 2020 07:53:01 -0500 Subject: [PATCH 2/8] SSV rework (also ExpandHitboxBy method) --- CalamityMod.cs | 4 + Effects/TentacleShader.xnb | Bin 0 -> 2256 bytes Items/Weapons/Magic/SubsumingVortex.cs | 26 +-- Projectiles/CalamityGlobalProjectile.cs | 15 ++ Projectiles/Magic/EnormousConsumingVortex.cs | 204 +++++++++++++++++ Projectiles/Magic/EnormousConsumingVortex.png | Bin 0 -> 1313 bytes Projectiles/Magic/SubsumingTentacle.cs | 160 ++++++++++++++ Projectiles/Magic/SubsumingTentacle.png | Bin 0 -> 2903 bytes Projectiles/Magic/Vortex.cs | 205 +++++++++--------- Projectiles/Magic/Vortex.png | Bin 1408 -> 1412 bytes 10 files changed, 496 insertions(+), 118 deletions(-) create mode 100644 Effects/TentacleShader.xnb create mode 100644 Projectiles/Magic/EnormousConsumingVortex.cs create mode 100644 Projectiles/Magic/EnormousConsumingVortex.png create mode 100644 Projectiles/Magic/SubsumingTentacle.cs create mode 100644 Projectiles/Magic/SubsumingTentacle.png diff --git a/CalamityMod.cs b/CalamityMod.cs index c1f1ddf3fd..b062be8b41 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -121,6 +121,7 @@ namespace CalamityMod public static Texture2D AstralSky; public static Effect CustomShader; public static Effect LightShader; + public static Effect TentacleShader; // DR data structure public static SortedDictionary DRValues; @@ -278,6 +279,7 @@ namespace CalamityMod AstralSky = ModContent.GetTexture("CalamityMod/ExtraTextures/AstralSky"); CustomShader = GetEffect("Effects/CustomShader"); LightShader = GetEffect("Effects/LightBurstShader"); + TentacleShader = GetEffect("Effects/TentacleShader"); Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); @@ -312,6 +314,8 @@ namespace CalamityMod Filters.Scene["CalamityMod:LightBurst"] = new Filter(new ScreenShaderData(new Ref(LightShader), "BurstPass"), EffectPriority.VeryHigh); Filters.Scene["CalamityMod:LightBurst"].Load(); + GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref(TentacleShader), "BurstPass"); + RipperUI.Reset(); AstralArcanumUI.Load(this); diff --git a/Effects/TentacleShader.xnb b/Effects/TentacleShader.xnb new file mode 100644 index 0000000000000000000000000000000000000000..02171ce264f7c47c88bbd351e61025fa102eb92e GIT binary patch literal 2256 zcma)6J!~9B6n=ZZ8|>teXh2xv1VS>%I{D5vI*XWdeBsBk3C8CO?xM|kom=I6YxZ_! zj3_puF%ks`3P2QFP(*jl75p?2q@Y1U!lk98pm32QLNrLw`1sz;&UzGKiLu|#``&!- zXWrY}%_~cLSvoX{j8Ba>otEeJ+-<+K*|kcqdDf1-=Xy6wb+_x=UBC3|_O{*f*KKRd z_NIzwv0wMB-L})}O%<=&Ue9s63$vwZ{+lY+gN`3~_CnVVe9!7k71x669jCQo?{By_ z?e0Q#w$j?JUbo9z_T2Q`+zjzDCQ;pQV}IUxTtN9S&W%p~PD%YSY#GRegvk?b6fEyp zH|%LroWrC~B4zQ$2D%|v;Cpzd~Dj}o8T8sWcuxb~o7x7_ZQ!C;W?N@VO_!y6a1J+f?y8XYg~( z-*9$p?COr+Xk4Cw27%;~b-97pve)tcB)&%)nMbKXDgX!XxL#*#&FwkjI>~*;~q=ikb|$kr)s>c@s*8z)jAI)Saoi+{e~!#uAHnW-UpiRqcw_qiTA7FypMNG z`3(QJPg&H?cjeyci)XVGcs+m3>h+-W-8Sr2yX(9g*kz&%zQR8vYjgp@ttqH?_V@K(A_e6S}YA zkD=ez@Pkjvd0VguF?!fClK?%}VH`;e62o!TA<8(U9p>f4l|alz&@UeaF1 zOdqkUZ^2+NP?abj>3RCpzXS3&yW6`~xi(G7SGzd5{zCDM)y8VE(dG|&vF`5dIvptU zrOHdC`MFA|Qk|Wp!QgG8Y?=xYqSvloSibb(KhM4b{U^3(V82)RW$|8N`R>fjObsIJ zS-}r$T+vrwJ|%YM=U{I(n~UrpOO5S$*p2gt-&ted|1jvk`0_^w2lH$JTMz%ae4~DV+37LgR=?3&AF}?yg$3w$B7T6$(2^cfOcvCoU@(72RzrwIlgubRy zln&E$9O1Wxf58pm7ve0oWx#F1#-iK$@asni7(F3sWnMp&aS|Odn$h!!&3X7dk6dP) zFHKnyH%CuLIU0$4Y1F{^bBN70zC()gT;na&A7c}-n#eVZ_)aM@;WL5{#W)XqENs$W z@NZ=hb5qp9=c6!-+9WT@A^c>_yvV`ld?(JqIr+XU%t@mzKF=a9=aK!RVH$NkCwe0L j$y`3;oU)gS+Z0&F;`o$c!W<36#=UtKNH69Z@-O{gziCcK literal 0 HcmV?d00001 diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index 48c8c0223f..3f086707c4 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Magic; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -12,15 +11,19 @@ namespace CalamityMod.Items.Weapons.Magic { public class SubsumingVortex : ModItem { + public const int MaxVortexCount = 4; public override void SetStaticDefaults() { DisplayName.SetDefault("Subsuming Vortex"); - Tooltip.SetDefault("Fires 3 vortexes of elemental energy"); + Tooltip.SetDefault("Fires a giant slow-moving vortex\n" + + "When an enemy is nearby, the vortex releases tentacles that redirect towards the enemy.\n" + + "After some time, the vortex slows down, charges, and eventually explodes.\n" + + $"Only {MaxVortexCount} vortexes can exist at once."); } public override void SetDefaults() { - item.damage = 520; + item.damage = 480; item.magic = true; item.mana = 20; item.width = 38; @@ -28,14 +31,14 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item84; item.useTime = 20; item.useAnimation = 20; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7f; item.Calamity().customRarity = CalamityRarity.Violet; } @@ -45,16 +48,11 @@ namespace CalamityMod.Items.Weapons.Magic spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < MaxVortexCount; + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int num6 = 3; - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; - float ai = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, ai); - } + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); return false; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 7f077815ca..ef30493375 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2159,6 +2159,21 @@ namespace CalamityMod.Projectiles projectile.spriteDirection = projectile.direction; projectile.rotation = projectile.velocity.X * tiltFloat; } + public static void ExpandHitboxBy(Projectile projectile, int width, int height) + { + projectile.position = projectile.Center; + projectile.width = width; + projectile.height = height; + projectile.position -= projectile.Size * 0.5f; + } + public static void ExpandHitboxBy(Projectile projectile, int newSize) + { + ExpandHitboxBy(projectile, newSize, newSize); + } + public static void ExpandHitboxBy(Projectile projectile, float expandRatio) + { + ExpandHitboxBy(projectile, (int)(projectile.width * expandRatio), (int)(projectile.height * expandRatio)); + } #endregion } } diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs new file mode 100644 index 0000000000..ccc378555d --- /dev/null +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -0,0 +1,204 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class EnormousConsumingVortex : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float IdealScale + { + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + public const int TentacleSpawnRate = 30; + public const int PulseInterval = 18; + public const float PulseHitboxExpandRatio = 2.5f; + public const float RadialOffsetVarianceFactor = 0.1f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vortex"); + ProjectileID.Sets.NeedsUUID[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.scale = 0.0004f; + projectile.timeLeft = 540; + projectile.tileCollide = false; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 17; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(IdealScale); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + IdealScale = reader.ReadSingle(); + } + + public override void AI() + { + projectile.rotation += MathHelper.ToRadians(8f); // Spin 2 win. + projectile.alpha = (int)MathHelper.Lerp(255, 0, Utils.InverseLerp(0f, 20f, Time, true)); // Fade in completely after 20 frames. + projectile.scale = MathHelper.Lerp(0.0004f, IdealScale, Utils.InverseLerp(0f, 30f, Time, true)); // Expand completely after 30 frames. + + // Determine the ideal scale in the first frame. + if (IdealScale == 0f) + { + IdealScale = Main.rand.NextFloat(2.2f, 3f); + projectile.netUpdate = true; + } + + // Target enemy if possible and idly spawn tentacles. + if (Time < 300) + { + TargetingMovement(); + if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.netMode != NetmodeID.MultiplayerClient) + { + ProduceSubsumingHentai(); + } + } + // Slow down and pulse frequently. + else if (Time < 480) + { + projectile.velocity *= 0.96f; + if (Time % PulseInterval == 0f) + { + PulseEffect(); + } + } + else if (Time == 520f) + { + ExplodeEffect(); + projectile.Kill(); + } + CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(projectile.scale * 62)); + Time++; + } + public void ProduceSubsumingHentai() + { + float xStartingAcceleration = Main.rand.NextFloat(0.001f, 0.04f) * Main.rand.NextBool(2).ToDirectionInt(); + float yStartingAcceleration = Main.rand.NextFloat(0.001f, 0.04f) * Main.rand.NextBool(2).ToDirectionInt(); + Projectile subsumingHentai = Projectile.NewProjectileDirect(projectile.Center, + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(9f, 13f), + ModContent.ProjectileType(), + (int)(projectile.damage * 0.6), + projectile.knockBack * 0.6f, + projectile.owner, + xStartingAcceleration, + yStartingAcceleration); + subsumingHentai.tileCollide = false; + } + + public void TargetingMovement() + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(1500f, true); + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * 5f + projectile.DirectionTo(potentialTarget.Center) * 7f) / 6f; + } + } + public void PulseEffect() + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, PulseHitboxExpandRatio); + projectile.Damage(); + if (!Main.dedServ) + { + Main.PlaySound(SoundID.Item43, projectile.Center); + for (int i = 0; (float)i < 85; i++) + { + float angle = i / 85f * MathHelper.TwoPi; + Vector2 spawnPosition = projectile.Center + angle.ToRotationVector2() * (500f + Main.rand.NextFloat(-8f, 8f)); + Vector2 velocity = (angle - (float)Math.PI).ToRotationVector2() * Main.rand.NextFloat(27f, 38.5f); + Dust dust = Dust.NewDustPerfect(spawnPosition, 264, velocity); + dust.scale = 0.9f; + dust.fadeIn = 1.25f; + dust.color = Main.hslToRgb(i / 85f, 1f, 0.8f); + dust.noGravity = true; + } + } + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 1f / PulseHitboxExpandRatio); + } + public void ExplodeEffect() + { + Main.PlaySound(SoundID.Zombie, projectile.Center, 104); + if (!Main.dedServ) + { + for (int i = 0; i < 200; i++) + { + Vector2 velocity = Main.rand.NextVector2Circular(50f, 50f); + Dust dust = Dust.NewDustPerfect(projectile.Center, 264, velocity); + dust.color = Main.hslToRgb(i / 100f % 1f, 1f, 0.8f); + dust.fadeIn = 1.25f; + dust.noGravity = true; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC closestTarget = projectile.Center.ClosestNPCAt(1600f, true); + for (int i = 0; i < 12; i++) + { + float rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Vector2 velocity = Vector2.UnitY.RotatedBy(rotation); + if (closestTarget != null) + velocity = projectile.DirectionTo(closestTarget.Center).RotatedByRandom(0.4f); + velocity *= Main.rand.NextFloat(3f, 5f); + Projectile.NewProjectileDirect(projectile.Center, + velocity, + ModContent.ProjectileType(), + (int)(projectile.damage * 0.7), + projectile.knockBack, + projectile.owner, + 0f, + Main.rand.NextFloat(0.5f, 1.8f)); + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + int vortexesToDraw = 27; + for (int i = 0; i < vortexesToDraw; i++) + { + float rotation = MathHelper.TwoPi / i * vortexesToDraw + projectile.rotation; + float drawScale = projectile.scale * 0.66f; + + drawScale *= (float)(Math.Cos(Time / 18f + rotation * 2f) + 1f) * 0.3f + 0.7f; // Range of 0.7 to 1. Used to give variance with the scale. + float offsetFactor = (float)(Math.Sin(Time / 18f + rotation * 2f) + 1f) * 0.2f + 0.8f; // Range of 0.8 to 1. + + // Due to the way RotatedBy works, the offset can be negative, giving the projectile a + // dual buzzsaw look. + Vector2 drawOffset = Vector2.UnitX.RotatedBy(rotation) * 30f * offsetFactor * drawScale; + Vector2 drawPosition = projectile.Center + drawOffset - Main.screenPosition; + Color colorToDraw = Main.hslToRgb((i / (float)vortexesToDraw + Time / 40f) % 1f, 1f, 0.75f); + spriteBatch.Draw(ModContent.GetTexture(Texture), + drawPosition, + null, + colorToDraw * 0.7f, + rotation, + ModContent.GetTexture(Texture).Size() * 0.5f, + drawScale, + SpriteEffects.None, + 0f); + } + return false; + } + } +} diff --git a/Projectiles/Magic/EnormousConsumingVortex.png b/Projectiles/Magic/EnormousConsumingVortex.png new file mode 100644 index 0000000000000000000000000000000000000000..0e1de2dd8f5d5f4288a680ea922eefdf964e5b0f GIT binary patch literal 1313 zcmV++1>X9JP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1hz>;K~!i%?VDX_ z990;GC)sS1P-#{)rY(v}p<;94MYPfdz4FFZ(JCcWwqPWnO>erQ7kVK@MG!Pmgep>q znAlMKsXrK@dLg0_Dl7PJLxWUoFqWE0u!WLr<9zR&Z{7KrvvX#5)&}N0Fn!O=HtFs> z=R4=@%(TUc$>QXV$mwgYLo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$kD&m*?@fg*SkWm^q5jHtiD53n8_hbO*1Jq?l}Jf X`le^I_;cv<00000NkvXXu0mjf7PhWi literal 0 HcmV?d00001 diff --git a/Projectiles/Magic/SubsumingTentacle.cs b/Projectiles/Magic/SubsumingTentacle.cs new file mode 100644 index 0000000000..1172522660 --- /dev/null +++ b/Projectiles/Magic/SubsumingTentacle.cs @@ -0,0 +1,160 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class SubsumingTentacle : ModProjectile + { + public int AlphaFade + { + get => (int)projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + public Vector2 OffsetAcceleration + { + get => new Vector2(projectile.ai[0], projectile.ai[1]); + set + { + projectile.ai[0] = value.X; + projectile.ai[1] = value.Y; + } + } + public const float SegmentOffset = 5f; + public const float MaxArcingSpeed = 16f; + public const float MaxHomingSpeed = 18f; + public const float MaxEnemyDistance = 1450f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 75; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.MaxUpdates = 2; + projectile.magic = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 16; + } + + public override void AI() + { + if (!projectile.tileCollide) + { + AlphaFade++; + projectile.alpha = AlphaFade; + if (projectile.alpha >= 255) + { + projectile.Kill(); + return; + } + } + // Here, the old positions act more like "control points" than old postions, and will be referred as such henceforth. + // Each control point should have a set offset, to give a "chain" effect. + for (int i = 1; i < projectile.oldPos.Length; i++) + { + projectile.oldPos[i] = projectile.oldPos[i - 1] + Vector2.Normalize(projectile.oldPos[i] - projectile.oldPos[i - 1]) * SegmentOffset; + } + CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(20f * projectile.scale)); + if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height) && projectile.tileCollide) + { + projectile.tileCollide = false; + } + + NPC closestTarget = projectile.Center.ClosestNPCAt(MaxEnemyDistance, true); + if (closestTarget != null) + { + HomingMovement(closestTarget); + } + else + { + ArcingMovement(); + } + projectile.scale -= closestTarget == null ? 0.007f : 0.004f; + if (projectile.scale <= 0.05f) + { + projectile.Kill(); + } + } + public void ArcingMovement() + { + // Cause the tentacle to arc around at an increasingly fast rate. + projectile.velocity += OffsetAcceleration; + if (projectile.velocity.Length() > MaxArcingSpeed) + { + projectile.velocity.Normalize(); + projectile.velocity *= MaxArcingSpeed; + } + + // Accelerate the arc. + OffsetAcceleration *= 1.035f; + } + public void HomingMovement(NPC closestTarget) + { + float angleOffset = MathHelper.WrapAngle(projectile.AngleTo(closestTarget.Center) - projectile.velocity.ToRotation()); + angleOffset = MathHelper.Clamp(angleOffset, -0.2f, 0.2f); + + if (projectile.Distance(closestTarget.Center) > 65f) + { + projectile.velocity = projectile.velocity.RotatedBy(angleOffset); + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * MaxHomingSpeed; + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + + if (projectile.scale < 1f) + { + for (int i = 10; i < projectile.oldPos.Length; i++) + { + var tentacleShader = GameShaders.Misc["CalamityMod:SubsumingTentacle"]; + tentacleShader.UseImage("Images/Misc/Perlin"); + + Vector2 drawPos = projectile.oldPos[i] + ModContent.GetTexture(Texture).Size() / 2f - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY; + float scale = MathHelper.Lerp(0.05f, 1.3f, i / (float)projectile.oldPos.Length) * projectile.scale; + scale = MathHelper.Clamp(scale, 0f, 2f); + Color color = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - i) / projectile.oldPos.Length); + + spriteBatch.Draw(ModContent.GetTexture(Texture), drawPos, null, color, projectile.rotation, ModContent.GetTexture(Texture).Size() / 2f, scale, SpriteEffects.None, 0f); + tentacleShader.UseSaturation(i / (float)projectile.oldPos.Length); // A "completion ratio" for the shader. Used to make the entire tentacle appear multi-colored. + tentacleShader.UseOpacity(1f / projectile.oldPos.Length); // A "step value" for the shader. Used to give variance in color at each individual segment. + tentacleShader.Apply(null); + } + } + return false; + } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + for (int i = 1; i < projectile.oldPos.Length; i++) + { + float scale = MathHelper.Lerp(0.05f, 1f, i / (float)projectile.oldPos.Length) * projectile.scale * 0.85f; + if (targetHitbox.Intersects(new Rectangle((int)projectile.oldPos[i].X, (int)projectile.oldPos[i].Y, (int)(projectile.width * scale), (int)(projectile.height * scale)))) + return true; + } + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.velocity = oldVelocity; + return false; + } + } +} diff --git a/Projectiles/Magic/SubsumingTentacle.png b/Projectiles/Magic/SubsumingTentacle.png new file mode 100644 index 0000000000000000000000000000000000000000..c6b3592c9f186c85d600075344c5971cf65960c4 GIT binary patch literal 2903 zcmV-d3#jyoP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGizyJUazyWI3i3tDz3hYTlK~#8N?VRg# z6Ui0Dv1}RH^80Pfn}w}p$tGU|e95NB9~~;2$_7#uDx0d^u=&6e9)5r=Sue{ESuf}O z?(`LsY%^XKQnlGRra3b`Gq-Q|J-Xe~G7Oyi-=U|i0U;co2}eRWbo8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<7l73jdD-VQwjdNRDW$dy{rk!G`Sft%bxx9@ZUw!r0zu?!##`*?+ zD)+p`Z`M8Z12xevj_D`Bu3+{ZiGpHa(d>iOX}M$SVitpw-!MyXB2H3}!>+l4SO>w$ zZ@DJuL9Bv&*72OAbx!h|_6gqNT?%saD5*auxso(1CI8yz=ZLc?$kC%D&q=N%=WOyX z4u4+wAqsMws3d2;?}mNltsG^u6#GRmzxxO$|LXbw1n;9DN6)japm*dbTR-_a%Fl~KZ-_0w=#PVpVU53QJf zBnpbb$5c>1dfJLpPCvSo;`k_v=|`fVcjDZ+{{kvxraID#`U(I5002ovPDHLkV1jzR Bt@Ho@ literal 0 HcmV?d00001 diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index 1f522fd091..05d6ae0066 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -2,7 +2,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +9,25 @@ namespace CalamityMod.Projectiles.Magic { public class Vortex : ModProjectile { + public float TargetCheckCooldown + { + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + public float Time + { + get => projectile.localAI[1]; + set => projectile.localAI[1] = value; + } + public int TargetIndex + { + get => (int)projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const float AngularMovementSpeed = 0.1f; + public const float Acceleration = 0.0025f; + public const float TargetCheckInterval = 30f; + public const float MaximumTargetDistance = 1200f; public override void SetStaticDefaults() { DisplayName.SetDefault("Vortex"); @@ -24,10 +42,10 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 10; - projectile.timeLeft = 300; + projectile.penetrate = 1; projectile.tileCollide = true; projectile.extraUpdates = 4; + projectile.timeLeft = 115 * projectile.extraUpdates; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; @@ -35,119 +53,98 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[1] += 1f; + // At the very beginning, start without a target. + if (Time == 0f) + { + TargetIndex = -1; + } + Time++; if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) { - int num713 = 5; - for (int num714 = 0; num714 < num713; num714++) - { - Vector2 vector58 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width, (float)projectile.height) / 2f; - vector58 = vector58.RotatedBy((double)(num714 - (num713 / 2 - 1)) * 3.1415926535897931 / (double)(float)num713, default) + projectile.Center; - Vector2 value25 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num715 = Dust.NewDust(vector58 + value25, 0, 0, 66, value25.X * 2f, value25.Y * 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.7f); - Main.dust[num715].noGravity = true; - Main.dust[num715].noLight = true; - Main.dust[num715].velocity /= 4f; - Main.dust[num715].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - projectile.rotation += projectile.velocity.X * 0.1f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); + VisualEffects(); } - int num716 = -1; - Vector2 vector59 = projectile.Center; - float num717 = 350f * projectile.ai[1]; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) - { - for (int num718 = 0; num718 < 200; num718++) - { - NPC nPC6 = Main.npc[num718]; - if (nPC6.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(num718 + 1))) - { - Vector2 center4 = nPC6.Center; - float num719 = Vector2.Distance(center4, vector59); - if (num719 < num717 && Collision.CanHit(projectile.position, projectile.width, projectile.height, nPC6.position, nPC6.width, nPC6.height)) - { - num717 = num719; - vector59 = center4; - num716 = num718; - } - } - } - if (num716 >= 0) - { - projectile.ai[0] = (float)(num716 + 1); - projectile.netUpdate = true; - } - } - if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) - { - projectile.localAI[0] = 30f; - } - bool flag32 = false; - if (projectile.ai[0] != 0f) - { - int num720 = (int)(projectile.ai[0] - 1f); - if (Main.npc[num720].active && !Main.npc[num720].dontTakeDamage && Main.npc[num720].immune[projectile.owner] == 0) - { - float num721 = Main.npc[num720].position.X + (float)(Main.npc[num720].width / 2); - float num722 = Main.npc[num720].position.Y + (float)(Main.npc[num720].height / 2); - float num723 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num721) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num722); - if (num723 < 1000f) - { - flag32 = true; - vector59 = Main.npc[num720].Center; - } - } - else - { - projectile.ai[0] = 0f; - flag32 = false; - projectile.netUpdate = true; - } - } - if (flag32) - { - Vector2 v = vector59 - projectile.Center; - float num724 = projectile.velocity.ToRotation(); - float num725 = v.ToRotation(); - float num726 = num725 - num724; - num726 = MathHelper.WrapAngle(num726); - projectile.velocity = projectile.velocity.RotatedBy(num726 * 0.1, default); - } - float num727 = projectile.velocity.Length(); - projectile.velocity.Normalize(); - projectile.velocity *= num727 + 0.0025f; + Movement(HandleTargeting()); + projectile.rotation += projectile.velocity.X * 0.1f; } - public override bool OnTileCollide(Vector2 oldVelocity) + public bool HandleTargeting() { - projectile.penetrate--; - if (projectile.penetrate <= 0) + float targetCheckDistance = 350f * projectile.ai[1]; + + // Reduce a cooldown. Nothing special here. + if (TargetCheckCooldown > 0f) { - projectile.Kill(); + TargetCheckCooldown--; } - else + + // Attempt to find a target if the projectile has none. + if (TargetIndex == -1 && TargetCheckCooldown <= 0f) { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) + NPC potentialTarget = projectile.Center.ClosestNPCAt(targetCheckDistance, true); + if (potentialTarget != null) + TargetIndex = potentialTarget.whoAmI; + projectile.netUpdate = true; + } + if (TargetCheckCooldown <= 0f && TargetIndex == -1) + { + TargetCheckCooldown = TargetCheckInterval; + } + bool stillCanReachTarget = false; + // Ensure that the target is still in reach if there is indeed a target. + if (TargetIndex != -1) + { + stillCanReachTarget = projectile.Distance(Main.npc[TargetIndex].Center) < MaximumTargetDistance; + if (!stillCanReachTarget) { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; + TargetIndex = -1; + projectile.netUpdate = true; } } - return false; + return stillCanReachTarget; + } + + public void VisualEffects() + { + // Generate idle circular dust and light after 10 frames. + if (!Main.dedServ) + { + int dustCount = 5; + for (int i = 0; i < dustCount; i++) + { + Vector2 spawnPosition = projectile.Center + projectile.Size.RotatedBy(i / (float)dustCount * MathHelper.TwoPi) * 0.5f; + Vector2 velocity = Main.rand.NextFloat(MathHelper.TwoPi).ToRotationVector2() * Main.rand.NextFloat(6f, 16f); + Dust dust = Dust.NewDustPerfect(spawnPosition, 66, velocity, 0, Main.DiscoColor, 0.7f); + dust.noGravity = true; + dust.noLight = true; + dust.velocity = -projectile.velocity; + } + } + // Fade in. + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + // And make rainbow light. + Lighting.AddLight(projectile.Center / 16, Main.DiscoColor.ToVector3()); + } + + public void Movement(bool stillCanReachTarget) + { + // Homing sharply towards the target in a circular fashion. + // The way this type of homing is by determining the offset between the angle to the target and the velocity's angle. + // This offset can be thought of as how much, in radians, the velocity would need to rotate to move towards the target. + // Then, the velocity is rotated by that offset (which, as established, would give perfect homing) multiplied by a <1 factor. + // This causes the velocity to constantly rotate sharply towards the target. + if (stillCanReachTarget) + { + float angleOffsetToTarget = projectile.AngleTo(Main.npc[TargetIndex].Center) - projectile.velocity.ToRotation(); + angleOffsetToTarget = MathHelper.WrapAngle(angleOffsetToTarget); // Ensure the offset is in the range of -pi to pi. + projectile.velocity = projectile.velocity.RotatedBy(angleOffsetToTarget * AngularMovementSpeed); + } + // Accelerate constantly with time. + float oldSpeed = projectile.velocity.Length(); + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * (oldSpeed + Acceleration); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Magic/Vortex.png b/Projectiles/Magic/Vortex.png index cbcf617436545602ba2029c8d6f274a105861040..fd7e0bf39c75fbc901636a91f95b93df7921025e 100644 GIT binary patch delta 1394 zcmV-&1&#WE3xo@hBYyw^b5ch_0Itp)=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi z!T%nTeuzjLM~BZNC<<``FX&R%MztdDr-o z&&K~m+P;tTdFsa;j%{6O$ZOo~>(Mn{uRANeherHNlI#6nyIThNxu9$L*Ltra&pv+& zDT$3c)YP;zwdbC^yEQWhlO4!`pGru=7Qnyfw||Bwdp|M5*Ee^4hm=Itc%o2hQ@Yd( zZQ9SaW=m-ZW&M3glzJ24KK}A1)3_HAi-LuSO?@^ZM~ZEfu9m#=+`%w9BO z4*UA+YrjMiTi@RCf|_Q?vs@HThr;(+Pn6)yY@rMQuB9||%{C({UA477K_cPA# zw|^anG#}kj-A$YkTYsp;v#CauplH*&XrtvNEZTH=|JJ6%wA$FXAF@S+HLXW)If83A ze@kqyOVdG-Eh08fq**;L>JqjO>G_y*@=WM?T9=O}vM9E`uGi*%S7f2k*W*r!tnul2 zT=MuY8q~Dw^M_zeXRj#pZ$j{ZPZ|5^D z=-Z16W2i^ixO+XWo)|=sBgqb&q4AzByl*pZyK0iu`o6j!Hq*^dokK?0_=oOqTYtK| z&zK6$<{8s%JrAPZ(va}HfBhBnONplUS0agRm1TP-RxNA+<*QAN%`}PUajs!WCi@qP zV;bfEhHi1XEZ=elWqd*B99d^S1p zo9A_jG+!^{G@WQ`#eUrw8AUxdE|@lMgHKbPGl_K0Bn<136Z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gtS|wy|>k-C4PUR)t7Q;w3O?l-AcE0pSVaTD{)cx zmQIq~J5A0iv1uVKHm}>dM2TLkqqYspACC{VWt}&F=9i~{bs3N;JKIi?F=txdY(EX8 z=f6cx-utEM2mmt|-m|n1!Xvg|>#j@>asLlXrjNJr0Ox%d~bSk%f(7K*HTGnI$EbVDc zf<18=Cktsi6?g-fQqV3SdaJ>PrHopM)#53f$ zmsQr!1L1lA*5((I0D-Nw>dW4`os+mo$lDQ5=LNfRwxh3~mp{;Id51fbQ-D2bkx$%7 z>;9o&k=_#u&CrCr=qEEy?|M6+qRbZc@1$h(A5~$+OhqoMy{)oW)k!|_jc3Zv2joj$ zw_Vp7PObT=xa||qt%B#=#CygE)v?6U)uA(%Oi%9t8zw9g(%Pt<8 From 68a47b51dc4c1343f50d2a8991b686a66f3e9713 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Thu, 28 May 2020 17:49:55 -0500 Subject: [PATCH 3/8] Photoviscerator changes --- CalamityMod.cs | 4 +- ExtraTextures/PhotovisceratorLight.png | Bin 0 -> 2903 bytes Items/Weapons/Ranged/Photoviscerator.cs | 59 ++++++-- Projectiles/Ranged/ExoFire.cs | 20 ++- Projectiles/Ranged/ExoLight.cs | 100 +++++++++++++ Projectiles/Ranged/ExoLight.png | Bin 0 -> 139 bytes Projectiles/Ranged/ExoLightBomb.cs | 184 ++++++++++++++++++++++++ Projectiles/Ranged/ExoLightBomb.png | Bin 0 -> 178 bytes Projectiles/Ranged/ExoLightBurst.cs | 91 ++++++++++++ Projectiles/Ranged/ExoLightBurst.png | Bin 0 -> 139 bytes Projectiles/Ranged/ExoSpark.cs | 84 +++++++++++ Projectiles/Ranged/ExoSpark.png | Bin 0 -> 742 bytes Utilities/CalamityUtils.cs | 13 ++ 13 files changed, 533 insertions(+), 22 deletions(-) create mode 100644 ExtraTextures/PhotovisceratorLight.png create mode 100644 Projectiles/Ranged/ExoLight.cs create mode 100644 Projectiles/Ranged/ExoLight.png create mode 100644 Projectiles/Ranged/ExoLightBomb.cs create mode 100644 Projectiles/Ranged/ExoLightBomb.png create mode 100644 Projectiles/Ranged/ExoLightBurst.cs create mode 100644 Projectiles/Ranged/ExoLightBurst.png create mode 100644 Projectiles/Ranged/ExoSpark.cs create mode 100644 Projectiles/Ranged/ExoSpark.png diff --git a/CalamityMod.cs b/CalamityMod.cs index b062be8b41..49a821bdd2 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -632,7 +632,9 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() }; projectileDestroyExceptionList = new List() diff --git a/ExtraTextures/PhotovisceratorLight.png b/ExtraTextures/PhotovisceratorLight.png new file mode 100644 index 0000000000000000000000000000000000000000..8e2d2a871cdedc2f8035aec442b4c527a2bf3160 GIT binary patch literal 2903 zcmV-d3#jyoP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D3hYTlK~#8N?VRg# z6Ui0Dv1}RH^80Pfn}w}p$tGU|e95NB9~~;2$_7#uDx0d^u=&6e9)5r=Sue{ESuf}O z?(`LsY%^XKQnlGRra3b`Gq-Q|J-Xe~G7Oyi-=U|i0U;co2}eRWbo8Hp6r=(tI0YY5 zL1x>Pk`iFYpa91y$(7R*tRkQ-z+KAvD2hrH6oU_`pdQ7zLL7dcPN#>%xdmr16_k`3 z=n2+Q`^Xg1YDdbEfb6`{Xw<`bkD~niLn|s#Pz-*If_k2Hh4d?ESO|O`J}-2i52w?{ z5>ijFBpg#rz0o){uGftZh3<24kD^>be%^)mQdFX#7`%^y?3sS0ID3v65#WpfkB*LJ z;j93UkB?8n5|mvZ5@1JDfF+n3T&-3s@SXtg@9!Je1o%LJ`*W1@`{t%ZK{5Ct3OZ3a zT{*^B0vUtH#>U3ssi~>yZk`Cr8K0P#fJZVJQv6m(Fln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 Bu4(`P literal 0 HcmV?d00001 diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 0442c34c4f..539de56830 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -10,34 +10,53 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Photoviscerator : ModItem { + public const int CooldownTime = 60 * 7; // 7 second cooldown. public override void SetStaticDefaults() { DisplayName.SetDefault("Photoviscerator"); Tooltip.SetDefault("90% chance to not consume gel\n" + - "Fires a stream of exo flames that literally melts everything"); + "Left clicking unleashes a spread of burning light that homes in on and sticks to enemies\n" + + "Right clicking fires a stream of exo flames and light bombs that explode into homing sparks"); } public override void SetDefaults() { - item.damage = 250; + item.damage = 230; item.ranged = true; item.width = 84; item.height = 30; item.useTime = 2; item.useAnimation = 10; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; - item.useAmmo = 23; + item.useAmmo = AmmoID.Gel; item.Calamity().customRarity = CalamityRarity.Violet; } + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = ModContent.ProjectileType(); + item.useTime = item.useAnimation = 27; + } + else + { + item.useTime = 2; + item.useAnimation = 10; + item.shoot = ModContent.ProjectileType(); + } + return base.CanUseItem(player); + } + public override Vector2? HoldoutOffset() { return new Vector2(-15, 0); @@ -45,11 +64,33 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int i = 0; i < 2; i++) + if (player.altFunctionUse == 2) { - float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Vector2 velocity = new Vector2(speedX, speedY); + position += velocity.ToRotation().ToRotationVector2() * 80f; + Projectile.NewProjectile(position, velocity.SafeNormalize(Vector2.Zero) * 17f, ModContent.ProjectileType(), damage * 3, knockBack, player.whoAmI); + } + else + { + for (int i = 0; i < 2; i++) + { + Vector2 velocity = new Vector2(speedX, speedY).RotatedByRandom(0.05f); + Projectile.NewProjectile(position, velocity, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + } + if (Main.rand.NextBool(8)) + { + for (int i = 0; i < 2; i++) + { + Vector2 velocity = new Vector2(speedX, speedY) * 2f; + position += velocity.ToRotation().ToRotationVector2() * 64f; + int yDirection = (i == 0).ToDirectionInt(); + velocity = velocity.RotatedBy(0.2f * yDirection); + Projectile lightBomb = Projectile.NewProjectileDirect(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + + lightBomb.localAI[1] = yDirection; + lightBomb.netUpdate = true; + } + } } return false; } diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index b49155e52c..c9cadc1118 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,8 +9,7 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoFire : ModProjectile { - public bool speedXChoice = false; - public bool speedYChoice = false; + public bool ProducedAcceleration = false; public override void SetStaticDefaults() { @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 24; + projectile.height = 24; projectile.friendly = true; projectile.ignoreWater = true; projectile.ranged = true; @@ -27,22 +27,18 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 10; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - projectile.timeLeft = 300; + projectile.timeLeft = 180; } public override void AI() { float speedX = 1f; float speedY = 1f; - if (!speedXChoice) + if (!ProducedAcceleration) { speedX = Main.rand.NextBool(2) ? 1.03f : 0.97f; - speedXChoice = true; - } - if (!speedYChoice) - { - speedY = Main.rand.NextBool(2) ? 1.03f : 0.97f; - speedYChoice = true; + projectile.velocity *= Utils.RandomVector2(Main.rand, 0.97f, 1.03f); + ProducedAcceleration = true; } projectile.velocity.X *= speedX; projectile.velocity.X *= speedY; diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs new file mode 100644 index 0000000000..b86913a0af --- /dev/null +++ b/Projectiles/Ranged/ExoLight.cs @@ -0,0 +1,100 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoLight : ModProjectile + { + public float OffsetSpeed + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float OffsetRotation + { + get => projectile.ai[1]; + set => projectile.ai[1] = value; + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light"); + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.timeLeft = 180; + } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + OffsetRotation = Main.rand.NextFloat(MathHelper.TwoPi); + OffsetSpeed = Main.rand.NextFloat(MathHelper.ToRadians(2.5f), MathHelper.ToRadians(4f)) * Main.rand.NextBool(2).ToDirectionInt(); + projectile.localAI[0] = 1f; + } + Projectile owner = Main.projectile[(int)projectile.localAI[1]]; + + // Ensure the owner is the correct projectile. + if (owner.type != ModContent.ProjectileType()) + projectile.Kill(); + + // Movement around the owner. + projectile.Center = owner.Center + OffsetRotation.ToRotationVector2() * (float)Math.Cos(OffsetRotation * 0.3f) * owner.Size * 0.5f; + projectile.rotation = (projectile.position - projectile.oldPos[1]).ToRotation(); + OffsetRotation += OffsetSpeed; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D lightTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/PhotovisceratorLight"); + for (int i = 0; i < projectile.oldPos.Length; i++) + { + float colorInterpolation = (float)Math.Cos(projectile.timeLeft / 16f + Main.GlobalTime / 20f + i / (float)projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + Color color = Color.Lerp(Color.LightGreen, Color.LightPink, colorInterpolation) * 0.4f; + color.A = 0; + Vector2 drawPosition = projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Color outerColor = color; + Color innerColor = color * 0.5f; + float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTime % 60f * MathHelper.TwoPi); + + // Become smaller the futher along the old positions we are. + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)projectile.oldPos.Length); + + Vector2 outerScale = new Vector2(1.65f) * intensity; + Vector2 innerScale = new Vector2(1.65f) * intensity * 0.7f; + outerColor *= intensity; + innerColor *= intensity; + spriteBatch.Draw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.6f, SpriteEffects.None, 0); + spriteBatch.Draw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.6f, SpriteEffects.None, 0); + } + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.CursedInferno, 180); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.Ichor, 180); + } + } +} diff --git a/Projectiles/Ranged/ExoLight.png b/Projectiles/Ranged/ExoLight.png new file mode 100644 index 0000000000000000000000000000000000000000..04c5646fded8c39b9fa4fb2cb4826b55a2aacdbb GIT binary patch literal 139 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI z1_r((Aj~*bn@<`j$X?><>&pIsosmIag3oHse4vnor;B5V#`)ww|Nq-FYc_N?x)`iV cT#~`S@HK*2wD-*0YM>ehPgg&ebxsLQ0I1_7Bme*a literal 0 HcmV?d00001 diff --git a/Projectiles/Ranged/ExoLightBomb.cs b/Projectiles/Ranged/ExoLightBomb.cs new file mode 100644 index 0000000000..2e6cd60982 --- /dev/null +++ b/Projectiles/Ranged/ExoLightBomb.cs @@ -0,0 +1,184 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoLightBomb : ModProjectile + { + public Vector2 InitialCenter; + public Vector2 Destination; + public const float MaxRadius = 90f; + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public int DustType + { + get => (int)projectile.ai[1]; + set => projectile.ai[1] = value; + } + public float YDirection + { + get => projectile.localAI[1]; + set => projectile.localAI[1] = value; + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light"); + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 40; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 127; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(YDirection); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + YDirection = reader.ReadSingle(); + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.DarkSlateGray.ToVector3()); + projectile.alpha = (int)MathHelper.Lerp(255, 127, Utils.InverseLerp(0f, 25f, Time, true)); + projectile.scale = MathHelper.Lerp(0.001f, 1f, Utils.InverseLerp(0f, 25f, Time, true)); + if (projectile.localAI[0] == 0f) + { + InitialCenter = projectile.Center; + Destination = Main.MouseWorld; + DustType = Main.rand.NextBool(2) ? 107 : 234; + if (Main.rand.NextBool(4)) + { + DustType = 269; + } + projectile.localAI[0] = 1f; + } + if (Time <= 90f) + { + projectile.position = Vector2.Lerp(InitialCenter, Destination, Time / 90f); + projectile.position.Y += (float)Math.Sin(Time / 90f * MathHelper.TwoPi) * 75f; + } + else if (Time < 180f) + { + // For those who haven't seen this yet (namely in the 1.4 source), this allows you to achieve a + // fade-in and fade-out effect with relative ease. At 90, multiply by 0, and somewhere in-between until 115, where you multiply by 1. + // And then do the same for the fade-out effect of 180f-165. These inverse linear interpolations cannot overlap by definition because + // their ranges do not overlap. Overall a really cool trick. + float radius = MaxRadius * Utils.InverseLerp(90f, 115f, Time, true) * Utils.InverseLerp(180f, 165f, Time, true); + radius *= 1f + (float)Math.Cos(Main.GlobalTime / 24f) * 0.25f; + if (radius < 5f) + radius = 5f; + projectile.Center = Destination + ((Time - 90) / 90f * MathHelper.ToRadians(720f) + (YDirection == -1).ToInt() * MathHelper.Pi).ToRotationVector2() * radius; + } + else if (Time == 180f) + { + projectile.Kill(); + } + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Time++; + } + + public void GenerateRotationalDust() + { + for (int i = 0; i < 9; i++) + { + float angle = Time / 45f + i / 9f * MathHelper.TwoPi; + Vector2 offsetSpan = angle.ToRotationVector2() * projectile.Size * 0.65f * projectile.scale; + Vector2 edgePosition = projectile.Center + offsetSpan.RotatedBy(projectile.rotation); + Dust dust = Dust.NewDustPerfect(edgePosition + Main.rand.NextVector2Circular(4f, 4f), DustType); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.scale = 0.65f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return CalamityUtils.MulticolorLerp(Time / 60f % 1f, new Color[] + { + Color.PaleGreen, + Color.Violet, + Color.SlateGray + }) * projectile.Opacity; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D lightTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/PhotovisceratorLight"); + for (int i = 0; i < projectile.oldPos.Length; i++) + { + float colorInterpolation = (float)Math.Cos(projectile.timeLeft / 16f + Main.GlobalTime / 20f + i / (float)projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + Color color = CalamityUtils.MulticolorLerp(MathHelper.Clamp(colorInterpolation, 0f, 0.99f), new Color[] + { + Color.PaleGreen, + Color.Violet, + Color.SlateGray + }) * projectile.Opacity; + color.A = 0; + Vector2 drawPosition = projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Color outerColor = color; + Color innerColor = color * 0.5f; + float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTime % 60f * MathHelper.TwoPi); + + // Become smaller the futher along the old positions we are. + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)projectile.oldPos.Length); + + Vector2 outerScale = new Vector2(1.25f) * intensity; + Vector2 innerScale = new Vector2(1.25f) * intensity * 0.7f; + outerColor *= intensity * projectile.scale; + innerColor *= intensity * projectile.scale; + spriteBatch.Draw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.6f, SpriteEffects.None, 0); + spriteBatch.Draw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.6f, SpriteEffects.None, 0); + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item14, projectile.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 3; i++) + { + Projectile.NewProjectileDirect(projectile.Center, + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 16f, + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack * 0.3f, + projectile.owner); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.CursedInferno, 180); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.Ichor, 180); + } + } +} diff --git a/Projectiles/Ranged/ExoLightBomb.png b/Projectiles/Ranged/ExoLightBomb.png new file mode 100644 index 0000000000000000000000000000000000000000..67c615a142b80c23246895f5ef5cfcef815c7d9d GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU1|)m_?Z^dEjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sDEfH31!Z9ZwBpu4AwV@QPi+j9#U4;b(q*s$jR|2Y%u6oL{2 zgX?!&>sxO>pA}%bLMnuJ6(), + projectile.damage, + projectile.knockBack, + projectile.owner).localAI[1] = Projectile.GetByUUID(projectile.owner, projectile.whoAmI); + } + } + projectile.localAI[1] = 1f; + } + if (projectile.ai[0] == 0f) + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxDistanceFromTarget, true); + if (potentialTarget != null) + { + if (projectile.Distance(potentialTarget.Center) > MinDistanceFromTarget) + { + float angleOffset = projectile.AngleTo(potentialTarget.Center) - projectile.velocity.ToRotation(); + angleOffset = MathHelper.WrapAngle(angleOffset); + projectile.velocity = projectile.velocity.RotatedBy(MathHelper.Clamp(angleOffset, -0.1f, 0.1f)); + } + } + } + CalamityUtils.StickyProjAI(projectile, 5); + } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + CalamityUtils.ModifyHitNPCSticky(projectile, 4, false); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + int width = (int)MathHelper.Max(targetHitbox.Width, 150); + int height = (int)MathHelper.Max(targetHitbox.Height, 150); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, width, height); + return null; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.CursedInferno, 180); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.Ichor, 180); + } + } +} diff --git a/Projectiles/Ranged/ExoLightBurst.png b/Projectiles/Ranged/ExoLightBurst.png new file mode 100644 index 0000000000000000000000000000000000000000..04c5646fded8c39b9fa4fb2cb4826b55a2aacdbb GIT binary patch literal 139 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v_d#0*}aI z1_r((Aj~*bn@<`j$X?><>&pIsosmIag3oHse4vnor;B5V#`)ww|Nq-FYc_N?x)`iV cT#~`S@HK*2wD-*0YM>ehPgg&ebxsLQ0I1_7Bme*a literal 0 HcmV?d00001 diff --git a/Projectiles/Ranged/ExoSpark.cs b/Projectiles/Ranged/ExoSpark.cs new file mode 100644 index 0000000000..5f9aee48ff --- /dev/null +++ b/Projectiles/Ranged/ExoSpark.cs @@ -0,0 +1,84 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoSpark : ModProjectile + { + public static readonly int[] FrameToDustIDTable = new int[] + { + 107, + 234, + 269, + }; + public const float HomingInertia = 10f; + public const float MaxTargetDistance = 750f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Spark"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 14; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.frame = Main.rand.Next(3); + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxTargetDistance); + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * (HomingInertia - 1) + projectile.DirectionTo(potentialTarget.Center) * 16f) / HomingInertia; + } + projectile.rotation = projectile.velocity.ToRotation(); + if (!Main.dedServ) + { + GenerateCircularDust(); + } + } + + public void GenerateCircularDust() + { + for (int i = 0; i < 12; i++) + { + float angle = i / 12f * MathHelper.TwoPi; + Vector2 spawnPosition = projectile.Center + angle.ToRotationVector2().RotatedBy(projectile.rotation) * new Vector2(10f, 6f); + Dust dust = Dust.NewDustPerfect(spawnPosition, FrameToDustIDTable[projectile.frame]); + dust.velocity = Vector2.Zero; + dust.scale = 0.5f; + dust.noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } +} diff --git a/Projectiles/Ranged/ExoSpark.png b/Projectiles/Ranged/ExoSpark.png new file mode 100644 index 0000000000000000000000000000000000000000..eb696c6909b6af338f165a41fd495bf4918bef1f GIT binary patch literal 742 zcmVPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0((hBK~z{r-IrfT zQ&AkpkDE**PxYdE>P1^m_Rv#U zP!AE&V=s|2ivEx}Mo5qkGneM%e((7W&aYj^2<{nu9`-%w-2FM9^E*3tD-#Z6Vr{ae z;_C>?7Q^UNa-rOlwQ}$J20o)~+d(UY2ahiDmmxR1VP3&ZZzb;Gx!%TFD@6QsKgNm3 z$_lP87_G`U84~UrI@OBIh>wZa$TQ(?BlEqkk^eq7>=hOVy4qw1B!7ZleKqg-C<>1|1Op32w#D6vkrOp zSQsXePc!y=1bY!=$jwUUq$x!9%_Z4lnB%gcLS}@1!$P~3ZkFDa7Ww zJ0%-iPnYt6gQ&Kz`xI-D@2ca|1QcI~}vsc?rHvej- zzlMarsRl{Ab!c$}Gn)-QLI0w+5B=>&PFW#RKS!07AQM9WE|r<1*t-NbD1_^V|2sl# Y0xW*kId(raZvX%Q07*qoM6N<$g5bPg$^ZZW literal 0 HcmV?d00001 diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 745f611edf..f3da88c257 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -2419,6 +2419,19 @@ namespace CalamityMod float colorMePurple = (float)((Math.Sin(timeMult * Main.GlobalTime) + 1) * 0.5f); return Color.Lerp(firstColor, secondColor, colorMePurple); } + /// + /// Returns a color lerp that supports multiple colors. + /// + /// The 0-1 incremental value used when interpolating. + /// The various colors to interpolate across. + /// + public static Color MulticolorLerp(float increment, params Color[] colors) + { + int currentColorIndex = (int)(increment * colors.Length); + Color currentColor = colors[currentColorIndex]; + Color nextColor = colors[(currentColorIndex + 1) % colors.Length]; + return Color.Lerp(currentColor, nextColor, increment * colors.Length % 1f); + } #endregion #region Miscellaneous Utilities From 493a750c5095d5c997b6d5f4b82063a979552f56 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Fri, 29 May 2020 22:09:19 -0400 Subject: [PATCH 4/8] Apply suggestions from code review Changed tooltip of Photoviscerator and renamed some projectiles. --- Items/Weapons/Ranged/Photoviscerator.cs | 2 +- Projectiles/Ranged/ExoLightBomb.cs | 2 +- Projectiles/Ranged/ExoLightBurst.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 539de56830..0fa4679dbf 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged DisplayName.SetDefault("Photoviscerator"); Tooltip.SetDefault("90% chance to not consume gel\n" + "Left clicking unleashes a spread of burning light that homes in on and sticks to enemies\n" + - "Right clicking fires a stream of exo flames and light bombs that explode into homing sparks"); + "Right click to fire homing flares which stick to enemies and incinerate them"); } public override void SetDefaults() diff --git a/Projectiles/Ranged/ExoLightBomb.cs b/Projectiles/Ranged/ExoLightBomb.cs index 2e6cd60982..8a0eefce83 100644 --- a/Projectiles/Ranged/ExoLightBomb.cs +++ b/Projectiles/Ranged/ExoLightBomb.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged } public override void SetStaticDefaults() { - DisplayName.SetDefault("Light"); + DisplayName.SetDefault("Exo Light"); ProjectileID.Sets.TrailingMode[projectile.type] = 0; ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; } diff --git a/Projectiles/Ranged/ExoLightBurst.cs b/Projectiles/Ranged/ExoLightBurst.cs index 36ab26ddc3..b34a586853 100644 --- a/Projectiles/Ranged/ExoLightBurst.cs +++ b/Projectiles/Ranged/ExoLightBurst.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged public const float MaxDistanceFromTarget = 1350f; public override void SetStaticDefaults() { - DisplayName.SetDefault("Light"); + DisplayName.SetDefault("Exo Flare"); ProjectileID.Sets.NeedsUUID[projectile.type] = true; } From 6312496fe1bd437c3da0d8552de3ef2c86b993e0 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Fri, 29 May 2020 22:09:59 -0400 Subject: [PATCH 5/8] Apply suggestions from code review actually this commit fixes the tooltip because I am an idiot --- Items/Weapons/Ranged/Photoviscerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 0fa4679dbf..f01934d293 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Photoviscerator"); Tooltip.SetDefault("90% chance to not consume gel\n" + - "Left clicking unleashes a spread of burning light that homes in on and sticks to enemies\n" + + "Fires a stream of exo flames and light that explodes into homing sparks\n" + "Right click to fire homing flares which stick to enemies and incinerate them"); } From a7355ed66cb19f5eb5386db3bcbacb0c91f2ee15 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Fri, 29 May 2020 22:10:44 -0400 Subject: [PATCH 6/8] renamed subsuming vortex projectile --- Projectiles/Magic/Vortex.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index 05d6ae0066..86462050c7 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic public const float MaximumTargetDistance = 1200f; public override void SetStaticDefaults() { - DisplayName.SetDefault("Vortex"); + DisplayName.SetDefault("Subsuming Vortex"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } From 7c212f7ddf34b443e1bfa986860bb1d6a0d5402d Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Fri, 29 May 2020 22:11:21 -0400 Subject: [PATCH 7/8] renamed subsuming tentacle projectile --- Projectiles/Magic/SubsumingTentacle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Magic/SubsumingTentacle.cs b/Projectiles/Magic/SubsumingTentacle.cs index 1172522660..bf66907557 100644 --- a/Projectiles/Magic/SubsumingTentacle.cs +++ b/Projectiles/Magic/SubsumingTentacle.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic public const float MaxEnemyDistance = 1450f; public override void SetStaticDefaults() { - DisplayName.SetDefault("Tentacle"); + DisplayName.SetDefault("Exo Tentacle"); ProjectileID.Sets.TrailingMode[projectile.type] = 0; ProjectileID.Sets.TrailCacheLength[projectile.type] = 75; } From 7ee70dd01d57d7936a167d657956c5b6ccad0440 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Fri, 29 May 2020 22:11:33 -0400 Subject: [PATCH 8/8] renamed big subsuming vortex projectile --- Projectiles/Magic/EnormousConsumingVortex.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index ccc378555d..12665a5124 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic public const float RadialOffsetVarianceFactor = 0.1f; public override void SetStaticDefaults() { - DisplayName.SetDefault("Vortex"); + DisplayName.SetDefault("Subsuming Vortex"); ProjectileID.Sets.NeedsUUID[projectile.type] = true; }