diff --git a/Buffs/Summon/AstralProbeBuff.cs b/Buffs/Summon/AstralProbeBuff.cs new file mode 100644 index 0000000000..d2e2aa00f4 --- /dev/null +++ b/Buffs/Summon/AstralProbeBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class AstralProbeBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Astral Probe"); + Description.SetDefault("The astral probe 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.aProbe = true; + } + if (!modPlayer.aProbe) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/AstralProbeBuff.png b/Buffs/Summon/AstralProbeBuff.png new file mode 100644 index 0000000000..d8d97e9fab Binary files /dev/null and b/Buffs/Summon/AstralProbeBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 2c2a7025fe..33d6d0a5ea 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -643,6 +643,7 @@ namespace CalamityMod.CalPlayer public bool pGuy = false; public bool sandnado = false; public bool plantera = false; + public bool aProbe = false; public bool gDefense = false; public bool gOffense = false; public bool gHealer = false; @@ -1387,6 +1388,7 @@ namespace CalamityMod.CalPlayer sGod = false; sandnado = false; plantera = false; + aProbe = false; vUrchin = false; cSpirit = false; rOrb = false; diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index f4aefbfc25..02bdb23f91 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.AstrumDeus; using Terraria; using Terraria.ModLoader; @@ -47,6 +48,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); // Equipment diff --git a/Items/Weapons/Summon/GodspawnHelixStaff.cs b/Items/Weapons/Summon/GodspawnHelixStaff.cs new file mode 100644 index 0000000000..208e16351b --- /dev/null +++ b/Items/Weapons/Summon/GodspawnHelixStaff.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class GodspawnHelixStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Godspawn Helix Staff"); + Tooltip.SetDefault("Summons astral probes to protect you"); + } + + public override void SetDefaults() + { + item.damage = 100; + item.mana = 10; + item.width = 50; + item.height = 50; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 1.25f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.summon = true; + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Summon/GodspawnHelixStaff.png b/Items/Weapons/Summon/GodspawnHelixStaff.png new file mode 100644 index 0000000000..46daf2f986 Binary files /dev/null and b/Items/Weapons/Summon/GodspawnHelixStaff.png differ diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index b95e3a5225..16bbf61445 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -307,7 +307,7 @@ namespace CalamityMod (Func)(() => CalamityWorld.downedStarGod), ModContent.ItemType(), new List() { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()}, - new List() { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemID.GreaterHealingPotion}, + new List() { ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemID.GreaterHealingPotion}, "Defeat 3 empowered astral titans or use a [i:" + ModContent.ItemType() + "] at Night", "[c/FFD700:The infected deity retreats to the heavens.]", "CalamityMod/NPCs/AstrumDeus/AstrumDeus_BossChecklist"); @@ -768,6 +768,7 @@ namespace CalamityMod SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), new List() {ModContent.ProjectileType(), ModContent.ProjectileType()}); SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); + SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); SummonersAssociation.Call("AddMinionInfo", ModContent.ItemType(), ModContent.BuffType(), ModContent.ProjectileType()); diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 19cfcc62e7..f1ee93a1ea 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -230,6 +231,7 @@ namespace CalamityMod.NPCs.AstrumDeus DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); // Equipment diff --git a/Projectiles/Summon/AstralProbeRound.cs b/Projectiles/Summon/AstralProbeRound.cs new file mode 100644 index 0000000000..870461dc81 --- /dev/null +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -0,0 +1,118 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Dusts; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class AstralProbeRound : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.minionSlots = 0f; + projectile.minion = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.extraUpdates = 2; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (Main.rand.NextBool(3)) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = ModContent.DustType(); + } + else + { + randomDust = ModContent.DustType(); + } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 1200f; + bool flag17 = false; + for (int target = 0; target < 200; target++) + { + if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) + { + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 17f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + for (int k = 0; k < 5; k++) + { + int randomDust = Main.rand.Next(2); + if (randomDust == 0) + { + randomDust = ModContent.DustType(); + } + else + { + randomDust = ModContent.DustType(); + } + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } +} diff --git a/Projectiles/Summon/AstralProbeRound.png b/Projectiles/Summon/AstralProbeRound.png new file mode 100644 index 0000000000..8e4b2a680f Binary files /dev/null and b/Projectiles/Summon/AstralProbeRound.png differ diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs new file mode 100644 index 0000000000..89f4b22da8 --- /dev/null +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -0,0 +1,190 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Dusts; +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class AstralProbeSummon : ModProjectile + { + private double rotation = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Probe"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType()), vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + projectile.localAI[0] += 1f; + } + if (player.minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.minionDamage); + projectile.damage = damage2; + } + bool flag64 = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.aProbe = false; + } + if (modPlayer.aProbe) + { + projectile.timeLeft = 2; + } + } + float num633 = 700f; + float num634 = 1300f; + float num635 = 2600f; + float num636 = 600f; + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + Vector2 vector = player.Center - projectile.Center; + if (flag25) + { + projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + } + else + { + projectile.rotation = vector.ToRotation() - 1.57f - (projectile.spriteDirection == 1 ? MathHelper.ToRadians(270) : MathHelper.ToRadians(90) * projectile.direction); + } + projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); + rotation += 0.03; + if (rotation >= 360) + { + rotation = 0; + } + projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; + + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (!flag25 && projectile.ai[0] != 0f) + { + bool flag26 = false; + if (!flag26) + { + flag26 = projectile.ai[0] == 1f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); + float num651 = vector48.Length(); + if (num651 < num636 && flag26) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + float scaleFactor3 = 6f; + int num658 = ModContent.ProjectileType(); + if (flag25 && projectile.ai[1] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 12); + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Vector2 value19 = vector46 - projectile.Center; + value19.Normalize(); + value19 *= scaleFactor3; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + projectile.netUpdate = true; + } + } + } + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/AstralProbeSummon.png b/Projectiles/Summon/AstralProbeSummon.png new file mode 100644 index 0000000000..e08f7efc9e Binary files /dev/null and b/Projectiles/Summon/AstralProbeSummon.png differ