diff --git a/Buffs/Summon/WulfrumDroidBuff.cs b/Buffs/Summon/WulfrumDroidBuff.cs new file mode 100644 index 0000000000..7e2f0bfcd5 --- /dev/null +++ b/Buffs/Summon/WulfrumDroidBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class WulfrumDroidBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Wulfrum Droid"); + Description.SetDefault("The wulfrum droid 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.wDroid = true; + } + if (!modPlayer.wDroid) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/WulfrumDroidBuff.png b/Buffs/Summon/WulfrumDroidBuff.png new file mode 100644 index 0000000000..34b1c798e4 Binary files /dev/null and b/Buffs/Summon/WulfrumDroidBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 05b683eac7..f6c3061d4e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -618,6 +618,7 @@ namespace CalamityMod.CalPlayer public int bloodfinTimer = 30; // Minion + public bool wDroid = false; public bool resButterfly = false; public bool glSword = false; public bool mWorm = false; @@ -1284,6 +1285,7 @@ namespace CalamityMod.CalPlayer pinkCandle = false; yellowCandle = false; + wDroid = false; resButterfly = false; glSword = false; mWorm = false; diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index ebd64a48af..e88f901d70 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -46,6 +46,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches DropHelper.DropItem(player, ItemID.Starfish, 2, 3); DropHelper.DropItem(player, ItemID.Seashell, 2, 3); DropHelper.DropItem(player, ItemID.Coral, 2, 3); + DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 2, 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 2, 3); if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) diff --git a/Items/Weapons/Magic/ClamorNoctus.cs b/Items/Weapons/Magic/ClamorNoctus.cs index 4f5e6d2639..92ca25c461 100644 --- a/Items/Weapons/Magic/ClamorNoctus.cs +++ b/Items/Weapons/Magic/ClamorNoctus.cs @@ -21,7 +21,7 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e public override void SetDefaults() { - item.damage = 300; + item.damage = 450; item.magic = true; item.mana = 12; item.width = 52; @@ -37,7 +37,7 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e item.UseSound = SoundID.Item105; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + item.shootSpeed = 25f; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/StratusSphere.cs b/Items/Weapons/Magic/StratusSphere.cs new file mode 100644 index 0000000000..6b975065a9 --- /dev/null +++ b/Items/Weapons/Magic/StratusSphere.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class StratusSphere : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stratus Sphere"); + Tooltip.SetDefault("Fires an energy orb containing the essence of our stratosphere\n" + + "Up to six of these can be active at a time"); + } + public override void SetDefaults() + { + item.damage = 500; + item.noMelee = true; + item.magic = true; + item.width = 50; + item.height = 50; + item.useTime = 45; + item.useAnimation = 45; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7f; + item.useStyle = 5; + item.mana = 30; + item.knockBack = 2; + item.UseSound = SoundID.Item20; + item.rare = 4; + item.autoReuse = true; + item.useTurn = true; + item.holdStyle = 3; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + if (player.ownedProjectileCounts[item.shoot] >= 6) + { + return false; + } + else + { + return true; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.NebulaArcanum); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} + diff --git a/Items/Weapons/Magic/StratusSphere.png b/Items/Weapons/Magic/StratusSphere.png new file mode 100644 index 0000000000..c948342b48 Binary files /dev/null and b/Items/Weapons/Magic/StratusSphere.png differ diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs new file mode 100644 index 0000000000..19965b6418 --- /dev/null +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -0,0 +1,73 @@ +using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class WulfrumController : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Controller"); + Tooltip.SetDefault("Summons a wulfrum droid to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 6; + item.mana = 10; + item.width = 28; + item.height = 20; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 4; + item.noMelee = true; + item.knockBack = 0.5f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item15; //phaseblade sound effect + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool AltFunctionUse(Player player) + { + return 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) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/WulfrumController.png b/Items/Weapons/Summon/WulfrumController.png new file mode 100644 index 0000000000..c419f9b6ac Binary files /dev/null and b/Items/Weapons/Summon/WulfrumController.png differ diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index add87f1edc..ac7ce7e1b9 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -22,12 +22,14 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 10; projectile.height = 10; projectile.friendly = true; - projectile.penetrate = 8; + projectile.penetrate = -1; projectile.alpha = 255; projectile.magic = true; projectile.aiStyle = 93; aiType = 514; projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/Crescent.cs b/Projectiles/Magic/Crescent.cs new file mode 100644 index 0000000000..a70b1b3ca5 --- /dev/null +++ b/Projectiles/Magic/Crescent.cs @@ -0,0 +1,55 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Projectiles.Magic +{ + public class Crescent : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crescent Cutter"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.timeLeft = 200; + projectile.aiStyle = 0; + projectile.width = 20; + projectile.height = 20; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.knockBack = 0; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(230, 230, 255, projectile.alpha); + } + + public override void AI() + { + Projectile parent = Main.projectile[(int)projectile.ai[0]]; + if (!parent.active) projectile.Kill(); + + projectile.rotation += 0.7f; + + projectile.ai[1]++; + + if (projectile.ai[1] > 20) + { + projectile.velocity += projectile.DirectionTo(parent.Center) * 2.5f; + if (projectile.Distance(parent.Center) < 75f) projectile.active = false; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/Crescent.png b/Projectiles/Magic/Crescent.png new file mode 100644 index 0000000000..38aef93175 Binary files /dev/null and b/Projectiles/Magic/Crescent.png differ diff --git a/Projectiles/Magic/StratusSphereProj.cs b/Projectiles/Magic/StratusSphereProj.cs new file mode 100644 index 0000000000..b724c9af6e --- /dev/null +++ b/Projectiles/Magic/StratusSphereProj.cs @@ -0,0 +1,135 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Projectiles.Magic +{ + public class StratusSphereProj : ModProjectile + { + int roundsGone = 0; + int dust_nut = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stratus Sphere"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.hostile = false; + projectile.friendly = true; + projectile.aiStyle = -1; + projectile.width = 314; + projectile.height = 198; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.knockBack = 0; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(230, 230, 255, projectile.alpha); + } + + public override void AI() + { + projectile.ai[0]++; + + if (projectile.ai[0] < 200) + { + if (projectile.ai[0] > 100) + { + projectile.velocity.X = projectile.velocity.X * 40 / 41; + projectile.velocity.Y = projectile.velocity.Y * 45 / 46 - 0.005f; + } + } + else + { + projectile.velocity.X = projectile.velocity.X * 10 / 11; + projectile.velocity.Y = projectile.velocity.Y * 10 / 11; + if (roundsGone <= 4) projectile.ai[1]++; + int rand = Main.rand.Next(-50, 51); + int rand2 = Main.rand.Next(-50, 51); + Vector2 targetDir = projectile.Center + new Vector2(rand, rand2); + if (projectile.ai[1] > 40) + { + Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(targetDir) * 12f, ModContent.ProjectileType(), projectile.damage / 2, 0.4f, projectile.owner, projectile.whoAmI); + } + if (projectile.ai[1] > 46) + { + projectile.ai[1] = 0; + roundsGone++; + } + if (roundsGone > 4 && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] == 0) projectile.Kill(); + } + + projectile.frameCounter++; + if (projectile.frameCounter >= 4) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + } + + if (Main.rand.NextFloat() < 1f) + { + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.Center; + dust = Main.dust[Terraria.Dust.NewDust(position, 0, 0, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.7236842f)]; + } + + dust_nut++; + + if (dust_nut > 22) + { + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; + Vector2 vector = spinningpoint - projectile.Center; + int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 226, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 0.7236842f); + Main.dust[num21].noGravity = true; + Main.dust[num21].noLight = true; + Main.dust[num21].velocity = Vector2.Normalize(vector) * 3f; + } + dust_nut = 0; + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 25; i++) + { + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.Center - new Vector2(34, 34); + dust = Main.dust[Terraria.Dust.NewDust(position, 68, 68, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.7236842f)]; + } + + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; + Vector2 vector = spinningpoint - projectile.Center; + int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 226, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 0.7236842f); + Main.dust[num21].noGravity = true; + Main.dust[num21].noLight = true; + Main.dust[num21].velocity = Vector2.Normalize(vector) * 3f; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/StratusSphereProj.png b/Projectiles/Magic/StratusSphereProj.png new file mode 100644 index 0000000000..2fefcab6c8 Binary files /dev/null and b/Projectiles/Magic/StratusSphereProj.png differ diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index ee211c95a5..a08543c626 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.ai[1] % 4 == 0) { int type = ModContent.ProjectileType(); - int damage = DragonPow.BaseDamage / 8; + int damage = projectile.damage / 8; float kb = 3f; float speed = DragonPow.SparkSpeed; Vector2 vel = new Vector2(speed, 0f).RotatedByRandom(MathHelper.TwoPi); @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee int type = ProjectileID.FlowerPetal; int numPetals = 12; - int petalDamage = DragonPow.BaseDamage / 8; + int petalDamage = projectile.damage / 8; float petalKB = 0f; Player owner = Main.player[projectile.owner]; for (int i = 0; i < numPetals; ++i) @@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee { int type = ModContent.ProjectileType(); int numWaterfalls = 12; - int waterfallDamage = DragonPow.BaseDamage / 6; + int waterfallDamage = projectile.damage / 6; float waterfallKB = 0f; Player owner = Main.player[projectile.owner]; for (int i = 0; i < numWaterfalls; ++i) diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index c98aed1a26..ea67a3b486 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Graphics.Shaders; using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee @@ -32,6 +33,31 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + for (float i = -5; i <= 0; i++) + { + if (Main.rand.NextFloat(1f) < 0.4f) + { + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 pos = projectile.position + new Vector2((projectile.width / 2) - 8, projectile.height + 16); + Dust dust1 = Dust.NewDustPerfect(pos + new Vector2(-20 + i, -2), 180, new Vector2(i * 0.7f, -1.1f)); + dust1.noGravity = true; + } + } + for (float i = 0; i <= 5; i++) + { + if (Main.rand.NextFloat(1f) < 0.4f) + { + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 pos = projectile.position + new Vector2((projectile.width / 2) - 8, projectile.height + 16); + Dust dust1 = Dust.NewDustPerfect(pos + new Vector2(20 + i, -2), 180, new Vector2(i * 0.7f, -1.1f)); + dust1.noGravity = true; + } + } + + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 pos2 = projectile.Center - new Vector2(20, 20); + dust = Main.dust[Dust.NewDust(pos2, 40, 40, 180, 0f, 0f, 0, new Color(255, 255, 255), 1f)]; Lighting.AddLight(projectile.Center, 0.3f, 0.3f, 0.7f); } @@ -48,7 +74,6 @@ namespace CalamityMod.Projectiles.Melee projectile.width = projectile.height = 32; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); radius = 100; projectile.maxPenetrate = -1; projectile.penetrate = -1; @@ -56,23 +81,54 @@ namespace CalamityMod.Projectiles.Melee projectile.localNPCHitCooldown = 10; projectile.damage /= 2; projectile.Damage(); - for (int num621 = 0; num621 < 4; num621++) + for (int i = 0; i < 72; i++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 176, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.Center - new Vector2(30, 30); + dust = Main.dust[Terraria.Dust.NewDust(position, 60, 60, 187, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(0, 167, 255), 5f)]; + dust.noGravity = true; + dust.shader = GameShaders.Armor.GetSecondaryShader(47, Main.LocalPlayer); + } + + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43); + + for (int i = 0; i < 155; i++) + { + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.position; + dust = Main.dust[Dust.NewDust(position, 94, 94, 180, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(255, 255, 255), Main.rand.NextFloat(1.2f, 2.2f))]; + dust.noGravity = true; + } + + for (int x = 1; x <= 3; x++) + { + int num20 = 36; + for (int i = 0; i < num20; i++) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; + Vector2 vector = spinningpoint - projectile.Center; + int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); + Main.dust[num21].noGravity = true; + Main.dust[num21].velocity = Vector2.Normalize(vector) * x; } } - for (int num623 = 0; num623 < 12; num623++) + + for (int x = 1; x <= 3; x++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 176, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 176, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; + Vector2 vector = spinningpoint - projectile.Center; + int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); + Main.dust[num21].noGravity = true; + Main.dust[num21].velocity = Vector2.Normalize(vector) * x; + Main.dust[num21].velocity *= 2; + } } for (int num625 = 0; num625 < 3; num625++) { diff --git a/Projectiles/Rogue/AlphaVirusProjectile.cs b/Projectiles/Rogue/AlphaVirusProjectile.cs index d8a5a45a89..5bb0810d03 100644 --- a/Projectiles/Rogue/AlphaVirusProjectile.cs +++ b/Projectiles/Rogue/AlphaVirusProjectile.cs @@ -24,9 +24,11 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = -1; + projectile.penetrate = 8; projectile.timeLeft = lifetime; projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; } public override void AI() @@ -163,7 +165,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 6; i++) { - int damage = projectile.damage / 2; + int damage = projectile.damage; Vector2 velocity = new Vector2(0, 10); velocity = velocity.RotatedBy(MathHelper.ToRadians(60) * i); Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), damage, 5, projectile.owner, i % 2, 0); diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs new file mode 100644 index 0000000000..5d2d0df66d --- /dev/null +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -0,0 +1,236 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class WulfrumDroid : ModProjectile + { + public float dust = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Droid"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + //projectile.aiStyle = 62; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (dust == 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, 61, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 1f; + } + if (player.minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.minionDamage); + projectile.damage = damage2; + } + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 3) + { + projectile.frame = 0; + } + bool flag64 = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.wDroid = false; + } + if (modPlayer.wDroid) + { + projectile.timeLeft = 2; + } + } + float num6 = 0.05f; + float width = (float) projectile.width; + for (int index = 0; index < 1000; ++index) + { + if (index != projectile.whoAmI && Main.projectile[index].active && (Main.projectile[index].owner == projectile.owner && Main.projectile[index].type == projectile.type) && (double) Math.Abs(projectile.position.X - Main.projectile[index].position.X) + (double) Math.Abs(projectile.position.Y - Main.projectile[index].position.Y) < (double) width) + { + if ((double) projectile.position.X < (double) Main.projectile[index].position.X) + projectile.velocity.X -= num6; + else + projectile.velocity.X += num6; + if ((double) projectile.position.Y < (double) Main.projectile[index].position.Y) + projectile.velocity.Y -= num6; + else + projectile.velocity.Y += num6; + } + } + Vector2 vector2_3 = projectile.position; + float num7 = 400f; + bool flag = false; + int num8 = -1; + NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC; + if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this, false)) + { + float num1 = Vector2.Distance(minionAttackTargetNpc.Center, projectile.Center); + if (((double) Vector2.Distance(projectile.Center, vector2_3) > (double) num1 && (double) num1 < (double) num7 || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height)) + { + num7 = num1; + vector2_3 = minionAttackTargetNpc.Center; + flag = true; + num8 = minionAttackTargetNpc.whoAmI; + } + } + if (!flag) + { + for (int index2 = 0; index2 < 200; ++index2) + { + NPC npc = Main.npc[index2]; + if (npc.CanBeChasedBy((object) this, false)) + { + float num1 = Vector2.Distance(npc.Center, projectile.Center); + if (((double) Vector2.Distance(projectile.Center, vector2_3) > (double) num1 && (double) num1 < (double) num7 || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num7 = num1; + vector2_3 = npc.Center; + flag = true; + num8 = index2; + } + } + } + } + int num9 = 500; + if (flag) + num9 = 1000; + if ((double) Vector2.Distance(player.Center, projectile.Center) > (double) num9) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if ((double) projectile.ai[0] == 1.0) + projectile.tileCollide = false; + if (flag && (double) projectile.ai[0] == 0.0) + { + Vector2 vector2_1 = vector2_3 - projectile.Center; + float num1 = vector2_1.Length(); + vector2_1.Normalize(); + if ((double) num1 > 200.0) + { + float num2 = 6f; + Vector2 vector2_2 = vector2_1 * num2; + projectile.velocity.X = (float) (((double) projectile.velocity.X * 40.0 + (double) vector2_2.X) / 41.0); + projectile.velocity.Y = (float) (((double) projectile.velocity.Y * 40.0 + (double) vector2_2.Y) / 41.0); + } + else if ((double) projectile.velocity.Y > -1.0) + projectile.velocity.Y -= 0.1f; + } + else + { + if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) + projectile.ai[0] = 1f; + float num1 = 6f; + if ((double) projectile.ai[0] == 1.0) + num1 = 15f; + Vector2 center = projectile.Center; + Vector2 vector2_1 = player.Center - center + new Vector2(0.0f, -60f); + float num3 = vector2_1.Length(); + if ((double) num3 > 200.0 && (double) num1 < 9.0) + num1 = 9f; + if ((double) num3 < 100.0 && (double) projectile.ai[0] == 1.0 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0.0f; + projectile.netUpdate = true; + } + if ((double) num3 > 2000.0) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float) (projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float) (projectile.width / 2); + } + else if ((double) num3 > 70.0) + { + vector2_1.Normalize(); + projectile.velocity = (projectile.velocity * 20f + vector2_1 * num1) / 21f; + } + else + { + if ((double) projectile.velocity.X == 0.0 && (double) projectile.velocity.Y == 0.0) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + projectile.velocity = projectile.velocity * 1.01f; + } + } + projectile.rotation = projectile.velocity.X * 0.05f; + if ((double) projectile.velocity.X > 0.0) + projectile.spriteDirection = projectile.direction = -1; + else if ((double) projectile.velocity.X < 0.0) + projectile.spriteDirection = projectile.direction = 1; + if ((double) projectile.ai[1] > 0.0) + projectile.ai[1] += (float) Main.rand.Next(1, 4); + if ((double) projectile.ai[1] > 90.0) + { + projectile.ai[1] = 0.0f; + projectile.netUpdate = true; + } + if ((double) projectile.ai[1] != 0.0) + return; + ++projectile.ai[1]; + if (Main.myPlayer != projectile.owner) + return; + if (!flag) + return; + Vector2 vec = vector2_3 - projectile.Center; + vec.Normalize(); + Vector2 vec2 = vec * 10f; + int bolt = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vec2.X, vec2.Y, ModContent.ProjectileType(), projectile.damage, 0.0f, Main.myPlayer, 0.0f, 0.0f); + Main.projectile[bolt].Calamity().forceMinion = true; + Main.projectile[bolt].netUpdate = true; + projectile.netUpdate = true; + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/WulfrumDroid.png b/Projectiles/Summon/WulfrumDroid.png new file mode 100644 index 0000000000..c227fdff07 Binary files /dev/null and b/Projectiles/Summon/WulfrumDroid.png differ diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index a36f95ea47..7f4a00a1ea 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -98,7 +98,7 @@ namespace CalamityMod internal static void Unload() { PlantCheckAgainst = null; - VineToGrass.Clear(); + VineToGrass?.Clear(); VineToGrass = null; tileMergeTypes = null; }