diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 40420b84ae..69a08c167e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -8787,48 +8787,51 @@ namespace CalamityMod.CalPlayer // Dust modifications while high if (trippy) { - Rectangle rectangle = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); - int dustDrawn = 0; - float maxShroomDust = Main.maxDustToDraw / 2; - for (int i = 0; i < Main.maxDustToDraw; i++) + if (Main.myPlayer == player.whoAmI) { - Dust dust = Main.dust[i]; - if (dust.active) + Rectangle rectangle = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); + int dustDrawn = 0; + float maxShroomDust = Main.maxDustToDraw / 2; + for (int i = 0; i < Main.maxDustToDraw; i++) { - if (new Rectangle((int)dust.position.X, (int)dust.position.Y, 4, 4).Intersects(rectangle)) + Dust dust = Main.dust[i]; + if (dust.active) { - dust.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - for (int num213 = 0; num213 < 4; num213++) + if (new Rectangle((int)dust.position.X, (int)dust.position.Y, 4, 4).Intersects(rectangle)) { - Vector2 position9 = dust.position; - Vector2 dustCenter = new Vector2(position9.X + 4f, position9.Y + 4f); - float num214 = Math.Abs(dustCenter.X - player.Center.X); - float num215 = Math.Abs(dustCenter.Y - player.Center.Y); - if (num213 == 0 || num213 == 2) + dust.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + for (int num213 = 0; num213 < 4; num213++) { - position9.X = player.Center.X + num214; + Vector2 position9 = dust.position; + Vector2 dustCenter = new Vector2(position9.X + 4f, position9.Y + 4f); + float num214 = Math.Abs(dustCenter.X - player.Center.X); + float num215 = Math.Abs(dustCenter.Y - player.Center.Y); + if (num213 == 0 || num213 == 2) + { + position9.X = player.Center.X + num214; + } + else + { + position9.X = player.Center.X - num214; + } + position9.X -= 4f; + if (num213 == 0 || num213 == 1) + { + position9.Y = player.Center.Y + num215; + } + else + { + position9.Y = player.Center.Y - num215; + } + position9.Y -= 4f; + Main.spriteBatch.Draw(Main.dustTexture, position9 - Main.screenPosition, new Rectangle?(dust.frame), dust.color, dust.rotation, new Vector2(4f, 4f), dust.scale, SpriteEffects.None, 0f); + dustDrawn++; } - else - { - position9.X = player.Center.X - num214; - } - position9.X -= 4f; - if (num213 == 0 || num213 == 1) - { - position9.Y = player.Center.Y + num215; - } - else - { - position9.Y = player.Center.Y - num215; - } - position9.Y -= 4f; - Main.spriteBatch.Draw(Main.dustTexture, position9 - Main.screenPosition, new Rectangle?(dust.frame), dust.color, dust.rotation, new Vector2(4f, 4f), dust.scale, SpriteEffects.None, 0f); - dustDrawn++; - } - // Break if too many dust clones have been drawn - if (dustDrawn > maxShroomDust) - break; + // Break if too many dust clones have been drawn + if (dustDrawn > maxShroomDust) + break; + } } } } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 91222df37a..2bad61ffc0 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2303,10 +2303,10 @@ namespace CalamityMod.CalPlayer } if (modPlayer.xRage) - player.allDamage += 0.1f; + modPlayer.throwingDamage += 0.1f; if (modPlayer.xWrath) - modPlayer.AllCritBoost(5); + modPlayer.throwingCrit += 5; if (modPlayer.godSlayerCooldown) player.allDamage += 0.1f; diff --git a/CalamityMod.cs b/CalamityMod.cs index 295ec5b0e4..fcd0409641 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -2046,7 +2046,8 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; flaskBombProjList = new List() @@ -2073,7 +2074,8 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType() }; spikyBallList = new List() diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index 7e7d96dad4..2bfd0a9662 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -4,6 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [AutoloadEquip(EquipType.Neck)] public class CounterScarf : ModItem { public override void SetStaticDefaults() diff --git a/Items/Accessories/CounterScarf_Neck.png b/Items/Accessories/CounterScarf_Neck.png new file mode 100644 index 0000000000..b0a466784f Binary files /dev/null and b/Items/Accessories/CounterScarf_Neck.png differ diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index d6bf9d527b..518e6574f5 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Dynamo Stem Cells"); Tooltip.SetDefault(@"15% increased movement speed -Ranged weapons have a chance to fire miniature birbs"); +Ranged weapons have a chance to fire mini swarmlings"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); } diff --git a/Items/Armor/Vanity/BumblefuckMask.cs b/Items/Armor/Vanity/BumblefuckMask.cs index 6e910823dc..d6f90e4018 100644 --- a/Items/Armor/Vanity/BumblefuckMask.cs +++ b/Items/Armor/Vanity/BumblefuckMask.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Items.Armor.Vanity { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bumblebirb Mask"); + DisplayName.SetDefault("Draconic Swarmer Mask"); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeBumblebirb.cs b/Items/LoreItems/KnowledgeBumblebirb.cs index 7e79eced10..41d08fcf43 100644 --- a/Items/LoreItems/KnowledgeBumblebirb.cs +++ b/Items/LoreItems/KnowledgeBumblebirb.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.LoreItems { public override void SetStaticDefaults() { - DisplayName.SetDefault("The Bumblebirbs"); + DisplayName.SetDefault("The Draconic Swarmers"); Tooltip.SetDefault("A failure of twisted scientific ambition; it appears our faulted arrogance over life has shown once more in the results.\n" + "Originally intended to be a clone of the Jungle Dragon, these were left to roam about the jungle, attacking anything in their path."); } diff --git a/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs b/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs index 1b4ce96b8b..7f71734369 100644 --- a/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bumblebirb Trophy"); + DisplayName.SetDefault("Draconic Swarmer Trophy"); } public override void SetDefaults() diff --git a/Items/Tools/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index f932133e2b..e23443806c 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 85; + item.damage = 100; item.melee = true; item.width = 60; item.height = 46; item.useTime = 8; - item.useAnimation = 16; + item.useAnimation = 12; item.useTurn = true; item.axe = 27; item.useStyle = 1; @@ -50,59 +50,59 @@ namespace CalamityMod.Items.Tools { if (player.whoAmI == Main.myPlayer) { - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7) || - player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1) || + player.itemAnimation == (int)(player.itemAnimationMax * 0.3) || + player.itemAnimation == (int)(player.itemAnimationMax * 0.5) || + player.itemAnimation == (int)(player.itemAnimationMax * 0.7) || + player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { float num339 = 0f; float num340 = 0f; float num341 = 0f; float num342 = 0f; - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { num339 = -7f; } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) { num339 = -6f; num340 = 2f; } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5)) { num339 = -4f; num340 = 4f; } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) { num339 = -2f; num340 = 6f; } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) { num340 = 7f; } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) { num342 = 26f; } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) { num342 -= 4f; num341 -= 20f; } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) { num341 += 6f; } if (player.direction == -1) { - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { num342 -= 8f; } - if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) { num342 -= 6f; } @@ -111,7 +111,8 @@ namespace CalamityMod.Items.Tools num340 *= 1.5f; num342 *= (float)player.direction; num341 *= player.gravDir; - Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Spark, (int)((float)item.damage * 0.1f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); + int spark = Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Spark, (int)(item.damage * 0.2f * player.MeleeDamage()), 0f, player.whoAmI, 0f, 0f); + Main.projectile[spark].Calamity().forceMelee = true; } } if (Main.rand.NextBool(4)) @@ -124,7 +125,7 @@ namespace CalamityMod.Items.Tools { if (crit) { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[boom].Calamity().forceMelee = true; } target.AddBuff(BuffID.OnFire, 300); diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index 33e4d7e05d..00dbfe67db 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee } public override void SetDefaults() { - item.damage = 80; + item.damage = 90; item.melee = true; item.width = 58; item.height = 58; diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index a204e8aac4..737a48b1ca 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 56; - item.damage = 75; + item.damage = 100; item.melee = true; item.noMelee = true; item.useTurn = true; diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 28b09aafbb..9b49fab046 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 58; - item.damage = 55; + item.damage = 75; item.melee = true; item.useAnimation = 24; item.useStyle = 1; diff --git a/Items/Weapons/Melee/ExcaliburShortsword.cs b/Items/Weapons/Melee/ExcaliburShortsword.cs index bacbba3f9f..e99e7927fe 100644 --- a/Items/Weapons/Melee/ExcaliburShortsword.cs +++ b/Items/Weapons/Melee/ExcaliburShortsword.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 10; item.width = 40; item.height = 40; - item.damage = 55; + item.damage = 70; item.melee = true; item.knockBack = 5.25f; item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/PhoenixBlade.cs b/Items/Weapons/Melee/PhoenixBlade.cs index 6457463bda..7998b627e0 100644 --- a/Items/Weapons/Melee/PhoenixBlade.cs +++ b/Items/Weapons/Melee/PhoenixBlade.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 106; - item.damage = 95; + item.damage = 120; item.melee = true; - item.useAnimation = 29; + item.useAnimation = 27; item.useStyle = 1; - item.useTime = 29; + item.useTime = 27; item.useTurn = true; item.knockBack = 8f; item.UseSound = SoundID.Item1; @@ -42,8 +42,8 @@ namespace CalamityMod.Items.Weapons.Melee Main.projectile[boom].Calamity().forceMelee = true; float randomSpeedX = (float)Main.rand.Next(5); float randomSpeedY = (float)Main.rand.Next(3, 7); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI); } } diff --git a/Items/Weapons/Melee/StarnightLance.cs b/Items/Weapons/Melee/StarnightLance.cs index ff9fe448f9..773777ea7c 100644 --- a/Items/Weapons/Melee/StarnightLance.cs +++ b/Items/Weapons/Melee/StarnightLance.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 72; - item.damage = 68; + item.damage = 80; item.melee = true; item.noMelee = true; item.useTurn = true; diff --git a/Items/Weapons/Melee/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index 4eb20d42e2..8ea6eb405e 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 10; item.width = 32; item.height = 32; - item.damage = 70; + item.damage = 60; item.melee = true; item.knockBack = 7f; item.UseSound = SoundID.Item1; @@ -42,12 +42,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.7f), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.7f), item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 0a2520e6fc..f80680587e 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 38; + item.damage = 76; item.mana = 10; item.width = 46; item.height = 46; diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index f88dcaa0de..824d932ddc 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -90,7 +90,7 @@ namespace CalamityMod { "Ravager", 12.5f }, { "AstrumDeus", 13.5f }, { "ProfanedGuardians", 14.5f }, - { "Bumblebirb", 14.6f }, + { "Draconic Swarmer", 14.6f }, { "Providence", 15.01f }, // Thorium's Ragnarok is 15f { "CeaselessVoid", 15.5f }, { "StormWeaver", 15.51f }, @@ -415,16 +415,16 @@ namespace CalamityMod AddBoss(bossChecklist, calamity, "Profaned Guardians", order, type, DownedGuardians, summon, loot, collection, instructions, despawn, bossLogTex); } - // Bumblebirb + // Draconic Swarmer { - BossDifficulty.TryGetValue("Bumblebirb", out float order); + BossDifficulty.TryGetValue("Draconic Swarmer", out float order); int type = NPCType(); int summon = ItemType(); List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("The failed experiment returns into its reproductive routine.", new Color(0xFF, 0xD7, 0x00)); - AddBoss(bossChecklist, calamity, "Bumblebirb", order, type, DownedBirb, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Draconic Swarmer", order, type, DownedBirb, summon, loot, collection, instructions, despawn); } // Providence diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 105930e365..39bbb74778 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Bumblebirb { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bumblebirb"); + DisplayName.SetDefault("Draconic Swarmer"); Main.npcFrameCount[npc.type] = 6; NPCID.Sets.TrailingMode[npc.type] = 1; } @@ -398,7 +398,7 @@ namespace CalamityMod.NPCs.Bumblebirb public override void BossLoot(ref string name, ref int potionType) { - name = "A Bumblebirb"; + name = "A Draconic Swarmer"; potionType = ItemID.SuperHealingPotion; } diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 419283be8f..33342a0765 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -12,7 +12,7 @@ namespace CalamityMod.NPCs.Bumblebirb { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bumblebirb"); + DisplayName.SetDefault("Draconic Swarmling"); Main.npcFrameCount[npc.type] = 6; NPCID.Sets.TrailingMode[npc.type] = 1; } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index a774842097..0e690d9ee8 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1043,32 +1043,36 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 5f) { npc.defense = npc.defDefense * 3; - float num742 = 6f; - Vector2 vector93 = new Vector2(vectorCenter.X + (npc.spriteDirection > 0 ? 34f : -34f), vectorCenter.Y - 74f); - float num743 = player.position.X + (float)player.width * 0.5f - vector93.X; - float num744 = player.position.Y + (float)player.height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt((double)(num743 * num743 + num744 * num744)); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; + Vector2 source = new Vector2(vectorCenter.X + (npc.spriteDirection > 0 ? 34f : -34f), vectorCenter.Y - 74f); + Vector2 aimAt = player.Center + player.velocity * 20f; + float aimResponsiveness = 0.4f; switch ((int)npc.ai[2]) { case 0: - num743 += player.velocity.X * 0.5f; - num744 += player.velocity.Y * 0.5f; break; case 1: - num743 += player.velocity.X * 0.25f; - num744 += player.velocity.Y * 0.25f; + aimResponsiveness = 0.25f; break; case 2: - num743 += player.velocity.X * 0.125f; - num744 += player.velocity.Y * 0.125f; + aimResponsiveness = 0.1f; break; } + Vector2 aimVector = Vector2.Normalize(aimAt - source); + if (aimVector.HasNaNs()) + aimVector = -Vector2.UnitY; + aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(npc.velocity), aimResponsiveness)); + aimVector *= 6f; + + Vector2 laserVelocity = Vector2.Normalize(aimVector); + if (laserVelocity.HasNaNs()) + laserVelocity = -Vector2.UnitY; + + calamityGlobalNPC.newAI[1] = laserVelocity.X; + calamityGlobalNPC.newAI[2] = laserVelocity.Y; + npc.ai[1] += 1f; if (npc.ai[1] >= 300f) { @@ -1081,9 +1085,13 @@ namespace CalamityMod.NPCs npc.ai[0] = 3f; npc.ai[1] = 0f; npc.ai[2] = 0f; + calamityGlobalNPC.newAI[0] = 0f; } else + { npc.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } } else if (npc.ai[1] >= 180f) { @@ -1093,9 +1101,9 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 180f) { Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 104); - Vector2 laserVelocity = new Vector2(npc.localAI[0], npc.localAI[1]); - laserVelocity.Normalize(); - Projectile.NewProjectile(vector93.X, vector93.Y, laserVelocity.X, laserVelocity.Y, ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); + laserVelocity2.Normalize(); + Projectile.NewProjectile(source, laserVelocity2, ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); } } } @@ -1124,16 +1132,19 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[1] < 150f) - Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + if (npc.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f) + { + Projectile.NewProjectile(source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + calamityGlobalNPC.newAI[0] = 1f; + } else { if (npc.ai[1] == 150f) { - npc.localAI[0] = num743; - npc.localAI[1] = num744; + npc.localAI[0] = laserVelocity.X; + npc.localAI[1] = laserVelocity.Y; + Projectile.NewProjectile(source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, (float)npc.whoAmI); } - Projectile.NewProjectile(vector93.X, vector93.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); } } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index bc6f1a6e2d..dc166ee2d5 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3439,10 +3439,6 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.75); } - else if (projectile.type == ModContent.ProjectileType()) - { - damage = (int)(damage * 0.5); - } else if (projectile.type == ModContent.ProjectileType()) { damage /= 3; @@ -3451,10 +3447,14 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.25); } + else if (projectile.type == ModContent.ProjectileType()) + { + damage = (int)(damage * 0.1); + } else if (projectile.type == ModContent.ProjectileType()) { if (projectile.penetrate == -1) - projectile.penetrate = 4; + projectile.penetrate = 3; damage = (int)(damage * 0.1); } } @@ -3470,12 +3470,12 @@ namespace CalamityMod.NPCs } else if (projectile.type == ModContent.ProjectileType()) { - damage = (int)(damage * 0.5); + damage = (int)(damage * 0.1); } else if (projectile.type == ModContent.ProjectileType()) { if (projectile.penetrate == -1) - projectile.penetrate = 4; + projectile.penetrate = 3; damage = (int)(damage * 0.1); } } @@ -4358,121 +4358,168 @@ namespace CalamityMod.NPCs public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor) { - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - if (npc.type == NPCID.SkeletronPrime) - { - return false; - } - } + if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f)) + { + if (CalamityMod.CalamityConfig.EnemyDebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type))) + { + List buffTextureList = new List(); - if (Main.LocalPlayer.Calamity().trippy) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + // Damage over time debuffs + if (aFlames > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/AbyssalFlames")); + if (astralInfection > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/AstralInfectionDebuff")); + if (bFlames > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/BrimstoneFlames")); + if (bBlood > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/BurningBlood")); + if (cDepth > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/CrushDepth")); + if (dFlames > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/DemonFlames")); + if (gsInferno > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno")); + if (hFlames > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/HolyFlames")); + if (nightwither > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Nightwither")); + if (pFlames > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Plague")); + if (shellfishVore > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/ShellfishEating")); + if (pShred > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Shred")); + if (clamDebuff > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff")); + if (sulphurPoison > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning")); + if (vaporfied > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Vaporfied")); - float num66 = 0f; - Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); - Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - Color alpha15 = npc.GetAlpha(color9); - float num212 = 0.99f; - alpha15.R = (byte)(alpha15.R * num212); - alpha15.G = (byte)(alpha15.G * num212); - alpha15.B = (byte)(alpha15.B * num212); - alpha15.A = (byte)(alpha15.A * num212); - for (int num213 = 0; num213 < 4; num213++) - { - Vector2 position9 = npc.position; - float num214 = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); - float num215 = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); + // Stat debuffs + if (aCrunch > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/ArmorCrunch")); + if (enraged > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/Enraged")); + if (eutrophication > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/Eutrophication")); + if (eFreeze > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/ExoFreeze")); + if (gState > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/GlacialState")); + if (irradiated > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/Irradiated")); + if (marked > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/MarkedforDeath")); + if (pearlAura > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/PearlAura")); + if (silvaStun > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/SilvaStun")); + if (tSad > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TemporalSadness")); + if (tesla > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TeslaFreeze")); + if (timeSlow > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TimeSlow")); + if (wCleave > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/WarCleave")); + if (wDeath > 0) + buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/WhisperingDeath")); - if (num213 == 0 || num213 == 2) - { - position9.X = Main.LocalPlayer.Center.X + num214; - } - else - { - position9.X = Main.LocalPlayer.Center.X - num214; - } + // Vanilla damage over time debuffs + if (electrified > 0) + buffTextureList.Add(Main.buffTexture[BuffID.Electrified]); + if (npc.onFire) + buffTextureList.Add(Main.buffTexture[BuffID.OnFire]); + if (npc.poisoned) + buffTextureList.Add(Main.buffTexture[BuffID.Poisoned]); + if (npc.onFire2) + buffTextureList.Add(Main.buffTexture[BuffID.CursedInferno]); + if (npc.onFrostBurn) + buffTextureList.Add(Main.buffTexture[BuffID.Frostburn]); + if (npc.venom) + buffTextureList.Add(Main.buffTexture[BuffID.Venom]); + if (npc.shadowFlame) + buffTextureList.Add(Main.buffTexture[BuffID.ShadowFlame]); + if (npc.oiled) + buffTextureList.Add(Main.buffTexture[BuffID.Oiled]); + if (npc.javelined) + buffTextureList.Add(Main.buffTexture[BuffID.BoneJavelin]); + if (npc.daybreak) + buffTextureList.Add(Main.buffTexture[BuffID.Daybreak]); + if (npc.celled) + buffTextureList.Add(Main.buffTexture[BuffID.StardustMinionBleed]); + if (npc.dryadBane) + buffTextureList.Add(Main.buffTexture[BuffID.DryadsWardDebuff]); + if (npc.dryadWard) + buffTextureList.Add(Main.buffTexture[BuffID.DryadsWard]); + if (npc.soulDrain && npc.realLife == -1) + buffTextureList.Add(Main.buffTexture[BuffID.SoulDrain]); - position9.X -= npc.width / 2; + // Vanilla stat debuffs + if (npc.confused) + buffTextureList.Add(Main.buffTexture[BuffID.Confused]); + if (npc.ichor) + buffTextureList.Add(Main.buffTexture[BuffID.Ichor]); + if (slowed > 0) + buffTextureList.Add(Main.buffTexture[BuffID.Slow]); + if (webbed > 0) + buffTextureList.Add(Main.buffTexture[BuffID.Webbed]); + if (npc.midas) + buffTextureList.Add(Main.buffTexture[BuffID.Midas]); + if (npc.loveStruck) + buffTextureList.Add(Main.buffTexture[BuffID.Lovestruck]); + if (npc.stinky) + buffTextureList.Add(Main.buffTexture[BuffID.Stinky]); + if (npc.betsysCurse) + buffTextureList.Add(Main.buffTexture[BuffID.BetsysCurse]); + if (npc.dripping) + buffTextureList.Add(Main.buffTexture[BuffID.Wet]); + if (npc.drippingSlime) + buffTextureList.Add(Main.buffTexture[BuffID.Slimed]); - if (num213 == 0 || num213 == 1) - { - position9.Y = Main.LocalPlayer.Center.Y + num215; - } - else - { - position9.Y = Main.LocalPlayer.Center.Y - num215; - } + // Total amount of elements in the buff list + int buffTextureListLength = buffTextureList.Count; - position9.Y -= npc.height / 2; + // Total length of a single row in the buff display + int totalLength = buffTextureListLength * 14; - Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(position9.X - Main.screenPosition.X + npc.width / 2 - Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, position9.Y - Main.screenPosition.Y + npc.height - Main.npcTexture[npc.type].Height * npc.scale / Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - } - return true; - } + // Max amount of buffs per row + int buffDisplayRowLimit = 5; - public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor) - { - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - // His afterimages I can't get to work, so fuck it - if (npc.type == NPCID.SkeletronPrime) - { - Texture2D npcTexture = Main.npcTexture[npc.type]; - int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; + /* The maximum length of a single row in the buff display + * Limited to 80 units, because every buff drawn here is half the size of a normal buff, 16 x 16, 16 * 5 = 80 units*/ + float drawPosX = totalLength >= 80f ? 40f : (float)(totalLength / 2); - npc.frame.Y = (int)newAI[3]; + // The height of a single frame of the npc + float npcHeight = (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2) * npc.scale; - // Floating phase - if (npc.ai[1] == 0f || npc.ai[1] == 4f) - { - newAI[2] += 1f; - if (newAI[2] >= 12f) - { - newAI[2] = 0f; - newAI[3] = newAI[3] + frameHeight; + // Offset the debuff display based on the npc's graphical offset, and 16 units, to create some space between the sprite and the display + float drawPosY = npcHeight + npc.gfxOffY + 16f; - if (newAI[3] / frameHeight >= 2f) - { - newAI[3] = 0f; - } - } - } + // The position where the display is drawn + Vector2 drawPos = npc.Center - Main.screenPosition; - // Spinning probe spawn or fly over phase - else if (npc.ai[1] == 5f || npc.ai[1] == 6f) - { - newAI[2] = 0f; - newAI[3] = frameHeight; - } + // Iterate through the buff texture list + for (int i = 0; i < buffTextureList.Count; i++) + { + // Reset the X position of the display every 5th and non-zero iteration, otherwise decrease the X draw position by 16 units + if (i != 0) + { + if (i % buffDisplayRowLimit == 0) + drawPosX = 40f; + else + drawPosX -= 14f; + } - // Spinning phase - else - { - newAI[2] = 0f; - newAI[3] = frameHeight * 2; - } + // Offset the Y position every row after 5 iterations to limit each displayed row to 5 debuffs + float additionalYOffset = 14f * (float)Math.Floor(i * 0.2); - npc.frame.Y = (int)newAI[3]; - - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - - spriteBatch.Draw(npcTexture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - - spriteBatch.Draw(Main.BoneEyesTexture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), - npc.frame, new Color(200, 200, 200, 0), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); - } - } + // Draw the display + spriteBatch.Draw(buffTextureList.ElementAt(i), drawPos - new Vector2(drawPosX, drawPosY + additionalYOffset), null, Color.White, 0f, default, 0.5f, SpriteEffects.None, 0f); + } + } + } if (CalamityMod.CalamityConfig.TownNPCNewShopInventoryAlertDisplay && npc.townNPC) { @@ -4606,165 +4653,121 @@ namespace CalamityMod.NPCs } } - if (CalamityMod.CalamityConfig.EnemyDebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type))) - { - List buffTextureList = new List(); + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + if (npc.type == NPCID.SkeletronPrime) + { + return false; + } + } - // Damage over time debuffs - if (aFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/AbyssalFlames")); - if (astralInfection > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/AstralInfectionDebuff")); - if (bFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/BrimstoneFlames")); - if (bBlood > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/BurningBlood")); - if (cDepth > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/CrushDepth")); - if (dFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/DemonFlames")); - if (gsInferno > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno")); - if (hFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/HolyFlames")); - if (nightwither > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Nightwither")); - if (pFlames > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Plague")); - if (shellfishVore > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/ShellfishEating")); - if (pShred > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Shred")); - if (clamDebuff > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff")); - if (sulphurPoison > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning")); - if (vaporfied > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/DamageOverTime/Vaporfied")); + if (Main.LocalPlayer.Calamity().trippy) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } - // Stat debuffs - if (aCrunch > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/ArmorCrunch")); - if (enraged > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/Enraged")); - if (eutrophication > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/Eutrophication")); - if (eFreeze > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/ExoFreeze")); - if (gState > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/GlacialState")); - if (irradiated > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/Irradiated")); - if (marked > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/MarkedforDeath")); - if (pearlAura > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/PearlAura")); - if (silvaStun > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/SilvaStun")); - if (tSad > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TemporalSadness")); - if (tesla > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TeslaFreeze")); - if (timeSlow > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/TimeSlow")); - if (wCleave > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/WarCleave")); - if (wDeath > 0) - buffTextureList.Add(ModContent.GetTexture("CalamityMod/Buffs/StatDebuffs/WhisperingDeath")); + float num66 = 0f; + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); + Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Color alpha15 = npc.GetAlpha(color9); + float num212 = 0.99f; + alpha15.R = (byte)(alpha15.R * num212); + alpha15.G = (byte)(alpha15.G * num212); + alpha15.B = (byte)(alpha15.B * num212); + alpha15.A = (byte)(alpha15.A * num212); + for (int num213 = 0; num213 < 4; num213++) + { + Vector2 position9 = npc.position; + float num214 = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float num215 = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); - // Vanilla damage over time debuffs - if (electrified > 0) - buffTextureList.Add(Main.buffTexture[BuffID.Electrified]); - if (npc.onFire) - buffTextureList.Add(Main.buffTexture[BuffID.OnFire]); - if (npc.poisoned) - buffTextureList.Add(Main.buffTexture[BuffID.Poisoned]); - if (npc.onFire2) - buffTextureList.Add(Main.buffTexture[BuffID.CursedInferno]); - if (npc.onFrostBurn) - buffTextureList.Add(Main.buffTexture[BuffID.Frostburn]); - if (npc.venom) - buffTextureList.Add(Main.buffTexture[BuffID.Venom]); - if (npc.shadowFlame) - buffTextureList.Add(Main.buffTexture[BuffID.ShadowFlame]); - if (npc.oiled) - buffTextureList.Add(Main.buffTexture[BuffID.Oiled]); - if (npc.javelined) - buffTextureList.Add(Main.buffTexture[BuffID.BoneJavelin]); - if (npc.daybreak) - buffTextureList.Add(Main.buffTexture[BuffID.Daybreak]); - if (npc.celled) - buffTextureList.Add(Main.buffTexture[BuffID.StardustMinionBleed]); - if (npc.dryadBane) - buffTextureList.Add(Main.buffTexture[BuffID.DryadsWardDebuff]); - if (npc.dryadWard) - buffTextureList.Add(Main.buffTexture[BuffID.DryadsWard]); - if (npc.soulDrain && npc.realLife == -1) - buffTextureList.Add(Main.buffTexture[BuffID.SoulDrain]); + if (num213 == 0 || num213 == 2) + { + position9.X = Main.LocalPlayer.Center.X + num214; + } + else + { + position9.X = Main.LocalPlayer.Center.X - num214; + } - // Vanilla stat debuffs - if (npc.confused) - buffTextureList.Add(Main.buffTexture[BuffID.Confused]); - if (npc.ichor) - buffTextureList.Add(Main.buffTexture[BuffID.Ichor]); - if (slowed > 0) - buffTextureList.Add(Main.buffTexture[BuffID.Slow]); - if (webbed > 0) - buffTextureList.Add(Main.buffTexture[BuffID.Webbed]); - if (npc.midas) - buffTextureList.Add(Main.buffTexture[BuffID.Midas]); - if (npc.loveStruck) - buffTextureList.Add(Main.buffTexture[BuffID.Lovestruck]); - if (npc.stinky) - buffTextureList.Add(Main.buffTexture[BuffID.Stinky]); - if (npc.betsysCurse) - buffTextureList.Add(Main.buffTexture[BuffID.BetsysCurse]); - if (npc.dripping) - buffTextureList.Add(Main.buffTexture[BuffID.Wet]); - if (npc.drippingSlime) - buffTextureList.Add(Main.buffTexture[BuffID.Slimed]); + position9.X -= npc.width / 2; - // Total amount of elements in the buff list - int buffTextureListLength = buffTextureList.Count; + if (num213 == 0 || num213 == 1) + { + position9.Y = Main.LocalPlayer.Center.Y + num215; + } + else + { + position9.Y = Main.LocalPlayer.Center.Y - num215; + } - // Total length of a single row in the buff display - int totalLength = buffTextureListLength * 16; + position9.Y -= npc.height / 2; - // Max amount of buffs per row - int buffDisplayRowLimit = 5; + Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(position9.X - Main.screenPosition.X + npc.width / 2 - Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, position9.Y - Main.screenPosition.Y + npc.height - Main.npcTexture[npc.type].Height * npc.scale / Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + } + return true; + } - /* The maximum length of a single row in the buff display - * Limited to 80 units, because every buff drawn here is half the size of a normal buff, 16 x 16, 16 * 5 = 80 units*/ - float drawPosX = totalLength >= 80f ? 40f : (float)(totalLength / 2); + public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor) + { + if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + { + // His afterimages I can't get to work, so fuck it + if (npc.type == NPCID.SkeletronPrime) + { + Texture2D npcTexture = Main.npcTexture[npc.type]; + int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; - // The height of a single frame of the npc - float npcHeight = (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2) * npc.scale; + npc.frame.Y = (int)newAI[3]; - // Offset the debuff display based on the npc's graphical offset, and 16 units, to create some space between the sprite and the display - float drawPosY = npcHeight + npc.gfxOffY + 16f; + // Floating phase + if (npc.ai[1] == 0f || npc.ai[1] == 4f) + { + newAI[2] += 1f; + if (newAI[2] >= 12f) + { + newAI[2] = 0f; + newAI[3] = newAI[3] + frameHeight; - // The position where the display is drawn - Vector2 drawPos = npc.Center - Main.screenPosition; + if (newAI[3] / frameHeight >= 2f) + { + newAI[3] = 0f; + } + } + } - // Iterate through the buff texture list - for (int i = 0; i < buffTextureList.Count; i++) - { - // Reset the X position of the display every 5th and non-zero iteration, otherwise decrease the X draw position by 16 units - if (i != 0) - { - if (i % buffDisplayRowLimit == 0) - drawPosX = 40f; - else - drawPosX -= 16f; - } + // Spinning probe spawn or fly over phase + else if (npc.ai[1] == 5f || npc.ai[1] == 6f) + { + newAI[2] = 0f; + newAI[3] = frameHeight; + } - // Offset the Y position every row after 5 iterations to limit each displayed row to 5 debuffs - float additionalYOffset = 16f * (float)Math.Floor(i * 0.2); + // Spinning phase + else + { + newAI[2] = 0f; + newAI[3] = frameHeight * 2; + } - // Draw the display - spriteBatch.Draw(buffTextureList.ElementAt(i), drawPos - new Vector2(drawPosX, drawPosY + additionalYOffset), null, Color.White, 0f, default, 0.5f, SpriteEffects.None, 0f); - } - } + npc.frame.Y = (int)newAI[3]; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + + spriteBatch.Draw(npcTexture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + + spriteBatch.Draw(Main.BoneEyesTexture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), + npc.frame, new Color(200, 200, 200, 0), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + } + } } public override bool? DrawHealthBar(NPC npc, byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index d31873212c..92d0cfc62a 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.TownNPCs if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns) { if (Main.rand.NextBool(2)) - return "I deeply appreciate you rescuing me from being trapped within my frozen castle. It's been many, many years..."; + return "I deeply appreciate you rescuing me from being trapped within my frozen castle... It's been many, many years..."; else return "Thank you for saving me...though now I admit I am without a home since mine got destroyed."; } diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index 87dba79563..988eec1184 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - DisplayName.SetDefault("Birb Aura"); + DisplayName.SetDefault("Draconic Aura"); } public override void SetDefaults() diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index 214d7795c2..bcd79cbe65 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Boss { public override void SetStaticDefaults() { - DisplayName.SetDefault("Birb Aura Flare"); + DisplayName.SetDefault("Draconic Aura Flare"); } public override void SetDefaults() diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index 76ac79d3b3..41b0f15136 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -46,9 +46,7 @@ namespace CalamityMod.Projectiles.Boss Vector2? vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { projectile.velocity = -Vector2.UnitY; - } if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) { @@ -56,12 +54,7 @@ namespace CalamityMod.Projectiles.Boss projectile.position = fireFrom - new Vector2((float)projectile.width, (float)projectile.height) / 2f; } - if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { - projectile.velocity = -Vector2.UnitY; - } - - float num801 = 1f; + float num801 = 1f; projectile.localAI[0] += 1f; if (projectile.localAI[0] >= 105f) { @@ -69,14 +62,14 @@ namespace CalamityMod.Projectiles.Boss return; } - projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * 3.14159274f / 105f)) * 10f * num801; + projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * (float)Math.PI / 105f)) * 10f * num801; if (projectile.scale > num801) { projectile.scale = num801; } float num804 = projectile.velocity.ToRotation(); - projectile.rotation = num804 - 1.57079637f; + projectile.rotation = num804 - MathHelper.PiOver2; projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; //3f @@ -108,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); for (int num809 = 0; num809 < 2; num809++) { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); int num812 = Dust.NewDust(vector79, 0, 0, (int)CalamityDusts.Brimstone, vector80.X, vector80.Y, 0, default, 1f); @@ -118,7 +111,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(5)) { - Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num813]; dust.velocity *= 0.5f; diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index 939ba34742..8d1e954070 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -1,7 +1,13 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; +using Terraria.Enums; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -14,35 +20,166 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.penetrate = -1; - projectile.extraUpdates = 100; - projectile.timeLeft = 300; - } + projectile.width = 10; + projectile.height = 10; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 600; + projectile.scale = 0.1f; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } public override void AI() { - projectile.tileCollide = Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1); + Vector2? vector78 = null; - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) - { - projectile.ai[0] = 0f; - } - else if (projectile.ai[0] % 2f == 0f) - { - Vector2 value7 = new Vector2(5f, 10f); - Vector2 value8 = Vector2.UnitX * -12f; + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + projectile.velocity = -Vector2.UnitY; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)Main.rand.Next(1, 3) * 3.14159274f), default(Vector2)) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); - Main.dust[num42].scale = (float)Main.rand.Next(70, 110) * 0.008f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; + if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) + { + Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + (Main.npc[(int)projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)projectile.ai[1]].Center.Y - 74f); + projectile.position = fireFrom - new Vector2((float)projectile.width, (float)projectile.height) / 2f; } + + Vector2 laserVelocity = new Vector2(Main.npc[(int)projectile.ai[1]].Calamity().newAI[1], Main.npc[(int)projectile.ai[1]].Calamity().newAI[2]); + float rotationVelocity = projectile.ai[0] == 0f ? laserVelocity.ToRotation() : projectile.velocity.ToRotation(); + projectile.rotation = rotationVelocity - MathHelper.PiOver2; + projectile.velocity = rotationVelocity.ToRotationVector2(); + + if (projectile.ai[0] == 0f) + { + if (Main.npc[(int)projectile.ai[1]].ai[1] >= 150f) + { + projectile.Kill(); + return; + } + } + else + { + if (Main.npc[(int)projectile.ai[1]].ai[1] >= 180f) + { + projectile.Kill(); + return; + } + } + + float num805 = 3f; //3f + float num806 = (float)projectile.width; + + Vector2 samplingPoint = projectile.Center; + if (vector78.HasValue) + { + samplingPoint = vector78.Value; + } + + float[] array3 = new float[(int)num805]; + Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + float num807 = 0f; + for (int num808 = 0; num808 < array3.Length; num808++) + { + num807 += array3[num808]; + } + num807 /= num805; + + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) + { + num807 = 2400f; + } + + float amount = 0.5f; //0.5f + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation + + DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D texture2D19 = Main.projectileTexture[projectile.type]; + Texture2D texture2D20 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BrimstoneRayMid"); + Texture2D texture2D21 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BrimstoneRayEnd"); + float num223 = projectile.localAI[1]; //length of laser + Color color44 = new Color(255, 255, 255, 0) * 0.9f; + Vector2 vector = projectile.Center - Main.screenPosition; + Rectangle? sourceRectangle2 = null; + spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; + Vector2 value20 = projectile.Center; + value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f; + if (num223 > 0f) + { + float num224 = 0f; + Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); + while (num224 + 1f < num223) + { + if (num223 - num224 < (float)rectangle7.Height) + { + rectangle7.Height = (int)(num223 - num224); + } + spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num224 += (float)rectangle7.Height * projectile.scale; + value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; + rectangle7.Y += 16; + if (rectangle7.Y + rectangle7.Height > texture2D20.Height) + { + rectangle7.Y = 0; + } + } + } + Vector2 vector2 = value20 - Main.screenPosition; + sourceRectangle2 = null; + spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + { + return true; + } + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } } diff --git a/Projectiles/Melee/DarkIceZero.cs b/Projectiles/Melee/DarkIceZero.cs index 6d15c5f03c..4b458f3825 100644 --- a/Projectiles/Melee/DarkIceZero.cs +++ b/Projectiles/Melee/DarkIceZero.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee { if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) { - projectile.velocity *= 1.035f; + projectile.velocity *= 1.045f; } //make pretty dust diff --git a/Projectiles/Melee/MourningstarFlail.cs b/Projectiles/Melee/MourningstarFlail.cs index 7a602f1b75..e885d8e161 100644 --- a/Projectiles/Melee/MourningstarFlail.cs +++ b/Projectiles/Melee/MourningstarFlail.cs @@ -1,4 +1,7 @@ using CalamityMod.Projectiles.BaseProjectiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -22,5 +25,15 @@ namespace CalamityMod.Projectiles.Melee projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 300); + if (projectile.localAI[1] <= 0f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ProjectileID.SolarWhipSwordExplosion, projectile.damage, knockback, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + } + projectile.localAI[1] = 4f; + } } } diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/ProfanedSwordProj.cs index 2bc87ddb94..9443705e41 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/ProfanedSwordProj.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -60,6 +61,9 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + if (CalamityGlobalNPC.AquaticScourgeIDs.Contains(target.type) || CalamityGlobalNPC.DestroyerIDs.Contains(target.type)) + projectile.penetrate--; + target.immune[projectile.owner] = 6; target.AddBuff(ModContent.BuffType(), 180); if (Main.myPlayer == projectile.owner) diff --git a/Projectiles/Rogue/Brick.cs b/Projectiles/Rogue/Brick.cs index 58c6717ab3..a4867e0f63 100644 --- a/Projectiles/Rogue/Brick.cs +++ b/Projectiles/Rogue/Brick.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Rogue; namespace CalamityMod.Projectiles.Rogue { public class Brick : ModProjectile @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity.Y = 16f; } //Dust trail - if (Main.rand.Next(13) == 0) + if (Main.rand.NextBool(13)) { Dust.NewDust(projectile.position, projectile.width, projectile.height, 22, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 150, default, 0.9f); } @@ -35,6 +36,11 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { + if (Main.rand.NextBool(2)) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 50); //Dust on impact int dust_splash = 0; @@ -63,7 +69,7 @@ namespace CalamityMod.Projectiles.Rogue } //Spawn the projectile - Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 2f, projectile.owner); + Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), projectile.knockBack / 2f, projectile.owner); split += 1; } } diff --git a/Projectiles/Rogue/SulphuricNukesplosion.cs b/Projectiles/Rogue/SulphuricNukesplosion.cs index e0e58796dd..7299485a6e 100644 --- a/Projectiles/Rogue/SulphuricNukesplosion.cs +++ b/Projectiles/Rogue/SulphuricNukesplosion.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.alpha = 255; projectile.Calamity().rogue = true; projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 4; + projectile.idStaticNPCHitCooldown = 11; } public override bool PreAI() @@ -49,8 +49,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.position = projectile.Center; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.idStaticNPCHitCooldown = 9; boomerTime = 1; } diff --git a/Projectiles/Summon/ColdDivinityPointyThing.cs b/Projectiles/Summon/ColdDivinityPointyThing.cs index 11644bf03f..39beb566ec 100644 --- a/Projectiles/Summon/ColdDivinityPointyThing.cs +++ b/Projectiles/Summon/ColdDivinityPointyThing.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.timeLeft <= 240) { - NPC target = CalamityUtils.MinionHoming(Main.player[projectile.owner].Center, 700f, Main.player[projectile.owner]); + NPC target = CalamityUtils.MinionHoming(projectile.Center, 700f, Main.player[projectile.owner]); if (target != null) //target found { float num550 = 40f; @@ -173,7 +174,11 @@ namespace CalamityMod.Projectiles.Summon if (recharging == 0) { dust(15); - Main.PlaySound(SoundID.Item30, projectile.position); + SoundEffectInstance sound = Main.PlaySound(SoundID.Item30, projectile.position); + if (sound != null) + { + sound.Pitch = 0.2f; + } projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/HallowedStarSummon.png b/Projectiles/Summon/HallowedStarSummon.png index dd1ff7e882..c68210dfe7 100644 Binary files a/Projectiles/Summon/HallowedStarSummon.png and b/Projectiles/Summon/HallowedStarSummon.png differ diff --git a/Projectiles/Summon/MagicAxe.cs b/Projectiles/Summon/MagicAxe.cs index 5edcf7e95e..fa1a5f2f3a 100644 --- a/Projectiles/Summon/MagicAxe.cs +++ b/Projectiles/Summon/MagicAxe.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ignoreWater = true; projectile.minionSlots = 0; projectile.timeLeft = 180; - projectile.penetrate = 5; + projectile.penetrate = -1; projectile.minion = true; projectile.tileCollide = false; projectile.extraUpdates = 1; @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Summon return; } Vector2 vector46 = projectile.position; - float homingRange = 1000f; + float homingRange = MagicHat.Range; bool homeIn = false; if (player.HasMinionAttackTargetNPC) { diff --git a/Projectiles/Summon/MagicBird.cs b/Projectiles/Summon/MagicBird.cs index 2bb8f5ba5a..0368314b90 100644 --- a/Projectiles/Summon/MagicBird.cs +++ b/Projectiles/Summon/MagicBird.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[projectile.owner]; int targetIdx = -1; - float maxHomingRange = 700f; + float maxHomingRange = MagicHat.Range; bool hasHomingTarget = false; if (player.HasMinionAttackTargetNPC) { diff --git a/Projectiles/Summon/MagicBullet.cs b/Projectiles/Summon/MagicBullet.cs index c81f50813b..cf7d5502ea 100644 --- a/Projectiles/Summon/MagicBullet.cs +++ b/Projectiles/Summon/MagicBullet.cs @@ -34,20 +34,20 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(BuffID.BetsysCurse, 180); + target.AddBuff(BuffID.Ichor, 180); target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.BetsysCurse, 180); - target.AddBuff(BuffID.Ichor, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { + target.AddBuff(BuffID.BetsysCurse, 180); + target.AddBuff(BuffID.Ichor, 180); target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.BetsysCurse, 180); - target.AddBuff(BuffID.Ichor, 180); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/MagicHammer.cs b/Projectiles/Summon/MagicHammer.cs index 7e9896fc6d..8169471b2e 100644 --- a/Projectiles/Summon/MagicHammer.cs +++ b/Projectiles/Summon/MagicHammer.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon } int num716 = -1; Vector2 vector59 = projectile.Center; - float num717 = 700f; + float num717 = MagicHat.Range; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Summon 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) + if (num723 < MagicHat.Range * 1.25f) { flag32 = true; vector59 = Main.npc[num720].Center; diff --git a/Projectiles/Summon/MagicHat.cs b/Projectiles/Summon/MagicHat.cs index ec33d284ad..1960186768 100644 --- a/Projectiles/Summon/MagicHat.cs +++ b/Projectiles/Summon/MagicHat.cs @@ -9,11 +9,15 @@ namespace CalamityMod.Projectiles.Summon { public class MagicHat : ModProjectile { + public const float Range = 1500.0001f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Magic Hat"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() @@ -67,7 +71,7 @@ namespace CalamityMod.Projectiles.Summon projectile.position.X = (float)(int)projectile.position.X; projectile.position.Y = (float)(int)projectile.position.Y; - //I don't know what this is + //Change the summons scale size a little bit to make it pulse in and out float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; projectile.scale = num395 + 0.95f; @@ -89,8 +93,7 @@ namespace CalamityMod.Projectiles.Summon if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * - player.MinionDamage()); + modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; } @@ -99,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon { float projPosX = projectile.position.X; float projPosY = projectile.position.Y; - float detectionRange = 1500f; + float detectionRange = Range; bool enemyDetected = false; if (player.HasMinionAttackTargetNPC) { diff --git a/Projectiles/Summon/MagicRifle.cs b/Projectiles/Summon/MagicRifle.cs index 3d5d342c13..001b0945c4 100644 --- a/Projectiles/Summon/MagicRifle.cs +++ b/Projectiles/Summon/MagicRifle.cs @@ -63,8 +63,8 @@ namespace CalamityMod.Projectiles.Summon counter++; canHome = true; } - float homingRange = 1000f; - float num634 = 1300f; + float homingRange = MagicHat.Range; + float num634 = 1600f; float num635 = 2600f; float num636 = 600f; Vector2 vector46 = projectile.position; diff --git a/Projectiles/Summon/MagicUmbrella.cs b/Projectiles/Summon/MagicUmbrella.cs index cb2f04dd11..ed47093b0a 100644 --- a/Projectiles/Summon/MagicUmbrella.cs +++ b/Projectiles/Summon/MagicUmbrella.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ignoreWater = true; projectile.minionSlots = 0f; projectile.timeLeft = 180; - projectile.penetrate = 5; + projectile.penetrate = 10; projectile.tileCollide = false; projectile.minion = true; projectile.usesLocalNPCImmunity = true; @@ -41,8 +41,8 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[projectile.owner]; projectile.rotation += 0.075f; projectile.alpha -= 50; - float num633 = 1000f; - float num634 = 1000f; + float num633 = MagicHat.Range; + float num634 = 1600f; float num635 = 2200f; float num636 = 150f; float num637 = 0.05f; @@ -75,6 +75,10 @@ namespace CalamityMod.Projectiles.Summon counter++; canHome = true; } + else + { + canHome = true; + } bool flag24 = false; if (projectile.ai[0] == 2f) { @@ -268,7 +272,7 @@ namespace CalamityMod.Projectiles.Summon num16 = (float)num15 / num16; num13 *= num16; num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((float)projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); + Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)(projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); } } } @@ -290,7 +294,7 @@ namespace CalamityMod.Projectiles.Summon num16 = (float)num15 / num16; num13 *= num16; num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((float)projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); + Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)(projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/PlaguePrincess.cs b/Projectiles/Summon/PlaguePrincess.cs index f9bc00b753..da7e5be419 100644 --- a/Projectiles/Summon/PlaguePrincess.cs +++ b/Projectiles/Summon/PlaguePrincess.cs @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Summon AIint = 0; } - float num633 = 700f; + float num633 = 1040f; float num636 = 400f; //150 Vector2 targetLocation = projectile.position; bool targetFound = false; diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index 14474f0c28..6cfd527b16 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -228,8 +228,8 @@ namespace CalamityMod.Projectiles.Summon } if (num651 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); projectile.netUpdate = true; } if (num651 > 70f) @@ -282,9 +282,7 @@ namespace CalamityMod.Projectiles.Summon public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (target.type == NPCID.DukeFishron) - damage = (int)(damage * 2.0); - else if (target.type == NPCID.CultistBoss) + if (target.type == NPCID.CultistBoss) damage = (int)(damage * 0.75); } diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index 9f1c30b3e3..f70a4a4eca 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -98,9 +98,7 @@ namespace CalamityMod.Projectiles.Summon public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (target.type == NPCID.DukeFishron) - damage = (int)(damage * 2.0); - else if (target.type == NPCID.CultistBoss) + if (target.type == NPCID.CultistBoss) damage = (int)(damage * 0.75); } diff --git a/Projectiles/Typeless/FuckYou.cs b/Projectiles/Typeless/FuckYou.cs index 63c0ad13ce..724fd95c92 100644 --- a/Projectiles/Typeless/FuckYou.cs +++ b/Projectiles/Typeless/FuckYou.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -39,14 +40,14 @@ namespace CalamityMod.Projectiles.Typeless projectile.Kill(); return; } - int num3 = projectile.frameCounter + 1; - projectile.frameCounter = num3; - if (num3 >= 3) + int incrementer = projectile.frameCounter + 1; + projectile.frameCounter = incrementer; + if (incrementer >= 3) { projectile.frameCounter = 0; - num3 = projectile.frame + 1; - projectile.frame = num3; - if (num3 >= Main.projFrames[projectile.type]) + incrementer = projectile.frame + 1; + projectile.frame = incrementer; + if (incrementer >= Main.projFrames[projectile.type]) { projectile.hide = true; } @@ -62,44 +63,43 @@ namespace CalamityMod.Projectiles.Typeless projectile.width = projectile.height = (int)(52f * projectile.scale); projectile.Center = projectile.position; Main.PlaySound(SoundID.Item14, projectile.position); - for (int num991 = 0; num991 < 4; num991 = num3 + 1) + for (int dustIndexA = 0; dustIndexA < 4; dustIndexA = incrementer + 1) { int num992 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); - Main.dust[num992].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - num3 = num991; + Main.dust[num992].position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + incrementer = dustIndexA; } - for (int num993 = 0; num993 < 10; num993 = num3 + 1) + for (int dustIndexB = 0; dustIndexB < 10; dustIndexB = incrementer + 1) { - int num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 200, default, 2.7f); - Main.dust[num994].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num994].noGravity = true; - Dust dust = Main.dust[num994]; + int fireDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 200, default, 2.7f); + Dust dust = Main.dust[fireDust]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; - num994 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1.5f); - Main.dust[num994].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num994]; + fireDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1.5f); + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; dust.velocity *= 2f; - Main.dust[num994].noGravity = true; - Main.dust[num994].fadeIn = 2.5f; - num3 = num993; + dust.noGravity = true; + dust.fadeIn = 2.5f; + incrementer = dustIndexB; } - for (int num995 = 0; num995 < 5; num995 = num3 + 1) + for (int dustIndexC = 0; dustIndexC < 5; dustIndexC = incrementer + 1) { - int num996 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 0, default, 2.7f); - Main.dust[num996].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num996].noGravity = true; - Dust dust = Main.dust[num996]; + int fireDust2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 0, default, 2.7f); + Dust dust = Main.dust[fireDust2]; + dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; - num3 = num995; + incrementer = dustIndexC; } - for (int num997 = 0; num997 < 10; num997 = num3 + 1) + for (int dustIndexD = 0; dustIndexD < 10; dustIndexD = incrementer + 1) { int num998 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 0, default, 1.5f); - Main.dust[num998].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; - Main.dust[num998].noGravity = true; Dust dust = Main.dust[num998]; + dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; - num3 = num997; + incrementer = dustIndexD; } } } @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Typeless public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - damage = (int)((double)damage * 0.3); + damage = (int)(damage * 0.3); } } }