diff --git a/Buffs/StatDebuffs/GlacialState.png b/Buffs/StatDebuffs/GlacialState.png index b3d02f6cff..f3b591dff6 100644 Binary files a/Buffs/StatDebuffs/GlacialState.png and b/Buffs/StatDebuffs/GlacialState.png differ diff --git a/Buffs/Summon/GastricBelcherBuff.cs b/Buffs/Summon/GastricBelcherBuff.cs new file mode 100644 index 0000000000..e45bba25a9 --- /dev/null +++ b/Buffs/Summon/GastricBelcherBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class GastricBelcherBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Gastric Aberration"); + Description.SetDefault("The aquatic aberration will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.gastricBelcher = true; + } + if (!modPlayer.gastricBelcher) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/GastricBelcherBuff.png b/Buffs/Summon/GastricBelcherBuff.png new file mode 100644 index 0000000000..7a81dd519c Binary files /dev/null and b/Buffs/Summon/GastricBelcherBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 071b1fb791..dfd865b68b 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; @@ -51,6 +52,7 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.ModLoader.Config; namespace CalamityMod.CalPlayer { @@ -81,6 +83,7 @@ namespace CalamityMod.CalPlayer #region No Category public static bool areThereAnyDamnBosses = false; + public static bool areThereAnyDamnEvents = false; public bool drawBossHPBar = true; public bool shouldDrawSmallText = true; private const int saveVersion = 0; @@ -92,10 +95,12 @@ namespace CalamityMod.CalPlayer public int actualMaxLife = 0; public int deathModeUnderworldTime = 0; public int deathModeBlizzardTime = 0; - public static int chaosStateDuration = 600; + public static int chaosStateDuration = 360; + public static int chaosStateDurationBoss = 600; public bool killSpikyBalls = false; public Projectile lastProjectileHit; public double acidRoundMultiplier = 1D; + public int waterLeechTarget = -1; #endregion #region External variables -- Only set by Mod.Call @@ -190,6 +195,7 @@ namespace CalamityMod.CalPlayer public int profanedSoulWeaponType = 0; public int hurtSoundTimer = 0; public int danceOfLightCharge = 0; + public int shadowPotCooldown = 0; #endregion #region Sound @@ -228,6 +234,7 @@ namespace CalamityMod.CalPlayer public bool stealthStrikeHalfCost = false; public bool stealthStrikeAlwaysCrits = false; public bool wearingRogueArmor = false; + public float accStealthGenBoost = 0f; public float throwingDamage = 1f; public float throwingVelocity = 1f; @@ -839,6 +846,7 @@ namespace CalamityMod.CalPlayer public bool rDevil = false; public bool aValkyrie = false; public bool apexShark = false; + public bool gastricBelcher = false; public bool squirrel = false; public bool hauntedDishes = false; public bool stormjaw = false; @@ -1280,6 +1288,7 @@ namespace CalamityMod.CalPlayer throwingAmmoCost75 = false; throwingAmmoCost66 = false; throwingAmmoCost50 = false; + accStealthGenBoost = 0f; dashMod = 0; externalAbyssLight = 0; @@ -1786,6 +1795,7 @@ namespace CalamityMod.CalPlayer eAxe = false; endoCooper = false; apexShark = false; + gastricBelcher = false; squirrel = false; hauntedDishes = false; stormjaw = false; @@ -1893,6 +1903,7 @@ namespace CalamityMod.CalPlayer planarSpeedBoost = 0; galileoCooldown = 0; soundCooldown = 0; + shadowPotCooldown = 0; rage = 0; adrenaline = 0; raiderStack = 0; @@ -2345,6 +2356,10 @@ namespace CalamityMod.CalPlayer ZoneSulphur = (CalamityWorld.sulphurTiles > 30 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; + //Overriding 1.4's ass req boosts + if (Main.snowTiles > 300) + player.ZoneSnow = true; + Mod fargos = ModLoader.GetMod("Fargowiltas"); if (fargos != null) { @@ -2508,12 +2523,14 @@ namespace CalamityMod.CalPlayer player.Teleport(teleportLocation, 4, 0); NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); + int duration = chaosStateDuration; + if (areThereAnyDamnBosses || areThereAnyDamnEvents) + duration = chaosStateDurationBoss; if (eScarfCooldown) - player.AddBuff(BuffID.ChaosState, (int)(chaosStateDuration * 1.5), true); - else if (scarfCooldown) - player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); - else - player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); + duration = (int)(chaosStateDuration * 1.5); + else if (scarfCooldown) + duration = chaosStateDuration * 2; + player.AddBuff(BuffID.ChaosState, duration, true); } } } @@ -2561,12 +2578,14 @@ namespace CalamityMod.CalPlayer player.Teleport(teleportLocation, 1, 0); NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); - if (eScarfCooldown) - player.AddBuff(BuffID.ChaosState, (int)(chaosStateDuration * 1.5), true); - else if (scarfCooldown) - player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); - else - player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); + int duration = chaosStateDuration; + if (areThereAnyDamnBosses || areThereAnyDamnEvents) + duration = chaosStateDurationBoss; + if (eScarfCooldown) + duration = (int)(chaosStateDuration * 1.5); + else if (scarfCooldown) + duration = chaosStateDuration * 2; + player.AddBuff(BuffID.ChaosState, duration, true); int numDust = 40; Vector2 step = playerToTeleport / numDust; @@ -4007,9 +4026,9 @@ namespace CalamityMod.CalPlayer acidRoundMultiplier = 1D; } //Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me - if (desertProwler && (item.ranged/* || item.type == ModContent.ItemType()*/)) + if (desertProwler && (item.ranged || item.type == ModContent.ItemType())) { - flat += 2f; + flat += 1f; } } @@ -7763,7 +7782,7 @@ namespace CalamityMod.CalPlayer float dashDistance; if (dashMod == 1) //Counter and Evasion Scarf { - dashDistance = evasionScarf ? 16.9f : 14.5f; + dashDistance = evasionScarf ? 16.3f : 14.5f; int direction = 0; bool justDashed = false; if (dashTimeMod > 0) @@ -8272,7 +8291,7 @@ namespace CalamityMod.CalPlayer { if (evasionScarf) { - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(6f)); + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(9f)); player.AddBuff(ModContent.BuffType(), player.chaosState ? CalamityUtils.SecondsToFrames(20f) : CalamityUtils.SecondsToFrames(13f)); } else @@ -8817,8 +8836,8 @@ namespace CalamityMod.CalPlayer } public override void PreUpdate() - { - tailFrameUp++; + { + tailFrameUp++; if (tailFrameUp == 8) { tailFrame++; @@ -9840,6 +9859,10 @@ namespace CalamityMod.CalPlayer if (etherealExtorter && Main.moonPhase == 3) // 3 = Waning Crescent stealthGenStandstill += 0.15f; + //Accessory modifiers can boost these stats + stealthGenStandstill += accStealthGenBoost; + stealthGenMoving += accStealthGenBoost; + // // Other code which affects stealth generation goes here. // Increase stealthGenStandstill (default 1.0) to give a % boost to stealth gen while standing still. @@ -11113,6 +11136,7 @@ namespace CalamityMod.CalPlayer int frame = HandlePSCAnimationFrames(animType); player.legFrame.Y = player.legFrame.Height * frame; } + waterLeechTarget = -1; } #endregion diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index a14cc532c1..858dfdd1b3 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -56,6 +56,9 @@ namespace CalamityMod.CalPlayer // Bool for any existing bosses, true if any boss NPC is active CalamityPlayer.areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS(); + // Bool for any existing events, true if any event is active + CalamityPlayer.areThereAnyDamnEvents = CalamityGlobalNPC.AnyEvents(player); + // If any boss NPC is active, apply Zen to the player to reduce spawn rate if (CalamityPlayer.areThereAnyDamnBosses) { @@ -894,6 +897,8 @@ namespace CalamityMod.CalPlayer modPlayer.galileoCooldown--; if (modPlayer.soundCooldown > 0) modPlayer.soundCooldown--; + if (modPlayer.shadowPotCooldown > 0) + modPlayer.shadowPotCooldown--; if (modPlayer.raiderCooldown > 0) modPlayer.raiderCooldown--; if (modPlayer.gSabatonCooldown > 0) @@ -3549,7 +3554,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.prismaticLasers > 1800 && player.whoAmI == Main.myPlayer) { float shootSpeed = 18f; - int dmg = (int)(150 * player.MagicDamage()); + int dmg = (int)(50 * player.MagicDamage()); Vector2 startPos = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 velocity = Main.MouseWorld - startPos; if (player.gravDir == -1f) @@ -3568,7 +3573,7 @@ namespace CalamityMod.CalPlayer travelDist = shootSpeed / travelDist; } - int laserAmt = 2; + int laserAmt = Main.rand.Next(2); for (int index = 0; index < laserAmt; index++) { startPos = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); @@ -3590,7 +3595,8 @@ namespace CalamityMod.CalPlayer velocity.Y *= travelDist; velocity.X += (float)Main.rand.Next(-50, 51) * 0.02f; velocity.Y += (float)Main.rand.Next(-50, 51) * 0.02f; - Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, (float)Main.rand.Next(10)); + int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, Main.rand.Next(10)); + Main.projectile[laser].localNPCHitCooldown = 5; } Main.PlaySound(SoundID.Item12, player.position); } diff --git a/CalamityMod.cs b/CalamityMod.cs index a45ea7e09b..5ef3fbafb4 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -121,6 +121,7 @@ namespace CalamityMod public static Texture2D AstralSky; public static Effect CustomShader; public static Effect LightShader; + public static Effect TentacleShader; // DR data structure public static SortedDictionary DRValues; @@ -286,6 +287,7 @@ namespace CalamityMod AstralSky = ModContent.GetTexture("CalamityMod/ExtraTextures/AstralSky"); CustomShader = GetEffect("Effects/CustomShader"); LightShader = GetEffect("Effects/LightBurstShader"); + TentacleShader = GetEffect("Effects/TentacleShader"); Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); @@ -320,6 +322,8 @@ namespace CalamityMod Filters.Scene["CalamityMod:LightBurst"] = new Filter(new ScreenShaderData(new Ref(LightShader), "BurstPass"), EffectPriority.VeryHigh); Filters.Scene["CalamityMod:LightBurst"].Load(); + GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref(TentacleShader), "BurstPass"); + RipperUI.Reset(); AstralArcanumUI.Load(this); @@ -638,7 +642,9 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() }; projectileDestroyExceptionList = new List() @@ -1297,7 +1303,9 @@ namespace CalamityMod ItemID.WaspGun, ItemID.Keybrand, ItemID.PulseBow, - ItemID.PaladinsHammer + ItemID.PaladinsHammer, + ItemID.SolarEruption, + ItemID.DayBreak }; thirtyThreeDamageBuffList = new List() @@ -1376,7 +1384,8 @@ namespace CalamityMod ItemID.DD2BetsyBow, ItemID.InfluxWaver, ItemID.Xenopopper, - ItemID.ElectrosphereLauncher + ItemID.ElectrosphereLauncher, + ItemID.OpticStaff //Note: got local i frames so it should be better }; pumpkinMoonBuffList = new List() diff --git a/Effects/TentacleShader.xnb b/Effects/TentacleShader.xnb new file mode 100644 index 0000000000..02171ce264 Binary files /dev/null and b/Effects/TentacleShader.xnb differ diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 287a2f66f5..0b32c27cb6 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Anywhere) } + { ModContent.NPCType(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) } }; public static Dictionary PossibleEnemiesPolter = new Dictionary() @@ -71,7 +71,7 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Anywhere) }, + { ModContent.NPCType(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Anywhere) } }; @@ -132,9 +132,9 @@ namespace CalamityMod.Events } } if (CalamityWorld.downedPolterghast) - return (int)(180 * Math.Log(playerCount + Math.E - 1)); + return (int)(140 * Math.Log(playerCount + Math.E - 1)); else if (CalamityWorld.downedAquaticScourge) - return (int)(125 * Math.Log(playerCount + Math.E - 1)); + return (int)(115 * Math.Log(playerCount + Math.E - 1)); else return (int)(90 * Math.Log(playerCount + Math.E - 1)); } diff --git a/ExtraTextures/PhotovisceratorLight.png b/ExtraTextures/PhotovisceratorLight.png new file mode 100644 index 0000000000..8e2d2a871c Binary files /dev/null and b/ExtraTextures/PhotovisceratorLight.png differ diff --git a/Items/Accessories/AbyssalDivingSuit.png b/Items/Accessories/AbyssalDivingSuit.png index 2a59ff2b3e..9123d3b4b9 100644 Binary files a/Items/Accessories/AbyssalDivingSuit.png and b/Items/Accessories/AbyssalDivingSuit.png differ diff --git a/Items/Accessories/AbyssalDivingSuit_Arms.png b/Items/Accessories/AbyssalDivingSuit_Arms.png index 917426661f..5ec540fccc 100644 Binary files a/Items/Accessories/AbyssalDivingSuit_Arms.png and b/Items/Accessories/AbyssalDivingSuit_Arms.png differ diff --git a/Items/Accessories/AbyssalDivingSuit_Body.png b/Items/Accessories/AbyssalDivingSuit_Body.png index 55d3b2a786..3d70da65e3 100644 Binary files a/Items/Accessories/AbyssalDivingSuit_Body.png and b/Items/Accessories/AbyssalDivingSuit_Body.png differ diff --git a/Items/Accessories/AbyssalDivingSuit_Head.png b/Items/Accessories/AbyssalDivingSuit_Head.png index 0318c9c127..dd99d8fb29 100644 Binary files a/Items/Accessories/AbyssalDivingSuit_Head.png and b/Items/Accessories/AbyssalDivingSuit_Head.png differ diff --git a/Items/Accessories/AbyssalDivingSuit_Legs.png b/Items/Accessories/AbyssalDivingSuit_Legs.png index 6bc7fde9b5..4d21b6118f 100644 Binary files a/Items/Accessories/AbyssalDivingSuit_Legs.png and b/Items/Accessories/AbyssalDivingSuit_Legs.png differ diff --git a/Items/Accessories/AeroStone.cs b/Items/Accessories/AeroStone.cs index 1d76da3372..ff83883e63 100644 --- a/Items/Accessories/AeroStone.cs +++ b/Items/Accessories/AeroStone.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 20; - item.height = 20; + item.width = 40; + item.height = 50; item.value = Item.buyPrice(0, 15, 0, 0); item.rare = 5; item.accessory = true; diff --git a/Items/Accessories/AeroStone.png b/Items/Accessories/AeroStone.png index 90940f54ed..8ea1e54f88 100644 Binary files a/Items/Accessories/AeroStone.png and b/Items/Accessories/AeroStone.png differ diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index c00b5ede3c..3a71ce5fdb 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Asgard's Valor"); Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + - "Immune to most debuffs including Brimstone Flames, Holy Flames, and Glacial State\n" + + "Immune to most debuffs including Brimstone Flames, and Glacial State\n" + "10% damage reduction while submerged in liquid\n" + "+20 max life\n" + "Grants a holy dash which can be used to ram enemies\n" + @@ -51,7 +51,6 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.Cursed] = true; player.buffImmune[BuffID.Darkness] = true; player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; player.statLifeMax2 += 20; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs index 62234a3e5b..ef5c92d3de 100644 --- a/Items/Accessories/HowlsHeart.cs +++ b/Items/Accessories/HowlsHeart.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), (int)(HowlDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), (int)(HowlDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 1f); } if (player.ownedProjectileCounts[ProjectileType()] < 1) { diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index 1691c8e935..66f86a96e2 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Accessories "Increased minion knockback\n" + "Grants shadowflame powers to all minions\n" + "Minions make enemies cry on hit"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); } public override void SetDefaults() diff --git a/Items/Accessories/StatisCurse.png b/Items/Accessories/StatisCurse.png index 15879085f6..51e578ec26 100644 Binary files a/Items/Accessories/StatisCurse.png and b/Items/Accessories/StatisCurse.png differ diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 7338190ab6..a30da8596a 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -97,6 +97,10 @@ namespace CalamityMod.Items.Accessories { WaterBonuses = true; } + else if (!player.IsUnderwater()) + { + WaterBonuses = false; + } } } if (WaterBonuses || player.IsUnderwater()) diff --git a/Items/Armor/DesertProwlerHat.cs b/Items/Armor/DesertProwlerHat.cs index 69a9033f3f..4436351718 100644 --- a/Items/Armor/DesertProwlerHat.cs +++ b/Items/Armor/DesertProwlerHat.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Ranged attacks deal an extra 2 flat damage\n" + + player.setBonus = "Ranged attacks deal an extra 1 flat damage\n" + "Ranged crits can rarely whip up a sandstorm"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.desertProwler = true; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 02269482a1..97b52f456c 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -32,6 +32,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.Utilities; namespace CalamityMod.Items { @@ -55,17 +56,33 @@ namespace CalamityMod.Items } #endregion - public bool rogue = false; + public bool rogue = false; + public float StealthGenBonus; - public int timesUsed = 0; + public int timesUsed = 0; - // Rarity is provided both as the classic int and the new enum. - public CalamityRarity customRarity = CalamityRarity.NoEffect; - public int postMoonLordRarity - { - get => (int)customRarity; - set => customRarity = (CalamityRarity)value; - } + // Rarity is provided both as the classic int and the new enum. + public CalamityRarity customRarity = CalamityRarity.NoEffect; + public int postMoonLordRarity + { + get => (int)customRarity; + set => customRarity = (CalamityRarity)value; + } + + ///See RogueWeapon.cs for rogue modifier shit + #region Modifiers + public CalamityGlobalItem() + { + StealthGenBonus = 1f; + } + + public override GlobalItem Clone(Item item, Item itemClone) + { + CalamityGlobalItem myClone = (CalamityGlobalItem)base.Clone(item, itemClone); + myClone.StealthGenBonus = StealthGenBonus; + return myClone; + } + #endregion #region SetDefaults public override void SetDefaults(Item item) @@ -949,12 +966,14 @@ namespace CalamityMod.Items { if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) { + int duration = CalamityPlayer.chaosStateDuration; + if (CalamityPlayer.areThereAnyDamnBosses || CalamityPlayer.areThereAnyDamnEvents) + duration = CalamityPlayer.chaosStateDurationBoss; if (modPlayer.eScarfCooldown) - player.AddBuff(BuffID.ChaosState, (int)(CalamityPlayer.chaosStateDuration * 1.5), true); + duration = (int)(CalamityPlayer.chaosStateDuration * 1.5); else if (modPlayer.scarfCooldown) - player.AddBuff(BuffID.ChaosState, CalamityPlayer.chaosStateDuration * 2, true); - else - player.AddBuff(BuffID.ChaosState, CalamityPlayer.chaosStateDuration, true); + duration = CalamityPlayer.chaosStateDuration * 2; + player.AddBuff(BuffID.ChaosState, duration, true); } } } @@ -965,6 +984,7 @@ namespace CalamityMod.Items #region Modify Tooltips public override void ModifyTooltips(Item item, List tooltips) { + #region Custom Rarities# TooltipLine tt2 = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); if (tt2 != null) { @@ -1086,6 +1106,25 @@ namespace CalamityMod.Items break; } } + #endregion + + #region Accessory Modifier Display + if (item.accessory) + { + if (!item.social && item.prefix > 0) + { + float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; + if (stealthGenBoost > 0) + { + TooltipLine StealthGen = new TooltipLine(mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") + { + isModifier = true + }; + tooltips.Add(StealthGen); + } + } + } + #endregion /*if (item.ammo == 97) { @@ -2779,7 +2818,7 @@ Provides heat and cold protection in Death Mode"; // Plantera case ItemID.PlanteraBossBag: - DropHelper.DropItem(player, ModContent.ItemType(), 8, 11); + DropHelper.DropItem(player, ModContent.ItemType(), 16, 22); float bFluxChance = DropHelper.LegendaryDropRateFloat; DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, bFluxChance); DropHelper.DropItemChance(player, ItemID.JungleKey, 5); @@ -2955,6 +2994,15 @@ Provides heat and cold protection in Death Mode"; { CalamityPlayer modPlayer = player.Calamity(); + if (item.prefix > 0) + { + float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; + if (stealthGenBoost > 0) + { + modPlayer.accStealthGenBoost += stealthGenBoost; + } + } + if (item.type == ItemID.FireGauntlet) { player.meleeDamage += 0.04f; diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index 4688312ba9..53c08f1100 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -41,10 +41,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.useStyle = 1; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void RightClick(Player player) { @@ -65,7 +62,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches } // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.2f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Fishing/AstralCatches/PolarisParrotfish.cs b/Items/Fishing/AstralCatches/PolarisParrotfish.cs index 01c7dea67c..e44f282be1 100644 --- a/Items/Fishing/AstralCatches/PolarisParrotfish.cs +++ b/Items/Fishing/AstralCatches/PolarisParrotfish.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.damage = 60; + item.damage = 55; item.ranged = true; item.width = 38; item.height = 34; diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 44cf91737b..d98e589ed8 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -31,10 +31,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches item.useStyle = 1; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void RightClick(Player player) { diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index ee7d0da02a..1dc1c6e2cf 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -4,6 +4,11 @@ using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables; using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Potions; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Tiles.Abyss; using CalamityMod.World; using Terraria; @@ -36,10 +41,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches item.useStyle = 1; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void RightClick(Player player) { @@ -76,8 +78,25 @@ namespace CalamityMod.Items.Fishing.SulphurCatches DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 10); } + // Weapons + DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType()); + + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAquaticScourgeAcidRain, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType()); + // Equipment - DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.25f, + DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs index 027f00b0db..62f806f072 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs @@ -40,10 +40,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.useStyle = 1; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void RightClick(Player player) { @@ -61,7 +58,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches } // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAM && Main.hardMode, 0.2f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAM && Main.hardMode, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Materials/PlagueCellCluster.png b/Items/Materials/PlagueCellCluster.png index f0314d31d7..2f63b08e28 100644 Binary files a/Items/Materials/PlagueCellCluster.png and b/Items/Materials/PlagueCellCluster.png differ diff --git a/Items/Mounts/BUMBLEDOGE.cs b/Items/Mounts/BUMBLEDOGE.cs index 9cdc2a3399..e720b01f24 100644 --- a/Items/Mounts/BUMBLEDOGE.cs +++ b/Items/Mounts/BUMBLEDOGE.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Mounts mountData.fatigueMax = 0; mountData.fallDamage = 0f; mountData.runSpeed = 12f; - mountData.dashSpeed = 12f; mountData.heightBoost = 44; mountData.acceleration = 0.2f; mountData.jumpHeight = 10; @@ -56,7 +55,7 @@ namespace CalamityMod.Items.Mounts mountData.swimFrameDelay = mountData.inAirFrameDelay; mountData.swimFrameStart = mountData.inAirFrameStart; - mountData.dashSpeed = 25f; + mountData.dashSpeed = 18.5f; mountData.dashingFrameCount = mountData.flyingFrameCount; mountData.dashingFrameDelay = 5; mountData.dashingFrameStart = mountData.flyingFrameStart; diff --git a/Items/Potions/ShadowPotion.cs b/Items/Potions/ShadowPotion.cs index 7171a5d8f5..aec0a954a0 100644 --- a/Items/Potions/ShadowPotion.cs +++ b/Items/Potions/ShadowPotion.cs @@ -40,8 +40,7 @@ namespace CalamityMod.Items.Potions ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.InvisibilityPotion); - recipe.AddIngredient(ItemID.AlchemyTable); - recipe.AddTile(TileID.Bottles); + recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this, 2); recipe.AddRecipe(); recipe = new ModRecipe(mod); diff --git a/Items/SummonItems/Abomination.png b/Items/SummonItems/Abomination.png index 053279c444..65c9eb05bd 100644 Binary files a/Items/SummonItems/Abomination.png and b/Items/SummonItems/Abomination.png differ diff --git a/Items/SummonItems/AncientMedallion.cs b/Items/SummonItems/AncientMedallion.cs index 86f98798bb..ed7d87adbe 100644 --- a/Items/SummonItems/AncientMedallion.cs +++ b/Items/SummonItems/AncientMedallion.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Items.SummonItems { public override void SetStaticDefaults() { - DisplayName.SetDefault("Ancient Medallion"); - Tooltip.SetDefault("A very old temple medallion\n" + + DisplayName.SetDefault("Death Whistle"); + Tooltip.SetDefault("A very old temple whistle\n" + "Summons the Ravager"); } @@ -35,7 +35,7 @@ namespace CalamityMod.Items.SummonItems if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.NewNPC((int)(player.position.X + (float)Main.rand.Next(-100, 101)), (int)(player.position.Y - 250f), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(SoundID.Roar, player.position, 0); + Main.PlaySound(SoundID.Roar, player.position, 2); } return true; } diff --git a/Items/SummonItems/AncientMedallion.png b/Items/SummonItems/AncientMedallion.png index 7606218f53..b233f2548e 100644 Binary files a/Items/SummonItems/AncientMedallion.png and b/Items/SummonItems/AncientMedallion.png differ diff --git a/Items/SummonItems/AstralChunk.png b/Items/SummonItems/AstralChunk.png index c4059f8bea..90ee8ec7ce 100644 Binary files a/Items/SummonItems/AstralChunk.png and b/Items/SummonItems/AstralChunk.png differ diff --git a/Items/SummonItems/BlightedEyeball.png b/Items/SummonItems/BlightedEyeball.png index 4c9f5f4bd7..2c653dc977 100644 Binary files a/Items/SummonItems/BlightedEyeball.png and b/Items/SummonItems/BlightedEyeball.png differ diff --git a/Items/SummonItems/CryoKey.png b/Items/SummonItems/CryoKey.png index eb924ac4ad..f026899ecf 100644 Binary files a/Items/SummonItems/CryoKey.png and b/Items/SummonItems/CryoKey.png differ diff --git a/Items/SummonItems/DecapoditaSprout.png b/Items/SummonItems/DecapoditaSprout.png index 0915fab5fd..e33bcd801b 100644 Binary files a/Items/SummonItems/DecapoditaSprout.png and b/Items/SummonItems/DecapoditaSprout.png differ diff --git a/Items/SummonItems/OverloadedSludge.png b/Items/SummonItems/OverloadedSludge.png index 387cdac50d..00fc0b0c47 100644 Binary files a/Items/SummonItems/OverloadedSludge.png and b/Items/SummonItems/OverloadedSludge.png differ diff --git a/Items/SummonItems/Teratoma.png b/Items/SummonItems/Teratoma.png index 52ed7f6a7b..d56eddbb90 100644 Binary files a/Items/SummonItems/Teratoma.png and b/Items/SummonItems/Teratoma.png differ diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index 98e60b3058..454f99c50d 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.width = 60; + item.width = 62; + item.height = 62; item.damage = 500; item.melee = true; item.useAnimation = 16; @@ -27,7 +28,6 @@ namespace CalamityMod.Items.Tools item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 60; item.tileBoost += 5; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; diff --git a/Items/Tools/Grax.png b/Items/Tools/Grax.png index 1340de82e1..80f4e4ca6f 100644 Binary files a/Items/Tools/Grax.png and b/Items/Tools/Grax.png differ diff --git a/Items/TreasureBags/LeviathanBag.cs b/Items/TreasureBags/LeviathanBag.cs index d482ca77f6..1dc1bf6a76 100644 --- a/Items/TreasureBags/LeviathanBag.cs +++ b/Items/TreasureBags/LeviathanBag.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Leviathan; using CalamityMod.World; using Terraria; @@ -52,6 +53,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Equipment DropHelper.DropItem(player, ModContent.ItemType()); diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index 06f05113fb..3f71dc6333 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.TreasureBags // Materials DropHelper.DropItem(player, ModContent.ItemType(), 25, 35); - DropHelper.DropItem(player, ModContent.ItemType(), 15, 25); + DropHelper.DropItem(player, ModContent.ItemType(), 20, 30); // Weapons DropHelper.DropItemChance(player, ModContent.ItemType(), 3); diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index fe5f528c33..98216b996f 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 60; + item.damage = 99; item.magic = true; - item.mana = 12; + item.mana = 8; item.width = 52; item.height = 52; item.useTime = 17; diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index 12c8980faf..734002411f 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { item.width = 98; - item.damage = 45; + item.damage = 55; item.magic = true; - item.mana = 14; + item.mana = 12; item.useAnimation = 7; item.useTime = 7; item.useStyle = 5; diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 147a521634..632d5a9574 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 36; + item.damage = 40; item.magic = true; item.mana = 17; item.width = 56; diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index 3d65397d61..d42e2eeb90 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 6; item.width = 28; item.height = 30; - item.useTime = 18; - item.useAnimation = 18; + item.useTime = 20; + item.useAnimation = 20; item.useStyle = 5; item.noMelee = true; item.knockBack = 3.5f; diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index c4b2c93fcf..317a2ae5cd 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 20; + item.damage = 15; item.magic = true; item.mana = 7; item.width = 34; @@ -31,64 +31,60 @@ namespace CalamityMod.Items.Weapons.Magic item.rare = 2; item.UseSound = SoundID.Item8; item.autoReuse = true; - item.shoot = 590; + item.shoot = ProjectileID.TruffleSpore; item.shootSpeed = 1f; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld + vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + float speed = item.shootSpeed; + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + float xDist = (float)Main.mouseX + Main.screenPosition.X + source.X; + float yDist = (float)Main.mouseY + Main.screenPosition.Y + source.Y; + Vector2 spawnVec = new Vector2(xDist, yDist); if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + spawnVec.Y = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + source.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + float distance = spawnVec.Length(); + if ((float.IsNaN(spawnVec.X) && float.IsNaN(spawnVec.Y)) || (spawnVec.X == 0f && spawnVec.Y == 0f)) { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; + spawnVec.X = (float)player.direction; + spawnVec.Y = 0f; + distance = speed; } else { - num80 = num72 / num80; + distance = speed / distance; } - int num107 = 3; - for (int num108 = 0; num108 < num107; num108++) + int projAmt = 3; + for (int projIndex = 0; projIndex < projAmt; projIndex++) { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-100, 101); - vector2.Y -= (float)(50 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) + source = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + source.X = (source.X + player.Center.X) / 2f + (float)Main.rand.Next(-100, 101); + source.Y -= (float)(50 * projIndex); + spawnVec.X = (float)Main.mouseX + Main.screenPosition.X - source.X; + spawnVec.Y = (float)Main.mouseY + Main.screenPosition.Y - source.Y; + if (spawnVec.Y < 0f) { - num79 *= -1f; + spawnVec.Y *= -1f; } - if (num79 < 20f) + if (spawnVec.Y < 20f) { - num79 = 20f; + spawnVec.Y = 20f; } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-180, 181) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); + distance = spawnVec.Length(); + distance = speed / distance; + spawnVec.X *= distance; + spawnVec.Y *= distance; + spawnVec.X += (float)Main.rand.Next(-180, 181) * 0.02f; + spawnVec.Y += (float)Main.rand.Next(-180, 181) * 0.02f; + int proj = Projectile.NewProjectile(source, spawnVec, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3)); Main.projectile[proj].Calamity().forceMagic = true; + Main.projectile[proj].timeLeft = CalamityUtils.SecondsToFrames(8f); } return false; } diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index 48c8c0223f..3f086707c4 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Magic; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -12,15 +11,19 @@ namespace CalamityMod.Items.Weapons.Magic { public class SubsumingVortex : ModItem { + public const int MaxVortexCount = 4; public override void SetStaticDefaults() { DisplayName.SetDefault("Subsuming Vortex"); - Tooltip.SetDefault("Fires 3 vortexes of elemental energy"); + Tooltip.SetDefault("Fires a giant slow-moving vortex\n" + + "When an enemy is nearby, the vortex releases tentacles that redirect towards the enemy.\n" + + "After some time, the vortex slows down, charges, and eventually explodes.\n" + + $"Only {MaxVortexCount} vortexes can exist at once."); } public override void SetDefaults() { - item.damage = 520; + item.damage = 480; item.magic = true; item.mana = 20; item.width = 38; @@ -28,14 +31,14 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item84; item.useTime = 20; item.useAnimation = 20; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7f; item.Calamity().customRarity = CalamityRarity.Violet; } @@ -45,16 +48,11 @@ namespace CalamityMod.Items.Weapons.Magic spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < MaxVortexCount; + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int num6 = 3; - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; - float ai = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, ai); - } + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/WulfrumStaff.cs b/Items/Weapons/Magic/WulfrumStaff.cs index c81ccd8c55..27bf657e3f 100644 --- a/Items/Weapons/Magic/WulfrumStaff.cs +++ b/Items/Weapons/Magic/WulfrumStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 10; + item.damage = 12; item.magic = true; item.mana = 4; item.width = 44; diff --git a/Items/Weapons/Melee/AccretionDiskMelee.cs b/Items/Weapons/Melee/AccretionDiskMelee.cs index 1eadd4f954..2b4c772c7c 100644 --- a/Items/Weapons/Melee/AccretionDiskMelee.cs +++ b/Items/Weapons/Melee/AccretionDiskMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,13 +35,6 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index 18d4f2caf2..189a175570 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 58; + item.width = 56; + item.height = 56; item.damage = 25; item.melee = true; item.useAnimation = 25; @@ -25,7 +26,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 4f; item.UseSound = SoundID.Item1; item.autoReuse = false; - item.height = 58; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/BladecrestOathsword.png b/Items/Weapons/Melee/BladecrestOathsword.png index fb687ddfc0..3f02a452d5 100644 Binary files a/Items/Weapons/Melee/BladecrestOathsword.png and b/Items/Weapons/Melee/BladecrestOathsword.png differ diff --git a/Items/Weapons/Melee/BladeofEnmity.cs b/Items/Weapons/Melee/BladeofEnmity.cs index 81cd369c1c..c2babd48c0 100644 --- a/Items/Weapons/Melee/BladeofEnmity.cs +++ b/Items/Weapons/Melee/BladeofEnmity.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 72; - item.height = 76; + item.width = 60; + item.height = 64; item.damage = 158; item.melee = true; item.useAnimation = 10; diff --git a/Items/Weapons/Melee/BladeofEnmity.png b/Items/Weapons/Melee/BladeofEnmity.png index 9a2d2ca0b0..85eaf83a33 100644 Binary files a/Items/Weapons/Melee/BladeofEnmity.png and b/Items/Weapons/Melee/BladeofEnmity.png differ diff --git a/Items/Weapons/Melee/BloodyEdge.cs b/Items/Weapons/Melee/BloodyEdge.cs index 8ad4ccc251..9337375fff 100644 --- a/Items/Weapons/Melee/BloodyEdge.cs +++ b/Items/Weapons/Melee/BloodyEdge.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { int healAmount = Main.rand.Next(3) + 1; - if (Main.rand.NextBool(2)) + if (Main.rand.NextBool(2) && !player.moonLeech) { player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/BurntSienna.cs b/Items/Weapons/Melee/BurntSienna.cs index f861213e2d..fcf21be439 100644 --- a/Items/Weapons/Melee/BurntSienna.cs +++ b/Items/Weapons/Melee/BurntSienna.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.life <= 0) + if (target.life <= 0 && !player.moonLeech) { float randomSpeedX = (float)Main.rand.Next(3); float randomSpeedY = (float)Main.rand.Next(3, 5); @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (target.statLife <= 0) + if (target.statLife <= 0 && !player.moonLeech) { float randomSpeedX = (float)Main.rand.Next(3); float randomSpeedY = (float)Main.rand.Next(3, 5); diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index 6ac343fad0..408059b77f 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 44; item.height = 44; - item.damage = 800; + item.damage = 666; item.melee = true; item.knockBack = 9f; diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 42740edf13..fb554e397f 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -15,13 +15,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Devil's Devastation"); - Tooltip.SetDefault("Fires a spread of demonic blades and blasts\n" + + Tooltip.SetDefault("Fires a spread of demonic scythes\n" + "Pitchforks rise from the underworld to skewer your foes\n" + "Critical hits cause shadowflame explosions"); } public override void SetDefaults() { - item.width = 74; + item.width = 118; + item.height = 118; item.damage = 520; item.melee = true; item.useAnimation = 20; @@ -31,7 +32,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 6.75f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 74; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; item.shoot = ModContent.ProjectileType(); @@ -41,58 +41,63 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { + //Shoot 3 oathblades in a spread int index = 8; for (int j = -index; j <= index; j += index) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(j)); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI, 0f, 0f); } - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + //Not actually sure what this middle code does + float speed = item.shootSpeed; + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + float directionX = (float)Main.mouseX + Main.screenPosition.X - source.X; + float directionY = (float)Main.mouseY + Main.screenPosition.Y - source.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + directionY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - source.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + Vector2 direction = new Vector2(directionX, directionY); + float aimDist = direction.Length(); + if ((float.IsNaN(direction.X) && float.IsNaN(direction.Y)) || (direction.X == 0f && direction.Y == 0f)) { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; + direction.X = (float)player.direction; + direction.Y = 0f; + aimDist = speed; } else { - num80 = num72 / num80; + aimDist = speed / aimDist; } - int num107 = 3; - for (int num108 = 0; num108 < num107; num108++) + //Shoot 9 tridents from below + int projAmt = 3; //Since the method spawns 3 projectiles, it spawns 9 total + for (int projIndex = 0; projIndex < projAmt; projIndex++) { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) + source = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y + 600f); + source.X = (source.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + source.Y += (float)(100 * projIndex); + direction.X = (float)Main.mouseX + Main.screenPosition.X - source.X; + direction.Y = (float)Main.mouseY + Main.screenPosition.Y - source.Y; + if (direction.Y < 0f) { - num79 *= -1f; + direction.Y *= -1f; } - if (num79 < 20f) + if (direction.Y < 20f) { - num79 = 20f; + direction.Y = 20f; } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); + aimDist = direction.Length(); + aimDist = speed / aimDist; + direction.X *= aimDist; + direction.Y *= aimDist; + direction.X += Main.rand.NextFloat(-40f, 40f) * 0.02f; + direction.Y += Main.rand.NextFloat(-40f, 40f) * 0.02f; + direction.Y *= -1; + Projectile.NewProjectile(source, direction, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, Main.rand.Next(5)); + Projectile.NewProjectile(source, direction, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3)); + Projectile.NewProjectile(source, direction, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); } return false; } @@ -126,42 +131,39 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.ShadowFlame, 900); target.AddBuff(BuffID.OnFire, 900); player.ApplyDamageToNPC(target, (int)(item.damage * player.MeleeDamage()) * 4, 0f, 0, false); - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + float scalar1 = 1.7f; + float scalar2 = 0.8f; + float scalar3 = 2f; + Vector2 value3 = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) + for (int i = 0; i < 40; i++) { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50); - Dust dust = Main.dust[num54]; - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + int dustInt = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 200, default, scalar1); + Dust dust = Main.dust[dustInt]; + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * target.width / 2f; dust.noGravity = true; dust.velocity.Y -= 4.5f; dust.velocity *= 3f; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51); - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dustInt = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 100, default, scalar2); + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * target.width / 2f; dust.velocity.Y -= 3f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; dust.color = Color.Crimson * 0.5f; dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) + for (int j = 0; j < 20; j++) { - int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52); - Dust dust = Main.dust[num56]; - dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; + int dustInt = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 0, default, scalar3); + Dust dust = Main.dust[dustInt]; + dust.position = target.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)target.velocity.ToRotation(), default) * target.width / 3f; dust.noGravity = true; dust.velocity.Y -= 1.5f; dust.velocity *= 0.5f; dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; } } } diff --git a/Items/Weapons/Melee/DevilsDevastation.png b/Items/Weapons/Melee/DevilsDevastation.png index 59afcbb8e6..2ed24ed381 100644 Binary files a/Items/Weapons/Melee/DevilsDevastation.png and b/Items/Weapons/Melee/DevilsDevastation.png differ diff --git a/Items/Weapons/Melee/DraedonsExoblade.cs b/Items/Weapons/Melee/DraedonsExoblade.cs index b09f0ceb06..444032cbb8 100644 --- a/Items/Weapons/Melee/DraedonsExoblade.cs +++ b/Items/Weapons/Melee/DraedonsExoblade.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, ai1); } } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -134,6 +134,8 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, player.whoAmI, 0f, ai1); } } + if (player.moonLeech) + return; int healAmount = Main.rand.Next(5) + 5; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 38858f734f..cac0c123a2 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -86,14 +86,14 @@ namespace CalamityMod.Items.Weapons.Melee float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } if (Main.rand.NextBool(2)) { target.defense -= 50; } + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) + { + return; + } int heal = Main.rand.Next(1, 69); player.statLife += heal; player.HealEffect(heal); @@ -145,6 +145,8 @@ namespace CalamityMod.Items.Weapons.Melee float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); } + if (player.moonLeech) + return; int heal = Main.rand.Next(1, 69); player.statLife += heal; player.HealEffect(heal); diff --git a/Items/Weapons/Melee/ElementalExcalibur.cs b/Items/Weapons/Melee/ElementalExcalibur.cs index 3ef670429d..ae217ee9be 100644 --- a/Items/Weapons/Melee/ElementalExcalibur.cs +++ b/Items/Weapons/Melee/ElementalExcalibur.cs @@ -63,10 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee return false; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { @@ -157,7 +154,7 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(BuffID.OnFire, 240); target.AddBuff(BuffID.Ichor, 240); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -177,6 +174,8 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(BuffID.OnFire, 240); target.AddBuff(BuffID.Ichor, 240); + if (player.moonLeech) + return; int healAmount = Main.rand.Next(10) + 10; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/EradicatorMelee.cs b/Items/Weapons/Melee/EradicatorMelee.cs index 31f6afb425..7f827c609a 100644 --- a/Items/Weapons/Melee/EradicatorMelee.cs +++ b/Items/Weapons/Melee/EradicatorMelee.cs @@ -36,13 +36,6 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Vector2 origin = new Vector2(31f, 29f); diff --git a/Items/Weapons/Melee/FlameScytheMelee.cs b/Items/Weapons/Melee/FlameScytheMelee.cs index 5ded2dbf1f..feca9aa52a 100644 --- a/Items/Weapons/Melee/FlameScytheMelee.cs +++ b/Items/Weapons/Melee/FlameScytheMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,13 +34,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 16f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 5bdae7c940..f3210826b3 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 76; + item.width = 74; + item.height = 74; item.damage = 64; item.melee = true; item.useAnimation = 25; @@ -27,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 6.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 76; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/ForbiddenOathblade.png b/Items/Weapons/Melee/ForbiddenOathblade.png index a0705d7c37..ae681cfcb3 100644 Binary files a/Items/Weapons/Melee/ForbiddenOathblade.png and b/Items/Weapons/Melee/ForbiddenOathblade.png differ diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 7aef9f9409..d60c5e37b6 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.defense -= 15; } - if (target.defense <= 0 && target.canGhostHeal) + if (target.defense <= 0 && target.canGhostHeal && !player.moonLeech) { player.statLife += 4; player.HealEffect(4); @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), knockback, player.whoAmI); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), (int)((float)item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), knockback, player.whoAmI); } - if (target.life <= 0) + if (target.life <= 0 && !player.moonLeech) { float randomSpeedX = (float)Main.rand.Next(9); float randomSpeedY = (float)Main.rand.Next(6, 15); @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), item.knockBack, player.whoAmI); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), (int)((float)item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), item.knockBack, player.whoAmI); } - if (target.statLife <= 0) + if (target.statLife <= 0 && !player.moonLeech) { float randomSpeedX = (float)Main.rand.Next(9); float randomSpeedY = (float)Main.rand.Next(6, 15); diff --git a/Items/Weapons/Melee/GreatswordofBlah.cs b/Items/Weapons/Melee/GreatswordofBlah.cs index 3723ad07b5..7723ba738b 100644 --- a/Items/Weapons/Melee/GreatswordofBlah.cs +++ b/Items/Weapons/Melee/GreatswordofBlah.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 110; + item.width = item.height = 102; item.damage = 300; item.melee = true; item.useAnimation = 18; @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 7f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 110; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/GreatswordofBlah.png b/Items/Weapons/Melee/GreatswordofBlah.png index 9dbb9c816e..03444ed9d3 100644 Binary files a/Items/Weapons/Melee/GreatswordofBlah.png and b/Items/Weapons/Melee/GreatswordofBlah.png differ diff --git a/Items/Weapons/Melee/LifefruitScythe.cs b/Items/Weapons/Melee/LifefruitScythe.cs index 4bd35bc74d..d450027649 100644 --- a/Items/Weapons/Melee/LifefruitScythe.cs +++ b/Items/Weapons/Melee/LifefruitScythe.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -64,6 +64,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { + if (player.moonLeech) + return; player.statLife += 5; player.HealEffect(5); } diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index 3e25680803..b47f22b9f3 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee target.defense -= 10; // Healing effect does not trigger versus dummies - if (target.type == NPCID.TargetDummy) + if (target.type == NPCID.TargetDummy || player.moonLeech) return; if (target.defense <= 0 && target.canGhostHeal) diff --git a/Items/Weapons/Melee/MangroveChakramMelee.cs b/Items/Weapons/Melee/MangroveChakramMelee.cs index b2c51b0be1..765e0701bc 100644 --- a/Items/Weapons/Melee/MangroveChakramMelee.cs +++ b/Items/Weapons/Melee/MangroveChakramMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,13 +33,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 16f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index 978f6640e9..dda4ce7f5d 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class Nadir : ModItem { - public static int BaseDamage = 800; + public static int BaseDamage = 700; public static float ShootSpeed = 12f; public override void SetStaticDefaults() diff --git a/Items/Weapons/Melee/OldLordOathsword.cs b/Items/Weapons/Melee/OldLordOathsword.cs index df9a014864..6421e0e31b 100644 --- a/Items/Weapons/Melee/OldLordOathsword.cs +++ b/Items/Weapons/Melee/OldLordOathsword.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.damage = 34; - item.width = 78; - item.height = 78; + item.width = 70; + item.height = 70; item.melee = true; item.useAnimation = 24; item.useStyle = 1; diff --git a/Items/Weapons/Melee/OldLordOathsword.png b/Items/Weapons/Melee/OldLordOathsword.png index c9ce86acec..9326b47f1e 100644 Binary files a/Items/Weapons/Melee/OldLordOathsword.png and b/Items/Weapons/Melee/OldLordOathsword.png differ diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 63586c1f30..fb0ec5f0da 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -53,11 +53,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 400; + item.damage = 1200; item.crit += 8; - item.useAnimation = 15; item.useStyle = 1; - item.useTime = 15; + item.useTime = item.useAnimation = 15; item.useTurn = true; item.melee = true; item.knockBack = 7f; @@ -91,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage * 2, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1), knockBack, player.whoAmI, 0f, 0f); } else { diff --git a/Items/Weapons/Melee/PwnagehammerMelee.cs b/Items/Weapons/Melee/PwnagehammerMelee.cs index 60f28b067f..9315eac593 100644 --- a/Items/Weapons/Melee/PwnagehammerMelee.cs +++ b/Items/Weapons/Melee/PwnagehammerMelee.cs @@ -1,5 +1,4 @@ using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,13 +33,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 12f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index c5112d6e8a..c7ac6cd59e 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 18; - item.damage = 1550; + item.damage = 1300; item.melee = true; item.noMelee = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/SeashellBoomerangMelee.cs b/Items/Weapons/Melee/SeashellBoomerangMelee.cs index 79febc672a..841ad4267e 100644 --- a/Items/Weapons/Melee/SeashellBoomerangMelee.cs +++ b/Items/Weapons/Melee/SeashellBoomerangMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,13 +32,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 11.5f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/SolsticeClaymore.png b/Items/Weapons/Melee/SolsticeClaymore.png index becb3b8406..3063428cd6 100644 Binary files a/Items/Weapons/Melee/SolsticeClaymore.png and b/Items/Weapons/Melee/SolsticeClaymore.png differ diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs index 4aa3fc0331..d4b147c54b 100644 --- a/Items/Weapons/Melee/TenebreusTides.cs +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 75; + item.damage = 80; item.knockBack = 4.5f; item.melee = true; - item.useAnimation = item.useTime = 15; + item.useAnimation = item.useTime = 14; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/TerraEdge.cs b/Items/Weapons/Melee/TerraEdge.cs index b37082e869..30cf8b013d 100644 --- a/Items/Weapons/Melee/TerraEdge.cs +++ b/Items/Weapons/Melee/TerraEdge.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -80,6 +80,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { + if (player.moonLeech) + return; int healAmount = Main.rand.Next(2) + 2; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 9fab60c74f..b910782777 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Frostburn, 600); target.AddBuff(BuffID.OnFire, 600); target.AddBuff(BuffID.Ichor, 300); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -110,6 +110,8 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Frostburn, 600); target.AddBuff(BuffID.OnFire, 600); target.AddBuff(BuffID.Ichor, 300); + if (player.moonLeech) + return; int healAmount = Main.rand.Next(3) + 2; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs index ba5e4479cd..849065bc52 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,13 +36,6 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.Developer; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/TrueBloodyEdge.cs b/Items/Weapons/Melee/TrueBloodyEdge.cs index 8f745cb00a..d11303391d 100644 --- a/Items/Weapons/Melee/TrueBloodyEdge.cs +++ b/Items/Weapons/Melee/TrueBloodyEdge.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) + if (target.type == NPCID.TargetDummy || player.moonLeech) { return; } @@ -67,6 +67,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { + if (player.moonLeech) + return; int healAmount = Main.rand.Next(6) + 1; if (Main.rand.NextBool(2)) { diff --git a/Items/Weapons/Melee/TrueForbiddenOathblade.cs b/Items/Weapons/Melee/TrueForbiddenOathblade.cs index d303f9216a..a225427bae 100644 --- a/Items/Weapons/Melee/TrueForbiddenOathblade.cs +++ b/Items/Weapons/Melee/TrueForbiddenOathblade.cs @@ -18,7 +18,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 78; + item.width = 88; + item.height = 88; item.damage = 200; item.melee = true; item.useAnimation = 23; @@ -28,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 7.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 78; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/TrueForbiddenOathblade.png b/Items/Weapons/Melee/TrueForbiddenOathblade.png index 309864b6ae..44fe38ad94 100644 Binary files a/Items/Weapons/Melee/TrueForbiddenOathblade.png and b/Items/Weapons/Melee/TrueForbiddenOathblade.png differ diff --git a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs index 63838e1415..56e70e350b 100644 --- a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs +++ b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 14; - item.damage = 81; + item.damage = 87; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -35,13 +34,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 14f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index b7b1700ff7..759dfef726 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 300; + item.damage = 130; item.melee = true; item.rare = 8; item.width = 72; diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index 3364382d01..6d6583af85 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 101; + item.damage = 49; item.ranged = true; - item.useTime = 15; - item.useAnimation = 15; + item.useTime = 18; + item.useAnimation = 18; item.knockBack = 2f; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index 041ddc9c07..c014be74a2 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 32; + item.damage = 27; item.ranged = true; item.width = 64; item.height = 30; diff --git a/Items/Weapons/Ranged/Dualpoon.cs b/Items/Weapons/Ranged/Dualpoon.cs index 07119520a0..32016ec261 100644 --- a/Items/Weapons/Ranged/Dualpoon.cs +++ b/Items/Weapons/Ranged/Dualpoon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.UseSound = SoundID.Item10; item.autoReuse = true; item.shootSpeed = 20f; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() @@ -38,28 +38,27 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-5, 0); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 2; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - int harpoon = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[harpoon].timeLeft = 300; - } - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + float piOverTen = MathHelper.Pi * 0.1f; + int projCount = 2; + Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); + velocity *= 40f; + bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); + for (int projIndex = 0; projIndex < projCount; projIndex++) + { + float num120 = projIndex - (projCount - 1f) / 2f; + Vector2 offset = velocity.RotatedBy((double)(piOverTen * num120), default); + if (!canHit) + { + offset -= velocity; + } + Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index 8986adf70c..3c6685cf26 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 54; item.ranged = true; - item.width = 16; - item.height = 16; + item.width = 152; + item.height = 58; item.useTime = 10; item.useAnimation = 10; item.reuseDelay = 5; diff --git a/Items/Weapons/Ranged/FlakKraken.png b/Items/Weapons/Ranged/FlakKraken.png index 88f490cdcd..1353a556b8 100644 Binary files a/Items/Weapons/Ranged/FlakKraken.png and b/Items/Weapons/Ranged/FlakKraken.png differ diff --git a/Items/Weapons/Ranged/GreatbowofTurmoil.cs b/Items/Weapons/Ranged/GreatbowofTurmoil.cs index 6ed6729314..ad58129904 100644 --- a/Items/Weapons/Ranged/GreatbowofTurmoil.cs +++ b/Items/Weapons/Ranged/GreatbowofTurmoil.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 27; + item.damage = 31; item.ranged = true; item.width = 18; item.height = 36; @@ -38,26 +38,26 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + float piOverTen = MathHelper.Pi * 0.1f; + int arrowAmt = 3; + Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); + velocity *= 40f; + bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); + for (int projIndex = 0; projIndex < arrowAmt; projIndex++) { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) + float num120 = (float)projIndex - ((float)arrowAmt - 1f) / 2f; + Vector2 offset = velocity.RotatedBy((double)(piOverTen * num120), default); + if (!canHit) { - value9 -= vector7; + offset -= velocity; } if (type == ProjectileID.WoodenArrowFriendly) { type = ProjectileID.FireArrow; } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[num121].noDropItem = true; } for (int i = 0; i < 2; i++) @@ -78,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Ranged default: break; } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.5f), knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockBack, player.whoAmI, 0f, 0f); Main.projectile[index].noDropItem = true; Main.projectile[index].usesLocalNPCImmunity = true; Main.projectile[index].localNPCHitCooldown = 10; diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs index 15b6356c1a..673a3e4fe1 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 32; + item.damage = 27; item.ranged = true; item.crit += 20; item.width = 36; diff --git a/Items/Weapons/Ranged/Needler.cs b/Items/Weapons/Ranged/Needler.cs index 385aea044d..1ab60c3910 100644 --- a/Items/Weapons/Ranged/Needler.cs +++ b/Items/Weapons/Ranged/Needler.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 38; + item.damage = 45; item.ranged = true; item.width = 44; item.height = 26; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shootSpeed = 9f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 53a30951e9..1d286f5b93 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 210; + item.damage = 200; item.ranged = true; item.width = 84; item.height = 34; - item.useTime = 8; - item.useAnimation = 8; + item.useTime = 9; + item.useAnimation = 9; item.useStyle = 5; item.noMelee = true; item.knockBack = 4.5f; @@ -48,11 +48,12 @@ namespace CalamityMod.Items.Weapons.Ranged { // Fire the Onyx Shard that is characteristic of the Onyx Blaster // The shard deals triple damage and double knockback - int shardDamage = 3 * damage; + int shardDamage = (int)(2.5 * damage); float shardKB = 2f * knockBack; float shardVelocityX = (speedX + (float)Main.rand.Next(-25, 26) * 0.05f) * 0.9f; float shardVelocityY = (speedY + (float)Main.rand.Next(-25, 26) * 0.05f) * 0.9f; - Projectile.NewProjectile(position.X, position.Y, shardVelocityX, shardVelocityY, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + int onyx = Projectile.NewProjectile(position.X, position.Y, shardVelocityX, shardVelocityY, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + Main.projectile[onyx].timeLeft -= 20; // Fire three symmetric pairs of bullets alongside it Vector2 baseVelocity = new Vector2(speedX, speedY); diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 0442c34c4f..f01934d293 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -10,34 +10,53 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Photoviscerator : ModItem { + public const int CooldownTime = 60 * 7; // 7 second cooldown. public override void SetStaticDefaults() { DisplayName.SetDefault("Photoviscerator"); Tooltip.SetDefault("90% chance to not consume gel\n" + - "Fires a stream of exo flames that literally melts everything"); + "Fires a stream of exo flames and light that explodes into homing sparks\n" + + "Right click to fire homing flares which stick to enemies and incinerate them"); } public override void SetDefaults() { - item.damage = 250; + item.damage = 230; item.ranged = true; item.width = 84; item.height = 30; item.useTime = 2; item.useAnimation = 10; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(2, 50, 0, 0); item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; - item.useAmmo = 23; + item.useAmmo = AmmoID.Gel; item.Calamity().customRarity = CalamityRarity.Violet; } + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = ModContent.ProjectileType(); + item.useTime = item.useAnimation = 27; + } + else + { + item.useTime = 2; + item.useAnimation = 10; + item.shoot = ModContent.ProjectileType(); + } + return base.CanUseItem(player); + } + public override Vector2? HoldoutOffset() { return new Vector2(-15, 0); @@ -45,11 +64,33 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int i = 0; i < 2; i++) + if (player.altFunctionUse == 2) { - float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Vector2 velocity = new Vector2(speedX, speedY); + position += velocity.ToRotation().ToRotationVector2() * 80f; + Projectile.NewProjectile(position, velocity.SafeNormalize(Vector2.Zero) * 17f, ModContent.ProjectileType(), damage * 3, knockBack, player.whoAmI); + } + else + { + for (int i = 0; i < 2; i++) + { + Vector2 velocity = new Vector2(speedX, speedY).RotatedByRandom(0.05f); + Projectile.NewProjectile(position, velocity, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + } + if (Main.rand.NextBool(8)) + { + for (int i = 0; i < 2; i++) + { + Vector2 velocity = new Vector2(speedX, speedY) * 2f; + position += velocity.ToRotation().ToRotationVector2() * 64f; + int yDirection = (i == 0).ToDirectionInt(); + velocity = velocity.RotatedBy(0.2f * yDirection); + Projectile lightBomb = Projectile.NewProjectileDirect(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + + lightBomb.localAI[1] = yDirection; + lightBomb.netUpdate = true; + } + } } return false; } diff --git a/Items/Weapons/Ranged/RealmRavager.cs b/Items/Weapons/Ranged/RealmRavager.cs index b2750d1247..31636ef2d9 100644 --- a/Items/Weapons/Ranged/RealmRavager.cs +++ b/Items/Weapons/Ranged/RealmRavager.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 76; item.height = 32; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 22; + item.useAnimation = 22; item.useStyle = 5; item.noMelee = true; item.knockBack = 4f; @@ -31,17 +31,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shootSpeed = 30f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int index = 0; index < 5; ++index) + for (int index = 0; index < Main.rand.Next(3,5); ++index) //3 to 4 bullets { float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index e444d39168..9a41a5dd4e 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 5600; + item.damage = 2601; item.ranged = true; item.crit += 40; item.knockBack = 10f; diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index 60b6c0023b..68117e29b6 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -1,3 +1,4 @@ +using CalamityMod.Projectiles.Rogue; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,10 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAmmo = 931; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool ConsumeAmmo(Player player) { @@ -57,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged Main.projectile[projectile].timeLeft = 200; Main.projectile[projectile].Calamity().forceRanged = true; } - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.LostSoulFriendly, damage, knockBack, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[proj].timeLeft = 600; Main.projectile[proj].Calamity().forceRanged = true; return false; diff --git a/Items/Weapons/Ranged/Triploon.cs b/Items/Weapons/Ranged/Triploon.cs index ed97b542ef..6d425907f7 100644 --- a/Items/Weapons/Ranged/Triploon.cs +++ b/Items/Weapons/Ranged/Triploon.cs @@ -42,24 +42,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 30f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - int harpoon = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[harpoon].timeLeft = 300; - } + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + float piOverTen = MathHelper.Pi * 0.1f; + int projCount = 3; + Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); + velocity *= 30f; + bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); + for (int projIndex = 0; projIndex < projCount; projIndex++) + { + float num120 = projIndex - (projCount - 1f) / 2f; + Vector2 offset = velocity.RotatedBy((double)(piOverTen * num120), default); + if (!canHit) + { + offset -= velocity; + } + Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } return false; } diff --git a/Items/Weapons/Ranged/Triploon.png b/Items/Weapons/Ranged/Triploon.png index e68939e24b..c5e054a398 100644 Binary files a/Items/Weapons/Ranged/Triploon.png and b/Items/Weapons/Ranged/Triploon.png differ diff --git a/Items/Weapons/Ranged/TrueConferenceCall.png b/Items/Weapons/Ranged/TrueConferenceCall.png index a0176dadac..b3ae40d01d 100644 Binary files a/Items/Weapons/Ranged/TrueConferenceCall.png and b/Items/Weapons/Ranged/TrueConferenceCall.png differ diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index 501414bdd9..fa56707ae3 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 4000; + item.damage = 4200; item.crit += 35; item.knockBack = 9.5f; item.ranged = true; @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Rogue/AccretionDisk.cs b/Items/Weapons/Rogue/AccretionDisk.cs index 32da2c5c22..39fbd1f72d 100644 --- a/Items/Weapons/Rogue/AccretionDisk.cs +++ b/Items/Weapons/Rogue/AccretionDisk.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,6 +36,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 776dfbb294..11507f71d8 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 100; + item.damage = 108; item.shootSpeed = 15f; item.shoot = ModContent.ProjectileType(); item.width = 66; diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.png b/Items/Weapons/Rogue/BallisticPoisonBomb.png index 6f037bb9f6..3534f76575 100644 Binary files a/Items/Weapons/Rogue/BallisticPoisonBomb.png and b/Items/Weapons/Rogue/BallisticPoisonBomb.png differ diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 74e7573bc9..3475a96cd1 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -46,7 +46,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int dagger = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[dagger].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index fa34c83b75..ddea0f89fc 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 50; item.height = 50; - item.damage = 140; + item.damage = 120; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index ebfb1e7d4c..db54600b47 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 44; - item.damage = 18; + item.damage = 16; item.crit += 4; item.noMelee = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs index f114c903d6..878d9b34c2 100644 --- a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs +++ b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs @@ -94,7 +94,8 @@ namespace CalamityMod.Items.Weapons.Rogue num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 1f); + int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); } return false; } diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index 21d7a99cbc..0951af189d 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -36,6 +36,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.PureGreen; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Vector2 origin = new Vector2(31f, 29f); diff --git a/Items/Weapons/Rogue/FlameScythe.cs b/Items/Weapons/Rogue/FlameScythe.cs index 55d7aa87c8..4120edfc13 100644 --- a/Items/Weapons/Rogue/FlameScythe.cs +++ b/Items/Weapons/Rogue/FlameScythe.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,6 +35,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = 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) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/GalaxySmasherRogue.cs b/Items/Weapons/Rogue/GalaxySmasherRogue.cs index f5bbadb4c6..a59b0e4d53 100644 --- a/Items/Weapons/Rogue/GalaxySmasherRogue.cs +++ b/Items/Weapons/Rogue/GalaxySmasherRogue.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 8e3b212583..ff7aa0d399 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -48,44 +48,28 @@ Right click to delete all existing spiky balls"); } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - if (player.ownedProjectileCounts[item.shoot] > 0) - { - return true; - } - else - { - return false; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } else { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 5f; int UseMax = item.stack; - - if (player.ownedProjectileCounts[item.shoot] >= UseMax) - { - return false; - } - else - { - return true; - } + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; - if (player.altFunctionUse == 2) - { - modPlayer.killSpikyBalls = true; - return false; - } - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; @@ -96,6 +80,8 @@ Right click to delete all existing spiky balls"); public override bool AltFunctionUse(Player player) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.killSpikyBalls = true; return true; } diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs index d6e73f5fea..38c01c5cd8 100644 --- a/Items/Weapons/Rogue/HellsSun.cs +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -46,47 +46,30 @@ namespace CalamityMod.Items.Weapons.Rogue item.shootSpeed = 5f; item.shoot = ModContent.ProjectileType(); - } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - if (player.ownedProjectileCounts[item.shoot] > 0) - { - return true; - } - else - { - return false; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } else { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 5f; int UseMax = item.stack; - - if (player.ownedProjectileCounts[item.shoot] >= UseMax) - { - return false; - } - else - { - return true; - } + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; - if (player.altFunctionUse == 2) - { - modPlayer.killSpikyBalls = true; - return false; - } - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * SdamageMult), knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; @@ -99,6 +82,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool AltFunctionUse(Player player) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.killSpikyBalls = true; return true; } diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index 57302003c7..50814bfec6 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 40; - item.damage = 8; + item.damage = 7; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = false; item.height = 36; item.maxStack = 999; - item.value = 1000; + item.value = Item.buyPrice(0, 0, 1, 0); item.rare = 0; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index f8dad5bc9b..7f4b6e90a1 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -43,7 +43,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index 414d6034d9..2d4e6fc3e6 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 40; - item.damage = 8; + item.damage = 7; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = false; item.height = 36; item.maxStack = 999; - item.value = 1000; + item.value = Item.buyPrice(0, 0, 1, 0); item.rare = 0; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index 5a0d797ec6..96d7874b26 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,6 +34,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = 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) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/NanoblackReaperRogue.cs b/Items/Weapons/Rogue/NanoblackReaperRogue.cs index c2ea74d77f..7f0d949771 100644 --- a/Items/Weapons/Rogue/NanoblackReaperRogue.cs +++ b/Items/Weapons/Rogue/NanoblackReaperRogue.cs @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs index 2f7048ba92..f2d29b7758 100644 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ b/Items/Weapons/Rogue/Nychthemeron.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { - for (int j = 0; j < item.stack - player.ownedProjectileCounts[item.shoot]; j++) + for (int j = 0; j < item.stack - player.ownedProjectileCounts[ModContent.ProjectileType()]; j++) { float spread = 2; int pIndex = Projectile.NewProjectile(position.X, position.Y, speedX + Main.rand.NextFloat(-spread, spread), speedY + Main.rand.NextFloat(-spread, spread), type, damage, knockBack, player.whoAmI, 0f, 1f); @@ -79,10 +79,22 @@ namespace CalamityMod.Items.Weapons.Rogue return false; } - public override bool CanUseItem(Player player) - { - return player.ownedProjectileCounts[item.shoot] < item.stack && player.altFunctionUse != 2; - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } + else + { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 6f; + int UseMax = item.stack; + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; + } + } public override void AddRecipes() { diff --git a/Items/Weapons/Rogue/PhantomLance.cs b/Items/Weapons/Rogue/PhantomLance.cs index bb4ca73c94..7265574da8 100644 --- a/Items/Weapons/Rogue/PhantomLance.cs +++ b/Items/Weapons/Rogue/PhantomLance.cs @@ -20,7 +20,7 @@ Stealth strikes don't slow down and souls always deal full damage"); public override void SafeSetDefaults() { - item.damage = 60; + item.damage = 70; item.knockBack = 5f; item.width = 62; diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs index 07e2541d12..e26e270cd5 100644 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ b/Items/Weapons/Rogue/PoisonPack.cs @@ -42,47 +42,30 @@ namespace CalamityMod.Items.Weapons.Rogue item.shootSpeed = 7f; item.shoot = ModContent.ProjectileType(); - } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - if (player.ownedProjectileCounts[item.shoot] > 0) - { - return true; - } - else - { - return false; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } else { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7f; int UseMax = item.stack; - - if (player.ownedProjectileCounts[item.shoot] >= UseMax) - { - return false; - } - else - { - return true; - } + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; - if (player.altFunctionUse == 2) - { - modPlayer.killSpikyBalls = true; - return false; - } - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; @@ -93,6 +76,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool AltFunctionUse(Player player) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.killSpikyBalls = true; return true; } diff --git a/Items/Weapons/Rogue/Pwnagehammer.cs b/Items/Weapons/Rogue/Pwnagehammer.cs index 22c306977d..efc33c2c13 100644 --- a/Items/Weapons/Rogue/Pwnagehammer.cs +++ b/Items/Weapons/Rogue/Pwnagehammer.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,6 +34,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = 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) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index ba11775685..286aefb989 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -1,7 +1,13 @@ +using CalamityMod.Items; +using System; using System.Collections.Generic; +using System.IO; using System.Linq; using Terraria; +using Terraria.DataStructures; using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using Terraria.Utilities; namespace CalamityMod.Items.Weapons.Rogue { public abstract class RogueWeapon : ModItem @@ -10,6 +16,42 @@ namespace CalamityMod.Items.Weapons.Rogue { } + public float StealthStrikeDamage; + + public RogueWeapon() + { + StealthStrikeDamage = 1f; + } + + public override ModItem Clone(Item itemClone) + { + RogueWeapon myClone = (RogueWeapon)base.Clone(itemClone); + myClone.StealthStrikeDamage = StealthStrikeDamage; + return myClone; + } + + public override int ChoosePrefix(UnifiedRandom rand) + { + WeightedRandom newPrefix = new WeightedRandom(); + newPrefix.Add("Pointy", 1); + newPrefix.Add("Sharp", 1); + newPrefix.Add("Feathered", 1); + newPrefix.Add("Sleek", 1); + newPrefix.Add("Hefty", 1); + newPrefix.Add("Mighty", 1); + newPrefix.Add("Glorious", 1); + newPrefix.Add("Serrated", 1); + newPrefix.Add("Vicious", 1); + newPrefix.Add("Lethal", 1); + newPrefix.Add("Flawless", 1); + newPrefix.Add("Radical", 1); + newPrefix.Add("Blunt", 1); + newPrefix.Add("Flimsy", 1); + newPrefix.Add("Unbalanced", 1); + newPrefix.Add("Atrocious", 1); + return mod.GetPrefix(newPrefix).Type; + } + public sealed override void SetDefaults() { SafeSetDefaults(); @@ -26,6 +68,11 @@ namespace CalamityMod.Items.Weapons.Rogue public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { add += player.Calamity().throwingDamage - 1f; + //Boost (or lower) the weapon's damage if it has a stealth strike available and an associated prefix + if (player.Calamity().StealthStrikeAvailable() && item.prefix > 0) + { + mult += StealthStrikeDamage - 1f; + } } // Simply add the player's dedicated rogue crit chance. @@ -55,6 +102,27 @@ namespace CalamityMod.Items.Weapons.Rogue string damageWord = splitText.Last(); tt.text = damageValue + " rogue " + damageWord; } + if (item.prefix > 0) + { + float ssDmgBoost = StealthStrikeDamage - 1f; + if (ssDmgBoost > 0) + { + TooltipLine StealthBonus = new TooltipLine(mod, "PrefixSSDmg", "+" + Math.Round(ssDmgBoost * 100f) + "% stealth strike damage") + { + isModifier = true + }; + tooltips.Add(StealthBonus); + } + else if (ssDmgBoost < 0) + { + TooltipLine StealthBonus = new TooltipLine(mod, "PrefixSSDmg", "-" + Math.Round(Math.Abs(ssDmgBoost) * 100f) + "% stealth strike damage") + { + isModifier = true, + isModifierBad = true + }; + tooltips.Add(StealthBonus); + } + } } public override bool ConsumeItem(Player player) diff --git a/Items/Weapons/Rogue/RoyalKnives.cs b/Items/Weapons/Rogue/RoyalKnives.cs index 2814bc4c33..4d5499fe89 100644 --- a/Items/Weapons/Rogue/RoyalKnives.cs +++ b/Items/Weapons/Rogue/RoyalKnives.cs @@ -93,7 +93,8 @@ namespace CalamityMod.Items.Weapons.Rogue num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); + int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); } return false; } diff --git a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs index 9be81be0ae..93641079e8 100644 --- a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs +++ b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs @@ -39,7 +39,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index 3574841393..d56a78eca5 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 47; + item.damage = 169; item.knockBack = 5f; item.useAnimation = item.useTime = 25; item.useStyle = 1; diff --git a/Items/Weapons/Rogue/SeashellBoomerang.cs b/Items/Weapons/Rogue/SeashellBoomerang.cs index cd9eb3a0c4..9424e5d6ea 100644 --- a/Items/Weapons/Rogue/SeashellBoomerang.cs +++ b/Items/Weapons/Rogue/SeashellBoomerang.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,6 +33,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = 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) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs index 1c58dc7cd6..bf1ae74ec7 100644 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ b/Items/Weapons/Rogue/SkyStabber.cs @@ -42,47 +42,30 @@ namespace CalamityMod.Items.Weapons.Rogue item.shootSpeed = 2f; item.shoot = ModContent.ProjectileType(); - } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - if (player.ownedProjectileCounts[item.shoot] > 0) - { - return true; - } - else - { - return false; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } else { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 2f; int UseMax = item.stack; - - if (player.ownedProjectileCounts[item.shoot] >= UseMax) - { - return false; - } - else - { - return true; - } + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; - if (player.altFunctionUse == 2) - { - modPlayer.killSpikyBalls = true; - return false; - } - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; @@ -93,6 +76,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool AltFunctionUse(Player player) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.killSpikyBalls = true; return true; } diff --git a/Items/Weapons/Rogue/StellarContemptRogue.cs b/Items/Weapons/Rogue/StellarContemptRogue.cs index 307f59266f..f3b4207cc6 100644 --- a/Items/Weapons/Rogue/StellarContemptRogue.cs +++ b/Items/Weapons/Rogue/StellarContemptRogue.cs @@ -45,6 +45,7 @@ namespace CalamityMod.Items.Weapons.Rogue { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/TerraDisk.cs b/Items/Weapons/Rogue/TerraDisk.cs index 84124fafee..80ab448d5c 100644 --- a/Items/Weapons/Rogue/TerraDisk.cs +++ b/Items/Weapons/Rogue/TerraDisk.cs @@ -58,6 +58,7 @@ A max of three disks can be active at a time"); { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index 2e7c0109e6..0ddae8e36a 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Toxicant Twister"); - Tooltip.SetDefault("Throws a speedy boomerang\n" + + Tooltip.SetDefault("Throws a speedy, homing boomerang\n" + "Stealth strikes fire two boomerangs that go much faster and release sand rapidly"); } @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 42; item.height = 46; - item.damage = 950; + item.damage = 650; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = item.useTime = 20; @@ -30,45 +30,34 @@ namespace CalamityMod.Items.Weapons.Rogue item.value = Item.buyPrice(1, 40, 0, 0); item.Calamity().postMoonLordRarity = 13; item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 18f; item.Calamity().rogue = 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) { - int projType = item.shoot; - if (Main.rand.NextBool(2)) - { - projType = ModContent.ProjectileType(); - } - if (player.Calamity().StealthStrikeAvailable()) { float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].velocity *= 1.5f; + Main.projectile[stealth].timeLeft = 420; + Main.projectile[stealth].penetrate = -1; + Main.projectile[stealth].localNPCHitCooldown = 6; + float SpeedX2 = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY2 = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - Main.projectile[stealth2].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - if (Main.projectile[stealth].Calamity().stealthStrike) - { - Main.projectile[stealth].velocity *= 1.5f; - Main.projectile[stealth].timeLeft = 420; - Main.projectile[stealth].penetrate = -1; - Main.projectile[stealth].localNPCHitCooldown = 6; - } - if (Main.projectile[stealth2].Calamity().stealthStrike) - { - Main.projectile[stealth2].penetrate += 2; - Main.projectile[stealth2].localNPCHitCooldown = 8; - } + int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, type, (int)(damage * 0.6f), knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth2].Calamity().stealthStrike = true; + Main.projectile[stealth2].penetrate += 2; + Main.projectile[stealth2].localNPCHitCooldown = 8; } else { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), projType, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs b/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs index cc7d1d8545..b6f1371380 100644 --- a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs +++ b/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,6 +37,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.Developer; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/TruePaladinsHammer.cs b/Items/Weapons/Rogue/TruePaladinsHammer.cs index eeaee61fc5..bc8087f295 100644 --- a/Items/Weapons/Rogue/TruePaladinsHammer.cs +++ b/Items/Weapons/Rogue/TruePaladinsHammer.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 14; - item.damage = 81; + item.damage = 87; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -34,6 +35,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = 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) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 86ef24f4aa..ada0d3eabd 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 22; - item.damage = 8; + item.damage = 11; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 38; item.maxStack = 999; - item.value = 100; + item.value = Item.buyPrice(0, 0, 1, 0); item.rare = 1; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; diff --git a/Items/Weapons/Summon/DreadmineStaff.png b/Items/Weapons/Summon/DreadmineStaff.png index db85833a8f..bd951759a3 100644 Binary files a/Items/Weapons/Summon/DreadmineStaff.png and b/Items/Weapons/Summon/DreadmineStaff.png differ diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 273e2ac851..638fdc8a8d 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 12; + item.damage = 10; item.mana = 10; item.width = 34; item.height = 24; diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs new file mode 100644 index 0000000000..4e5b46bd14 --- /dev/null +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -0,0 +1,73 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class GastricBelcherStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gastric Belcher Staff"); + Tooltip.SetDefault("Summons aquatic aberrations to protect you\n" + + "Aberrations fire vomit at nearby enemies with every third attack firing bubbles"); + } + + public override void SetDefaults() + { + item.damage = 70; + item.mana = 10; + item.width = 66; + item.height = 70; + item.useTime = item.useAnimation = 20; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 1f; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; + item.UseSound = SoundID.Item76; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + item.autoReuse = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + player.itemTime = item.useTime; + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float directionX = Main.mouseX + Main.screenPosition.X - playerPos.X; + float directionY = Main.mouseY + Main.screenPosition.Y - playerPos.Y; + if (player.gravDir == -1f) + { + directionY = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; + } + Vector2 spinningpoint = new Vector2(directionX, directionY); + float dist = spinningpoint.Length(); + if ((float.IsNaN(spinningpoint.X) && float.IsNaN(spinningpoint.Y)) || (spinningpoint.X == 0f && spinningpoint.Y == 0f)) + { + spinningpoint.X = player.direction; + spinningpoint.Y = 0f; + dist = item.shootSpeed; + } + else + { + dist = item.shootSpeed / dist; + } + spinningpoint.X *= dist; + spinningpoint.Y *= dist; + playerPos.X = Main.mouseX + Main.screenPosition.X; + playerPos.Y = Main.mouseY + Main.screenPosition.Y; + spinningpoint = spinningpoint.RotatedBy(Math.PI / 2D, default); + Projectile.NewProjectile(playerPos + spinningpoint, spinningpoint, type, damage, knockBack, player.whoAmI, 0f, 1f); + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/GastricBelcherStaff.png b/Items/Weapons/Summon/GastricBelcherStaff.png new file mode 100644 index 0000000000..11b0ee087a Binary files /dev/null and b/Items/Weapons/Summon/GastricBelcherStaff.png differ diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index b1b38912a1..54ee78dbdc 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Prototype Andromecha Ring"); - Tooltip.SetDefault("Summons an colossal controllable mech\n" + + Tooltip.SetDefault("Summons a colossal controllable mech\n" + "Right click to display the mech's control panel\n" + "The panel has 3 possible configurations, that you can choose using the brackets on the UI\n" + "Each bracket powers 2 out of 3 functions, represented by icons on the UI.\n" + diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 08933814c5..f6d79f82f3 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -344,7 +344,7 @@ namespace CalamityMod { BossDifficulty.TryGetValue("Leviathan", out float order); List bosses = new List() { NPCType(), NPCType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = "By killing an unknown entity in the Ocean Biome"; string despawn = CalamityUtils.ColorMessage("The aquatic entities sink back beneath the ocean depths.", new Color(0x7F, 0xFF, 0xD4)); @@ -357,7 +357,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("AstrumAureus", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HallowedKey, ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HallowedKey, ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] at Night in the Astral Biome"; string despawn = CalamityUtils.ColorMessage("Astrum Aureus’ program has been executed. Initiate recall.", new Color(0xFF, 0xD7, 0x00)); @@ -370,7 +370,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("PlaguebringerGoliath", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemID.Stinger, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("HOSTILE SPECIMENS TERMINATED. INITIATE RECALL TO HOME BASE.", new Color(0x00, 0xFF, 0x00)); @@ -396,7 +396,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("AstrumDeus", out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Defeat 3 empowered astral titans or use a [i:{summon}] at Night"; string despawn = CalamityUtils.ColorMessage("The infected deity retreats to the heavens.", new Color(0xFF, 0xD7, 0x00)); @@ -536,7 +536,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("SupremeCalamitas", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); @@ -551,7 +551,7 @@ namespace CalamityMod InvasionDifficulty.TryGetValue("Acid Rain Initial", out float order); List enemies = AcidRainEvent.PossibleEnemiesPreHM.Select(enemy => enemy.Key).ToList(); int summon = ItemType(); - List loot = new List() { ItemType() }; + List loot = new List() { ItemType(), ItemType() }; List collection = new List() { ItemType() }; string instructions = $"Use a [i:{summon}] or wait for the invasion to occur naturally after the Eye of Cthulhu is defeated."; string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the ocean.", new Color(146, 183, 116)); @@ -566,7 +566,7 @@ namespace CalamityMod enemies.Add(ModContent.NPCType()); enemies.AddRange(AcidRainEvent.PossibleMinibossesAS.Select(miniboss => miniboss.Key)); List summons = new List() { ItemType(), ItemType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType() }; string instructions = $"Use a [i:{ItemType()}] or [i:{ItemType()}] or wait for the invasion to occur naturally after the Aquatic Scourge is defeated"; string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the deep ocean.", new Color(146, 183, 116)); @@ -580,7 +580,7 @@ namespace CalamityMod List enemies = AcidRainEvent.PossibleEnemiesPolter.Select(enemy => enemy.Key).ToList(); enemies.AddRange(AcidRainEvent.PossibleMinibossesPolter.Select(miniboss => miniboss.Key)); List summons = new List() { ItemType(), ItemType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ModContent.ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ModContent.ItemType() }; List collection = new List() { ItemType() }; string instructions = $"Use a [i:{ItemType()}] or [i:{ItemType()}] or wait for the invasion to occur naturally after the Polterghast is defeated"; string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the deep ocean.", new Color(146, 183, 116)); @@ -618,7 +618,7 @@ namespace CalamityMod // Queen Bee AddLoot(bossChecklist, "QueenBee", - new List() { ItemType() }, + new List() { ItemType(), ItemID.Stinger }, new List() { ItemType() } ); @@ -844,6 +844,7 @@ namespace CalamityMod //Entropy's Vigil is a bruh moment sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List() { ProjectileType(), ProjectileType()}); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index 2b1074f059..fa9b875671 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -14,9 +14,10 @@ namespace CalamityMod.NPCs.AcidRain { public class NuclearTerror : ModNPC { - public bool Walking = false; public int AttackIndex = 0; public int DelayTime = 0; + public bool Dying = false; + public bool Walking = false; public float JumpTimer = 0f; public Vector2 ShootPosition; public static readonly int[] PhaseArray = new int[] @@ -61,6 +62,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); + writer.Write(Dying); writer.Write(Walking); writer.Write(AttackIndex); writer.Write(DelayTime); @@ -70,6 +72,7 @@ namespace CalamityMod.NPCs.AcidRain public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); + Dying = reader.ReadBoolean(); Walking = reader.ReadBoolean(); AttackIndex = reader.ReadInt32(); DelayTime = reader.ReadInt32(); @@ -78,8 +81,8 @@ namespace CalamityMod.NPCs.AcidRain } public override void AI() { - Lighting.AddLight(npc.Center, (npc.dontTakeDamage ? Color.Lime.ToVector3() : Color.White.ToVector3()) * 2f); - if (npc.dontTakeDamage) + Lighting.AddLight(npc.Center, (Dying ? Color.Lime.ToVector3() : Color.White.ToVector3()) * 2f); + if (Dying) return; bool phase2 = npc.life / (float)npc.lifeMax < 0.5f; if (DelayTime > 0) @@ -103,7 +106,7 @@ namespace CalamityMod.NPCs.AcidRain } Player player = Main.player[npc.target]; npc.defDamage = 170; - npc.damage = npc.dontTakeDamage ? 0 : npc.defDamage; + npc.damage = Dying ? 0 : npc.defDamage; TeleportCheck(player); npc.ai[0]++; Walking = false; @@ -347,7 +350,7 @@ namespace CalamityMod.NPCs.AcidRain public override void FindFrame(int frameHeight) { npc.frameCounter++; - int framesNeeded = npc.dontTakeDamage ? 7 : 6; + int framesNeeded = Dying ? 7 : 6; if (Walking) { framesNeeded = 8 - (int)Math.Ceiling(Math.Abs(npc.velocity.X) / 5f); // Walk faster the faster we're moving @@ -357,7 +360,7 @@ namespace CalamityMod.NPCs.AcidRain npc.frame.Y += frameHeight; npc.frameCounter = 0; } - if (npc.dontTakeDamage) + if (Dying) { if (npc.frame.Y < frameHeight * 8) { @@ -402,16 +405,17 @@ namespace CalamityMod.NPCs.AcidRain } public override bool CheckDead() { - if (!npc.dontTakeDamage) + if (!Dying) { npc.active = true; npc.life = 1; npc.dontTakeDamage = true; + Dying = true; npc.velocity = Vector2.Zero; npc.netUpdate = true; return false; } - return true; + return Dying; } public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 946524a1b0..2b0665d63e 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -86,7 +86,16 @@ namespace CalamityMod.NPCs.AcidRain { if (npc.ai[0] % 55f == 54f) { - npc.velocity = Vector2.UnitX * (player.Center.X - npc.Center.X > 0).ToDirectionInt() * 27f; + float horizontalSchoolingSpeed = 9f; + if (CalamityWorld.downedAquaticScourge) + { + horizontalSchoolingSpeed = 15f; + } + if (CalamityWorld.downedPolterghast) + { + horizontalSchoolingSpeed = 24f; + } + npc.velocity = Vector2.UnitX * (player.Center.X - npc.Center.X > 0).ToDirectionInt() * horizontalSchoolingSpeed; } if ((Math.Abs(player.Center.Y - npc.Center.Y) > 50f && player.wet) || (!player.wet && npc.ai[1] <= 0f)) { diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index db02795914..d11b3cd218 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -71,7 +71,33 @@ namespace CalamityMod.NPCs.AcidRain npc.TargetClosest(false); npc.localAI[0] = 1f; } + + // Anti-sticky movement and player targeting detection (only one leech and attack the player at once) Player player = Main.player[npc.target]; + bool playerAlreadyTargeted = false; + float antiStickyAcceleration = 0.25f; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].type == npc.type && + Main.npc[i].whoAmI != npc.whoAmI && + Main.npc[i].active) + { + if (Main.npc[i].target == npc.target && !playerAlreadyTargeted) + { + playerAlreadyTargeted = true; + } + if (Main.npc[i].Hitbox.Intersects(npc.Hitbox)) + { + npc.velocity += npc.DirectionFrom(Main.npc[i].Center) * antiStickyAcceleration; + } + } + } + + if (!playerAlreadyTargeted || player.Calamity().waterLeechTarget == -1) + { + player.Calamity().waterLeechTarget = npc.whoAmI; + } + // Latch onto player if (npc.ai[0] == 1f) { @@ -114,14 +140,14 @@ namespace CalamityMod.NPCs.AcidRain npc.netUpdate = true; } } - else if (player.wet) + else if (player.wet && player.Calamity().waterLeechTarget == npc.whoAmI) { - float speed = player.wet ? 23f : 15f; + float speed = player.wet ? 23f : 17f; float swimIntertia = 24f; if (CalamityWorld.downedPolterghast) { speed *= 1.6f; - swimIntertia = 13f; + swimIntertia = 17f; } npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.DirectionTo(player.Center) * speed) / swimIntertia; } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6f6a616e52..cfc12251b7 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -63,6 +63,7 @@ using System; using System.Collections.Generic; using System.Linq; using Terraria; +using Terraria.GameContent.Events; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -3530,6 +3531,10 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.1); } + else if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.2); + } else if (projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow) { damage = (int)(damage * 0.4); @@ -5306,6 +5311,11 @@ namespace CalamityMod.NPCs chat = "I happen to have several Angel Statues at the moment, a truely rare commodity. Want one?"; } + if (Main.rand.NextBool(7) && CalamityWorld.death) + { + chat = "The caverns have become increasingly dark as of late, so I stocked up on some special torches if you have the funds."; + } + break; case NPCID.Mechanic: @@ -5555,6 +5565,7 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.BallOHurt : ItemID.TheRottedFork, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedBoss3); SetShopItem(ref shop, ref nextSlot, ItemID.AngelStatue, NPC.FindFirstNPC(NPCType()) != -1, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.UltrabrightTorch, CalamityWorld.death); } // Because of the defiled condition, the dye trader does not receive an alert icon when hardmode starts. @@ -5818,6 +5829,23 @@ namespace CalamityMod.NPCs } #endregion + #region Any Events + public static bool AnyEvents(Player player) + { + if (Main.invasionType > 0) + return true; + if (player.PillarZone()) + return true; + if (DD2Event.Ongoing) + return true; + if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && (Main.eclipse || Main.bloodMoon || Main.pumpkinMoon || Main.snowMoon)) + return true; + if (CalamityWorld.rainingAcid && player.InSulphur()) + return true; + return false; + } + #endregion + #region Get Downed Boss Variable public static bool GetDownedBossVariable(int type) { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 721657255b..3b773eccd8 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1689,7 +1689,7 @@ namespace CalamityMod.NPCs break; case NPCID.Plantera: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 6, 9); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 12, 18); break; case NPCID.SolarSpearman: //Drakanian diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index eff39b30d3..73bdd0b73f 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -9,6 +9,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -627,6 +628,7 @@ namespace CalamityMod.NPCs.Leviathan DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Equipment DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 26d9f78b5a..f5558ebedb 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.height = 198; npc.defense = 40; npc.Calamity().RevPlusDR(0.25f); - npc.LifeMaxNERB(58500, 77275, 3700000); + npc.LifeMaxNERB(64350, 85002, 3700000); double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 4981529049..c9a6c11447 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1307,7 +1307,7 @@ namespace CalamityMod.NPCs.Providence { // Materials DropHelper.DropItemSpray(npc, ModContent.ItemType(), 20, 30); - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 10, 15); + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 15, 20); // Weapons DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); diff --git a/Prefixes/AccessoryPrefix.cs b/Prefixes/AccessoryPrefix.cs new file mode 100644 index 0000000000..b0646d2231 --- /dev/null +++ b/Prefixes/AccessoryPrefix.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Prefixes +{ + public class AccessoryPrefix : ModPrefix + { + //Thank you Thomas for helping me set this up =D + internal static List AccessoryModifiers; + internal float stealthGenBonus = 1f; + + public override PrefixCategory Category => PrefixCategory.Accessory; + + public AccessoryPrefix() + { + + } + + public AccessoryPrefix(float stealthGenBonus = 1f) + { + this.stealthGenBonus = stealthGenBonus; + } + + public override bool Autoload(ref string name) + { + if (base.Autoload(ref name)) + { + //Damage, Use Time, Crit, Velocity, SS Dmg + AccessoryModifiers = new List(); + AddAccessoryPrefix(mod, AccPrefixType.Quiet, 1.02f); + AddAccessoryPrefix(mod, AccPrefixType.Cloaked, 1.04f); + AddAccessoryPrefix(mod, AccPrefixType.Camouflaged, 1.06f); + AddAccessoryPrefix(mod, AccPrefixType.Silent, 1.08f); + } + return false; + } + + public override void Apply(Item item) + { + item.Calamity().StealthGenBonus = stealthGenBonus; + } + + public override void ModifyValue(ref float valueMult) + { + float extraValue = 1f + (2.5f * (stealthGenBonus - 1f)); + valueMult *= extraValue; + } + + public override float RollChance(Item item) + { + if (item.vanity) + return 0f; + if (item.type == ItemID.GuideVoodooDoll || item.type == ItemID.MusicBox || item.type == ItemID.ClothierVoodooDoll) + return 0f; + if (item.type >= ItemID.MusicBoxOverworldDay && item.type <= ItemID.MusicBoxBoss3) + return 0f; + if (item.type >= ItemID.MusicBoxSnow && item.type <= ItemID.MusicBoxMushrooms) + return 0f; + + return 1f; + } + + private static void AddAccessoryPrefix(Mod mod, AccPrefixType prefixType, float stealthGenBonus = 1f) + { + string name = prefixType.ToString(); + mod.AddPrefix(name, new AccessoryPrefix(stealthGenBonus)); + AccessoryModifiers.Add(mod.GetPrefix(name).Type); + } + } + + public enum AccPrefixType : byte + { + Quiet, + Cloaked, + Camouflaged, + Silent + } +} \ No newline at end of file diff --git a/Prefixes/RoguePrefix.cs b/Prefixes/RoguePrefix.cs new file mode 100644 index 0000000000..180539af9d --- /dev/null +++ b/Prefixes/RoguePrefix.cs @@ -0,0 +1,122 @@ +using CalamityMod.Items.Weapons.Rogue; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Prefixes +{ + public class RoguePrefix : ModPrefix + { + //Thank you Thomas for helping me set this up =D + internal static List RogueModifiers; + internal float damageMult = 1f; + internal float useTimeMult = 1f; + internal int critBonus = 0; + internal float shootSpeedMult = 1f; + internal float stealthDmgMult = 1f; + + public override PrefixCategory Category => PrefixCategory.Custom; + + public RoguePrefix() + { + + } + + public RoguePrefix(float damageMult = 1f, float useTimeMult = 1f, int critBonus = 0, float shootSpeedMult = 1f, float stealthDmgMult = 1f) + { + this.damageMult = damageMult; + this.useTimeMult = useTimeMult; + this.critBonus = critBonus; + this.shootSpeedMult = shootSpeedMult; + this.stealthDmgMult = stealthDmgMult; + } + + public override bool Autoload(ref string name) + { + if (base.Autoload(ref name)) + { + //Damage, Use Time, Crit, Velocity, SS Dmg + RogueModifiers = new List(); + AddRoguePrefix(mod, RoguePrefixType.Pointy, 1.1f, 1f, 0, 1f, 1f); + AddRoguePrefix(mod, RoguePrefixType.Sharp, 1.15f, 1f, 0, 1f, 1f); + AddRoguePrefix(mod, RoguePrefixType.Feathered, 1f, 0.85f, 0, 1.1f, 1f); + AddRoguePrefix(mod, RoguePrefixType.Sleek, 1f, 0.9f, 0, 1.15f, 1f); + AddRoguePrefix(mod, RoguePrefixType.Hefty, 1.1f, 1f, 0, 1f, 1.15f); + AddRoguePrefix(mod, RoguePrefixType.Mighty, 1.15f, 1f, 0, 1f, 1.05f); + AddRoguePrefix(mod, RoguePrefixType.Glorious, 1.1f, 0.95f, 0, 1f, 1f); + AddRoguePrefix(mod, RoguePrefixType.Serrated, 1.1f, 0.9f, 0, 1.05f, 1f); + AddRoguePrefix(mod, RoguePrefixType.Vicious, 1.1f, 0.95f, 0, 1.15f, 1f); + AddRoguePrefix(mod, RoguePrefixType.Lethal, 1.1f, 0.95f, 2, 1.05f, 1.05f); + AddRoguePrefix(mod, RoguePrefixType.Flawless, 1.15f, 0.9f, 5, 1.1f, 1.15f); + AddRoguePrefix(mod, RoguePrefixType.Radical, 1.05f, 0.95f, 0, 1.05f, 0.9f); + AddRoguePrefix(mod, RoguePrefixType.Blunt, 0.85f, 1f, 0, 1f, 1f); + AddRoguePrefix(mod, RoguePrefixType.Flimsy, 0.9f, 1f, 0, 1f, 0.9f); + AddRoguePrefix(mod, RoguePrefixType.Unbalanced, 1f, 1.15f, 0, 0.95f, 1f); + AddRoguePrefix(mod, RoguePrefixType.Atrocious, 0.85f, 1f, 0, 0.9f, 0.9f); + } + return false; + } + + public override void Apply(Item item) + { + ModItem moddedItem = item.modItem; + if(moddedItem != null && moddedItem is RogueWeapon rogueWep) + { + rogueWep.StealthStrikeDamage = stealthDmgMult; + } + } + + public override void ModifyValue(ref float valueMult) + { + float extraValue = 1f + (1f * (stealthDmgMult - 1f)); + valueMult *= extraValue; + } + + public override bool CanRoll(Item item) => item.Calamity().rogue && !item.consumable; + + public override void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus) + { + damageMult = this.damageMult; + useTimeMult = this.useTimeMult; + critBonus = this.critBonus; + shootSpeedMult = this.shootSpeedMult; + } + + private static void AddRoguePrefix(Mod mod, RoguePrefixType prefixType, float damageMult = 1f, float useTimeMult = 1f, int critBonus = 0, float shootSpeedMult = 1f, float stealthDmgMult = 1f) + { + string name = prefixType.ToString(); + mod.AddPrefix(name, new RoguePrefix(damageMult, useTimeMult, critBonus, shootSpeedMult, stealthDmgMult)); + RogueModifiers.Add(mod.GetPrefix(name).Type); + } + + public override void ValidateItem(Item item, ref bool invalid) + { + if (item.damage == Math.Round(item.damage * damageMult)) + invalid = true; + if (item.useAnimation == Math.Round(item.useAnimation * useTimeMult)) + invalid = true; + } + } + + public enum RoguePrefixType : byte + { + Pointy, + Sharp, + Feathered, + Sleek, + Hefty, + Mighty, + Glorious, + Serrated, + Vicious, + Lethal, + Flawless, + Radical, + Blunt, + Flimsy, + Unbalanced, + Atrocious + } +} \ No newline at end of file diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index d43bc0bb0b..f1a3579ccd 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -123,9 +123,17 @@ namespace CalamityMod.Projectiles case ProjectileID.ButchersChainsaw: trueMelee = true; break; + case ProjectileID.StarWrath: projectile.penetrate = projectile.maxPenetrate = 1; break; + + case ProjectileID.Spazmamini: + case ProjectileID.Retanimini: + case ProjectileID.MiniRetinaLaser: + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + break; default: break; } @@ -1139,7 +1147,7 @@ namespace CalamityMod.Projectiles } } - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != NPCType()) + if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != NPCType() && !player.moonLeech) { // Increases the degree to which Spectre Healing set contributes to the lifesteal cap if (player.ghostHeal) @@ -1485,13 +1493,14 @@ namespace CalamityMod.Projectiles target.AddBuff(BuffID.Venom, 240); } - if (modPlayer.shadow) + if (modPlayer.shadow && modPlayer.shadowPotCooldown <= 0) { if (CalamityMod.javelinProjList.Contains(projectile.type)) { int randrot = Main.rand.Next(-30, 391); Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.1, 60), 3f, projectile.owner, 0f, 0f); + modPlayer.shadowPotCooldown = 30; } if (CalamityMod.spikyBallProjList.Contains(projectile.type)) { @@ -1499,6 +1508,7 @@ namespace CalamityMod.Projectiles Main.projectile[scythe].usesLocalNPCImmunity = true; Main.projectile[scythe].localNPCHitCooldown = 10; Main.projectile[scythe].penetrate = 2; + modPlayer.shadowPotCooldown = 30; } if (CalamityMod.daggerProjList.Contains(projectile.type)) { @@ -1507,6 +1517,7 @@ namespace CalamityMod.Projectiles shardVelocity *= 5f; int shard = Projectile.NewProjectile(projectile.Center, shardVelocity, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 60), 0f, projectile.owner); Main.projectile[shard].timeLeft = 150; + modPlayer.shadowPotCooldown = 30; } if (CalamityMod.boomerangProjList.Contains(projectile.type)) { @@ -1547,11 +1558,13 @@ namespace CalamityMod.Projectiles int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0f, projectile.owner, (float)num3, 0f); Main.projectile[ghost].Calamity().forceRogue = true; Main.projectile[ghost].penetrate = 1; + modPlayer.shadowPotCooldown = 30; } if (CalamityMod.flaskBombProjList.Contains(projectile.type)) { int blackhole = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f); Main.projectile[blackhole].Center = projectile.Center; + modPlayer.shadowPotCooldown = 30; } } } @@ -1621,8 +1634,8 @@ namespace CalamityMod.Projectiles { if (Main.rand.NextBool(4)) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 100), projectile.knockBack * 0.25f, projectile.owner); - modPlayer.jellyDmg = 20f; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 90), projectile.knockBack * 0.25f, projectile.owner); + modPlayer.jellyDmg = 25f; } } else if (modPlayer.starbusterCore) @@ -1915,6 +1928,8 @@ namespace CalamityMod.Projectiles public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier) { + if (Main.player[Main.myPlayer].moonLeech) + return; Main.player[Main.myPlayer].lifeSteal -= healAmount * cooldownMultiplier; float num13 = 0f; int num14 = projectile.owner; @@ -2133,6 +2148,231 @@ namespace CalamityMod.Projectiles } } + public static void ChargingMinionAI(Projectile projectile, float range, float maxPlayerDist, float extraMaxPlayerDist, float safeDist, int initialUpdates, float chargeDelayTime, float goToSpeed, float goBackSpeed, float chargeCounterMax, float chargeSpeed, bool tileVision, bool ignoreTilesWhenCharging) + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + //Anti sticky movement to prevent stacking + float antiStickMvt = 0.05f; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + bool typeCheck = proj.type == projectile.type; + if (projIndex != projectile.whoAmI && proj.active && proj.owner == projectile.owner && typeCheck && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) + { + if (projectile.position.X < proj.position.X) + { + projectile.velocity.X -= antiStickMvt; + } + else + { + projectile.velocity.X += antiStickMvt; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= antiStickMvt; + } + else + { + projectile.velocity.Y += antiStickMvt; + } + } + } + + //Breather time between charges as like a reset + bool chargeDelay = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = initialUpdates + (projectile.type == ModContent.ProjectileType() ? 2 : 1); + if (projectile.ai[1] > chargeDelayTime) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = initialUpdates; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + chargeDelay = true; + } + } + if (chargeDelay) + { + return; + } + + //Find a target + float maxDist = range; + Vector2 targetVec = projectile.position; + bool foundTarget = false; + Vector2 half = new Vector2(0.5f); + //Prioritize the targeted enemy if possible + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + //Check the size of the target to make it easier to hit fat targets like Levi + Vector2 sizeCheck = npc.position + npc.Size * half; + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + //Some minions will ignore tiles when choosing a target like Ice Claspers, others will not + bool canHit = true; + if (!tileVision) + canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + if (!foundTarget && targetDist < maxDist && canHit) + { + maxDist = targetDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + //If no npc is specifically targetted, check through the entire array + else + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + bool canHit = true; + if (!tileVision) + canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + if (!foundTarget && targetDist < maxDist && canHit) + { + maxDist = targetDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + } + + //If the player is too far, return to the player. Range is increased while attacking something. + float distBeforeForcedReturn = maxPlayerDist; + if (foundTarget) + { + distBeforeForcedReturn = extraMaxPlayerDist; + } + if (Vector2.Distance(player.Center, projectile.Center) > distBeforeForcedReturn) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + + //Go to the target if you found one + if (foundTarget && projectile.ai[0] == 0f) + { + //Some minions don't ignore tiles while charging like brittle stars + projectile.tileCollide = !ignoreTilesWhenCharging; + Vector2 targetSpot = targetVec - projectile.Center; + float targetDist = targetSpot.Length(); + targetSpot.Normalize(); + //Tries to get the minion in the sweet spot of 200 pixels away but the minion also charges so idk what good it does + if (targetDist > 200f) + { + float speed = goToSpeed; //8 + targetSpot *= speed; + projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; + } + else + { + float speed = -goBackSpeed; //-4 + targetSpot *= speed; + projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; //41 + } + } + + //Movement for idle or returning to the player + else + { + //Ignore tiles so they don't get stuck everywhere like Optic Staff + projectile.tileCollide = false; + + bool returningToPlayer = false; + if (!returningToPlayer) + { + returningToPlayer = projectile.ai[0] == 1f; + } + + //Player distance calculations + Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -60f); + float playerDist = playerVec.Length(); + + //If the minion is actively returning, move faster + float playerHomeSpeed = 6f; + if (returningToPlayer) + { + playerHomeSpeed = 15f; + } + //Move somewhat faster if the player is kinda far~ish + if (playerDist > 200f && playerHomeSpeed < 8f) + { + playerHomeSpeed = 8f; + } + //Return to normal if close enough to the player + if (playerDist < safeDist && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + //Teleport to the player if abnormally far + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + //If more than 70 pixels away, move toward the player + if (playerDist > 70f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + } + //Minions never stay still + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + + //Increment attack counter randomly + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + //If high enough, prepare to attack + if (projectile.ai[1] > chargeCounterMax) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + //Charge at an enemy if not on cooldown + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && foundTarget && maxDist < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 targetPos = targetVec - projectile.Center; + targetPos.Normalize(); + projectile.velocity = targetPos * chargeSpeed; //8 + projectile.netUpdate = true; + } + } + } + } + public static void FloatingPetAI(Projectile projectile, bool faceRight, float tiltFloat, bool lightPet = false) { Player player = Main.player[projectile.owner]; @@ -2264,6 +2504,21 @@ namespace CalamityMod.Projectiles projectile.spriteDirection = projectile.direction; projectile.rotation = projectile.velocity.X * tiltFloat; } + public static void ExpandHitboxBy(Projectile projectile, int width, int height) + { + projectile.position = projectile.Center; + projectile.width = width; + projectile.height = height; + projectile.position -= projectile.Size * 0.5f; + } + public static void ExpandHitboxBy(Projectile projectile, int newSize) + { + ExpandHitboxBy(projectile, newSize, newSize); + } + public static void ExpandHitboxBy(Projectile projectile, float expandRatio) + { + ExpandHitboxBy(projectile, (int)(projectile.width * expandRatio), (int)(projectile.height * expandRatio)); + } #endregion } } diff --git a/Projectiles/Healing/BurntSiennaProj.cs b/Projectiles/Healing/BurntSiennaProj.cs index 6c2ed80366..c9a3d5e548 100644 --- a/Projectiles/Healing/BurntSiennaProj.cs +++ b/Projectiles/Healing/BurntSiennaProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Healing projectile.velocity.X *= 0.95f; projectile.velocity.Y *= 0.95f; - CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f, false); + CalamityGlobalProjectile.HealingProjectile(projectile, 3, (int)projectile.ai[0], 6f, 15f, false); int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dusty]; dust.noGravity = true; diff --git a/Projectiles/Healing/TerracottaProj.cs b/Projectiles/Healing/TerracottaProj.cs index 14ae4bc480..d6c26b2ae1 100644 --- a/Projectiles/Healing/TerracottaProj.cs +++ b/Projectiles/Healing/TerracottaProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Healing projectile.velocity.X *= 0.95f; projectile.velocity.Y *= 0.95f; - CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f, false, 300); + CalamityGlobalProjectile.HealingProjectile(projectile, 9, (int)projectile.ai[0], 8f, 15f, false, 300); float num498 = projectile.velocity.X * 0.2f; float num499 = -(projectile.velocity.Y * 0.2f); int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); diff --git a/Projectiles/Hybrid/AccretionDiskProj.cs b/Projectiles/Hybrid/AccretionDiskProj.cs index 0cc68e105f..5c91e8fadb 100644 --- a/Projectiles/Hybrid/AccretionDiskProj.cs +++ b/Projectiles/Hybrid/AccretionDiskProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.aiStyle = 3; projectile.timeLeft = 400; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Hybrid/EradicatorProjectile.cs b/Projectiles/Hybrid/EradicatorProjectile.cs index 458f86a7a3..c5d6093ea1 100644 --- a/Projectiles/Hybrid/EradicatorProjectile.cs +++ b/Projectiles/Hybrid/EradicatorProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Hybrid aiType = ProjectileID.WoodenBoomerang; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Hybrid/FlameScytheProjectile.cs b/Projectiles/Hybrid/FlameScytheProjectile.cs index 57e8b9a374..5faaa6cf46 100644 --- a/Projectiles/Hybrid/FlameScytheProjectile.cs +++ b/Projectiles/Hybrid/FlameScytheProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.timeLeft = 600; projectile.alpha = 55; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() @@ -57,7 +57,10 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; + if (projectile.melee) + Main.projectile[proj].Calamity().forceMelee = true; + else + Main.projectile[proj].Calamity().forceRogue = true; } } @@ -67,7 +70,10 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; + if (projectile.melee) + Main.projectile[proj].Calamity().forceMelee = true; + else + Main.projectile[proj].Calamity().forceRogue = true; } } } diff --git a/Projectiles/Hybrid/GalaxySmasherHammer.cs b/Projectiles/Hybrid/GalaxySmasherHammer.cs index 16010c3265..39f836e272 100644 --- a/Projectiles/Hybrid/GalaxySmasherHammer.cs +++ b/Projectiles/Hybrid/GalaxySmasherHammer.cs @@ -183,7 +183,6 @@ namespace CalamityMod.Projectiles.Hybrid float laserSpeed = Main.rand.NextFloat(15f, 18f); Vector2 velocity = startDir * (-laserSpeed); - // NebulaShot projectile adjusts its own damage type based on ai[0] if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner); diff --git a/Projectiles/Hybrid/MangroveChakramProjectile.cs b/Projectiles/Hybrid/MangroveChakramProjectile.cs index 0c32453a85..a1e11f2486 100644 --- a/Projectiles/Hybrid/MangroveChakramProjectile.cs +++ b/Projectiles/Hybrid/MangroveChakramProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.aiStyle = 3; projectile.timeLeft = 600; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Hybrid/OPHammer.cs b/Projectiles/Hybrid/OPHammer.cs index 0278d3d2db..8cd41f666b 100644 --- a/Projectiles/Hybrid/OPHammer.cs +++ b/Projectiles/Hybrid/OPHammer.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.tileCollide = false; projectile.penetrate = -1; projectile.extraUpdates = 2; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() @@ -118,7 +118,10 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; + if (projectile.melee) + Main.projectile[proj].Calamity().forceMelee = true; + else + Main.projectile[proj].Calamity().forceRogue = true; } } @@ -128,7 +131,10 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; + if (projectile.melee) + Main.projectile[proj].Calamity().forceMelee = true; + else + Main.projectile[proj].Calamity().forceRogue = true; } } diff --git a/Projectiles/Hybrid/PwnagehammerProj.cs b/Projectiles/Hybrid/PwnagehammerProj.cs index b84082b42c..a973c87a60 100644 --- a/Projectiles/Hybrid/PwnagehammerProj.cs +++ b/Projectiles/Hybrid/PwnagehammerProj.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.timeLeft = 120; projectile.extraUpdates = 3; aiType = ProjectileID.PaladinsHammerFriendly; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Hybrid/SeashellBoomerangProjectile.cs b/Projectiles/Hybrid/SeashellBoomerangProjectile.cs index d7209de0a7..f6f6a7c8aa 100644 --- a/Projectiles/Hybrid/SeashellBoomerangProjectile.cs +++ b/Projectiles/Hybrid/SeashellBoomerangProjectile.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.aiStyle = 3; projectile.timeLeft = 240; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + projectile.melee = true; } } } diff --git a/Projectiles/Hybrid/TriactisOPHammer.cs b/Projectiles/Hybrid/TriactisOPHammer.cs index 1c4ddffd63..4a59c7ab85 100644 --- a/Projectiles/Hybrid/TriactisOPHammer.cs +++ b/Projectiles/Hybrid/TriactisOPHammer.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.tileCollide = false; projectile.penetrate = -1; projectile.extraUpdates = 3; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs new file mode 100644 index 0000000000..12665a5124 --- /dev/null +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -0,0 +1,204 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class EnormousConsumingVortex : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float IdealScale + { + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + public const int TentacleSpawnRate = 30; + public const int PulseInterval = 18; + public const float PulseHitboxExpandRatio = 2.5f; + public const float RadialOffsetVarianceFactor = 0.1f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Subsuming Vortex"); + ProjectileID.Sets.NeedsUUID[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.scale = 0.0004f; + projectile.timeLeft = 540; + projectile.tileCollide = false; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 17; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(IdealScale); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + IdealScale = reader.ReadSingle(); + } + + public override void AI() + { + projectile.rotation += MathHelper.ToRadians(8f); // Spin 2 win. + projectile.alpha = (int)MathHelper.Lerp(255, 0, Utils.InverseLerp(0f, 20f, Time, true)); // Fade in completely after 20 frames. + projectile.scale = MathHelper.Lerp(0.0004f, IdealScale, Utils.InverseLerp(0f, 30f, Time, true)); // Expand completely after 30 frames. + + // Determine the ideal scale in the first frame. + if (IdealScale == 0f) + { + IdealScale = Main.rand.NextFloat(2.2f, 3f); + projectile.netUpdate = true; + } + + // Target enemy if possible and idly spawn tentacles. + if (Time < 300) + { + TargetingMovement(); + if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.netMode != NetmodeID.MultiplayerClient) + { + ProduceSubsumingHentai(); + } + } + // Slow down and pulse frequently. + else if (Time < 480) + { + projectile.velocity *= 0.96f; + if (Time % PulseInterval == 0f) + { + PulseEffect(); + } + } + else if (Time == 520f) + { + ExplodeEffect(); + projectile.Kill(); + } + CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(projectile.scale * 62)); + Time++; + } + public void ProduceSubsumingHentai() + { + float xStartingAcceleration = Main.rand.NextFloat(0.001f, 0.04f) * Main.rand.NextBool(2).ToDirectionInt(); + float yStartingAcceleration = Main.rand.NextFloat(0.001f, 0.04f) * Main.rand.NextBool(2).ToDirectionInt(); + Projectile subsumingHentai = Projectile.NewProjectileDirect(projectile.Center, + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(9f, 13f), + ModContent.ProjectileType(), + (int)(projectile.damage * 0.6), + projectile.knockBack * 0.6f, + projectile.owner, + xStartingAcceleration, + yStartingAcceleration); + subsumingHentai.tileCollide = false; + } + + public void TargetingMovement() + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(1500f, true); + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * 5f + projectile.DirectionTo(potentialTarget.Center) * 7f) / 6f; + } + } + public void PulseEffect() + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, PulseHitboxExpandRatio); + projectile.Damage(); + if (!Main.dedServ) + { + Main.PlaySound(SoundID.Item43, projectile.Center); + for (int i = 0; (float)i < 85; i++) + { + float angle = i / 85f * MathHelper.TwoPi; + Vector2 spawnPosition = projectile.Center + angle.ToRotationVector2() * (500f + Main.rand.NextFloat(-8f, 8f)); + Vector2 velocity = (angle - (float)Math.PI).ToRotationVector2() * Main.rand.NextFloat(27f, 38.5f); + Dust dust = Dust.NewDustPerfect(spawnPosition, 264, velocity); + dust.scale = 0.9f; + dust.fadeIn = 1.25f; + dust.color = Main.hslToRgb(i / 85f, 1f, 0.8f); + dust.noGravity = true; + } + } + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 1f / PulseHitboxExpandRatio); + } + public void ExplodeEffect() + { + Main.PlaySound(SoundID.Zombie, projectile.Center, 104); + if (!Main.dedServ) + { + for (int i = 0; i < 200; i++) + { + Vector2 velocity = Main.rand.NextVector2Circular(50f, 50f); + Dust dust = Dust.NewDustPerfect(projectile.Center, 264, velocity); + dust.color = Main.hslToRgb(i / 100f % 1f, 1f, 0.8f); + dust.fadeIn = 1.25f; + dust.noGravity = true; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC closestTarget = projectile.Center.ClosestNPCAt(1600f, true); + for (int i = 0; i < 12; i++) + { + float rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Vector2 velocity = Vector2.UnitY.RotatedBy(rotation); + if (closestTarget != null) + velocity = projectile.DirectionTo(closestTarget.Center).RotatedByRandom(0.4f); + velocity *= Main.rand.NextFloat(3f, 5f); + Projectile.NewProjectileDirect(projectile.Center, + velocity, + ModContent.ProjectileType(), + (int)(projectile.damage * 0.7), + projectile.knockBack, + projectile.owner, + 0f, + Main.rand.NextFloat(0.5f, 1.8f)); + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + int vortexesToDraw = 27; + for (int i = 0; i < vortexesToDraw; i++) + { + float rotation = MathHelper.TwoPi / i * vortexesToDraw + projectile.rotation; + float drawScale = projectile.scale * 0.66f; + + drawScale *= (float)(Math.Cos(Time / 18f + rotation * 2f) + 1f) * 0.3f + 0.7f; // Range of 0.7 to 1. Used to give variance with the scale. + float offsetFactor = (float)(Math.Sin(Time / 18f + rotation * 2f) + 1f) * 0.2f + 0.8f; // Range of 0.8 to 1. + + // Due to the way RotatedBy works, the offset can be negative, giving the projectile a + // dual buzzsaw look. + Vector2 drawOffset = Vector2.UnitX.RotatedBy(rotation) * 30f * offsetFactor * drawScale; + Vector2 drawPosition = projectile.Center + drawOffset - Main.screenPosition; + Color colorToDraw = Main.hslToRgb((i / (float)vortexesToDraw + Time / 40f) % 1f, 1f, 0.75f); + spriteBatch.Draw(ModContent.GetTexture(Texture), + drawPosition, + null, + colorToDraw * 0.7f, + rotation, + ModContent.GetTexture(Texture).Size() * 0.5f, + drawScale, + SpriteEffects.None, + 0f); + } + return false; + } + } +} diff --git a/Projectiles/Magic/EnormousConsumingVortex.png b/Projectiles/Magic/EnormousConsumingVortex.png new file mode 100644 index 0000000000..0e1de2dd8f Binary files /dev/null and b/Projectiles/Magic/EnormousConsumingVortex.png differ diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs index cfacbdbd4a..718b82efce 100644 --- a/Projectiles/Magic/MagnusBeam.cs +++ b/Projectiles/Magic/MagnusBeam.cs @@ -203,7 +203,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index fa9fb3df1d..1559d3ffb0 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; projectile.velocity.X *= 0.975f; projectile.velocity.Y *= 0.975f; - if (Main.rand.NextBool(2)) + if (projectile.timeLeft % 4 == 0) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } diff --git a/Projectiles/Magic/ManaBoltSmall2.cs b/Projectiles/Magic/ManaBoltSmall2.cs index db5781dd73..66162cb947 100644 --- a/Projectiles/Magic/ManaBoltSmall2.cs +++ b/Projectiles/Magic/ManaBoltSmall2.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; projectile.velocity.X *= 0.975f; projectile.velocity.Y *= 0.975f; - if (Main.rand.NextBool(2)) + if (projectile.timeLeft % 4 == 0) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 9f58a84dfc..ced7da82de 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +23,6 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 60; projectile.alpha = 255; projectile.friendly = true; - projectile.aiStyle = 71; projectile.magic = true; projectile.penetrate = -1; projectile.timeLeft = 600; @@ -31,6 +31,96 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = true; } + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) + { + int num = 6; + for (int index1 = 0; index1 < num; ++index1) + { + Vector2 vector2_1 = (Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width, (float)projectile.height) / 2f).RotatedBy((double)(index1 - (num / 2 - 1)) * Math.PI / (double)num, new Vector2()) + projectile.Center; + Vector2 vector2_2 = ((Main.rand.NextFloat() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int index2 = Dust.NewDust(vector2_1 + vector2_2, 0, 0, 217, vector2_2.X * 2f, vector2_2.Y * 2f, 100, new Color(), 1.4f); + Dust dust = Main.dust[index2]; + dust.noGravity = true; + dust.noLight = true; + dust.velocity /= 4f; + dust.velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 50) + projectile.alpha = 50; + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[1] / 3f) % 3; + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.1f, 0.4f, 0.6f); + } + int num1 = -1; + Vector2 vector2 = projectile.Center; + float num2 = 500f; + Vector2 value = new Vector2(0.5f); + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) + { + for (int index = 0; index < Main.maxNPCs; ++index) + { + NPC npc = Main.npc[index]; + if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (index + 1f))) + { + Vector2 center = npc.position + npc.Size * value; + float num3 = Vector2.Distance(center, vector2); + if (num3 < num2 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num2 = num3; + vector2 = center; + num1 = index; + } + } + } + if (num1 >= 0) + { + projectile.ai[0] = num1 + 1f; + projectile.netUpdate = true; + } + } + if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) + projectile.localAI[0] = 30f; + bool flag = false; + if (projectile.ai[0] != 0f) + { + int index = (int)(projectile.ai[0] - 1); + if (Main.npc[index].active && !Main.npc[index].dontTakeDamage && Main.npc[index].immune[projectile.owner] == 0) + { + if ((Math.Abs(projectile.Center.X - Main.npc[index].Center.X) + Math.Abs(projectile.Center.Y - Main.npc[index].Center.Y)) < 1000f) + { + flag = true; + vector2 = Main.npc[index].Center; + } + } + else + { + projectile.ai[0] = 0f; + flag = false; + projectile.netUpdate = true; + } + } + if (flag) + { + double num3 = (double)(vector2 - projectile.Center).ToRotation() - (double)projectile.velocity.ToRotation(); + if (num3 > Math.PI) + num3 -= 2.0 * Math.PI; + if (num3 < -1.0 * Math.PI) + num3 += 2.0 * Math.PI; + projectile.velocity = projectile.velocity.RotatedBy(num3 * 0.1, new Vector2()); + } + float num4 = projectile.velocity.Length(); + projectile.velocity.Normalize(); + projectile.velocity = projectile.velocity * (num4 + 1f / 400f); + } + public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 12d74eaff4..3ed0304e57 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -88,14 +88,14 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + target.AddBuff(ModContent.BuffType(), 120); + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } Player player = Main.player[projectile.owner]; player.statLife += 1; player.HealEffect(1); - target.AddBuff(ModContent.BuffType(), 120); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Magic/SubsumingTentacle.cs b/Projectiles/Magic/SubsumingTentacle.cs new file mode 100644 index 0000000000..bf66907557 --- /dev/null +++ b/Projectiles/Magic/SubsumingTentacle.cs @@ -0,0 +1,160 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class SubsumingTentacle : ModProjectile + { + public int AlphaFade + { + get => (int)projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + public Vector2 OffsetAcceleration + { + get => new Vector2(projectile.ai[0], projectile.ai[1]); + set + { + projectile.ai[0] = value.X; + projectile.ai[1] = value.Y; + } + } + public const float SegmentOffset = 5f; + public const float MaxArcingSpeed = 16f; + public const float MaxHomingSpeed = 18f; + public const float MaxEnemyDistance = 1450f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Tentacle"); + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 75; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.MaxUpdates = 2; + projectile.magic = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 16; + } + + public override void AI() + { + if (!projectile.tileCollide) + { + AlphaFade++; + projectile.alpha = AlphaFade; + if (projectile.alpha >= 255) + { + projectile.Kill(); + return; + } + } + // Here, the old positions act more like "control points" than old postions, and will be referred as such henceforth. + // Each control point should have a set offset, to give a "chain" effect. + for (int i = 1; i < projectile.oldPos.Length; i++) + { + projectile.oldPos[i] = projectile.oldPos[i - 1] + Vector2.Normalize(projectile.oldPos[i] - projectile.oldPos[i - 1]) * SegmentOffset; + } + CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(20f * projectile.scale)); + if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height) && projectile.tileCollide) + { + projectile.tileCollide = false; + } + + NPC closestTarget = projectile.Center.ClosestNPCAt(MaxEnemyDistance, true); + if (closestTarget != null) + { + HomingMovement(closestTarget); + } + else + { + ArcingMovement(); + } + projectile.scale -= closestTarget == null ? 0.007f : 0.004f; + if (projectile.scale <= 0.05f) + { + projectile.Kill(); + } + } + public void ArcingMovement() + { + // Cause the tentacle to arc around at an increasingly fast rate. + projectile.velocity += OffsetAcceleration; + if (projectile.velocity.Length() > MaxArcingSpeed) + { + projectile.velocity.Normalize(); + projectile.velocity *= MaxArcingSpeed; + } + + // Accelerate the arc. + OffsetAcceleration *= 1.035f; + } + public void HomingMovement(NPC closestTarget) + { + float angleOffset = MathHelper.WrapAngle(projectile.AngleTo(closestTarget.Center) - projectile.velocity.ToRotation()); + angleOffset = MathHelper.Clamp(angleOffset, -0.2f, 0.2f); + + if (projectile.Distance(closestTarget.Center) > 65f) + { + projectile.velocity = projectile.velocity.RotatedBy(angleOffset); + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * MaxHomingSpeed; + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + + if (projectile.scale < 1f) + { + for (int i = 10; i < projectile.oldPos.Length; i++) + { + var tentacleShader = GameShaders.Misc["CalamityMod:SubsumingTentacle"]; + tentacleShader.UseImage("Images/Misc/Perlin"); + + Vector2 drawPos = projectile.oldPos[i] + ModContent.GetTexture(Texture).Size() / 2f - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY; + float scale = MathHelper.Lerp(0.05f, 1.3f, i / (float)projectile.oldPos.Length) * projectile.scale; + scale = MathHelper.Clamp(scale, 0f, 2f); + Color color = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - i) / projectile.oldPos.Length); + + spriteBatch.Draw(ModContent.GetTexture(Texture), drawPos, null, color, projectile.rotation, ModContent.GetTexture(Texture).Size() / 2f, scale, SpriteEffects.None, 0f); + tentacleShader.UseSaturation(i / (float)projectile.oldPos.Length); // A "completion ratio" for the shader. Used to make the entire tentacle appear multi-colored. + tentacleShader.UseOpacity(1f / projectile.oldPos.Length); // A "step value" for the shader. Used to give variance in color at each individual segment. + tentacleShader.Apply(null); + } + } + return false; + } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + for (int i = 1; i < projectile.oldPos.Length; i++) + { + float scale = MathHelper.Lerp(0.05f, 1f, i / (float)projectile.oldPos.Length) * projectile.scale * 0.85f; + if (targetHitbox.Intersects(new Rectangle((int)projectile.oldPos[i].X, (int)projectile.oldPos[i].Y, (int)(projectile.width * scale), (int)(projectile.height * scale)))) + return true; + } + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.velocity = oldVelocity; + return false; + } + } +} diff --git a/Projectiles/Magic/SubsumingTentacle.png b/Projectiles/Magic/SubsumingTentacle.png new file mode 100644 index 0000000000..c6b3592c9f Binary files /dev/null and b/Projectiles/Magic/SubsumingTentacle.png differ diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index 894d789415..e695566dc5 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index 1f522fd091..86462050c7 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -2,7 +2,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,9 +9,28 @@ namespace CalamityMod.Projectiles.Magic { public class Vortex : ModProjectile { + public float TargetCheckCooldown + { + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + public float Time + { + get => projectile.localAI[1]; + set => projectile.localAI[1] = value; + } + public int TargetIndex + { + get => (int)projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const float AngularMovementSpeed = 0.1f; + public const float Acceleration = 0.0025f; + public const float TargetCheckInterval = 30f; + public const float MaximumTargetDistance = 1200f; public override void SetStaticDefaults() { - DisplayName.SetDefault("Vortex"); + DisplayName.SetDefault("Subsuming Vortex"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -24,10 +42,10 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 10; - projectile.timeLeft = 300; + projectile.penetrate = 1; projectile.tileCollide = true; projectile.extraUpdates = 4; + projectile.timeLeft = 115 * projectile.extraUpdates; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; @@ -35,119 +53,98 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[1] += 1f; + // At the very beginning, start without a target. + if (Time == 0f) + { + TargetIndex = -1; + } + Time++; if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) { - int num713 = 5; - for (int num714 = 0; num714 < num713; num714++) - { - Vector2 vector58 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width, (float)projectile.height) / 2f; - vector58 = vector58.RotatedBy((double)(num714 - (num713 / 2 - 1)) * 3.1415926535897931 / (double)(float)num713, default) + projectile.Center; - Vector2 value25 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); - int num715 = Dust.NewDust(vector58 + value25, 0, 0, 66, value25.X * 2f, value25.Y * 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.7f); - Main.dust[num715].noGravity = true; - Main.dust[num715].noLight = true; - Main.dust[num715].velocity /= 4f; - Main.dust[num715].velocity -= projectile.velocity; - } - projectile.alpha -= 5; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - projectile.rotation += projectile.velocity.X * 0.1f; - Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); + VisualEffects(); } - int num716 = -1; - Vector2 vector59 = projectile.Center; - float num717 = 350f * projectile.ai[1]; - if (projectile.localAI[0] > 0f) - { - projectile.localAI[0] -= 1f; - } - if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) - { - for (int num718 = 0; num718 < 200; num718++) - { - NPC nPC6 = Main.npc[num718]; - if (nPC6.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(num718 + 1))) - { - Vector2 center4 = nPC6.Center; - float num719 = Vector2.Distance(center4, vector59); - if (num719 < num717 && Collision.CanHit(projectile.position, projectile.width, projectile.height, nPC6.position, nPC6.width, nPC6.height)) - { - num717 = num719; - vector59 = center4; - num716 = num718; - } - } - } - if (num716 >= 0) - { - projectile.ai[0] = (float)(num716 + 1); - projectile.netUpdate = true; - } - } - if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) - { - projectile.localAI[0] = 30f; - } - bool flag32 = false; - if (projectile.ai[0] != 0f) - { - int num720 = (int)(projectile.ai[0] - 1f); - if (Main.npc[num720].active && !Main.npc[num720].dontTakeDamage && Main.npc[num720].immune[projectile.owner] == 0) - { - float num721 = Main.npc[num720].position.X + (float)(Main.npc[num720].width / 2); - float num722 = Main.npc[num720].position.Y + (float)(Main.npc[num720].height / 2); - float num723 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num721) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num722); - if (num723 < 1000f) - { - flag32 = true; - vector59 = Main.npc[num720].Center; - } - } - else - { - projectile.ai[0] = 0f; - flag32 = false; - projectile.netUpdate = true; - } - } - if (flag32) - { - Vector2 v = vector59 - projectile.Center; - float num724 = projectile.velocity.ToRotation(); - float num725 = v.ToRotation(); - float num726 = num725 - num724; - num726 = MathHelper.WrapAngle(num726); - projectile.velocity = projectile.velocity.RotatedBy(num726 * 0.1, default); - } - float num727 = projectile.velocity.Length(); - projectile.velocity.Normalize(); - projectile.velocity *= num727 + 0.0025f; + Movement(HandleTargeting()); + projectile.rotation += projectile.velocity.X * 0.1f; } - public override bool OnTileCollide(Vector2 oldVelocity) + public bool HandleTargeting() { - projectile.penetrate--; - if (projectile.penetrate <= 0) + float targetCheckDistance = 350f * projectile.ai[1]; + + // Reduce a cooldown. Nothing special here. + if (TargetCheckCooldown > 0f) { - projectile.Kill(); + TargetCheckCooldown--; } - else + + // Attempt to find a target if the projectile has none. + if (TargetIndex == -1 && TargetCheckCooldown <= 0f) { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) + NPC potentialTarget = projectile.Center.ClosestNPCAt(targetCheckDistance, true); + if (potentialTarget != null) + TargetIndex = potentialTarget.whoAmI; + projectile.netUpdate = true; + } + if (TargetCheckCooldown <= 0f && TargetIndex == -1) + { + TargetCheckCooldown = TargetCheckInterval; + } + bool stillCanReachTarget = false; + // Ensure that the target is still in reach if there is indeed a target. + if (TargetIndex != -1) + { + stillCanReachTarget = projectile.Distance(Main.npc[TargetIndex].Center) < MaximumTargetDistance; + if (!stillCanReachTarget) { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; + TargetIndex = -1; + projectile.netUpdate = true; } } - return false; + return stillCanReachTarget; + } + + public void VisualEffects() + { + // Generate idle circular dust and light after 10 frames. + if (!Main.dedServ) + { + int dustCount = 5; + for (int i = 0; i < dustCount; i++) + { + Vector2 spawnPosition = projectile.Center + projectile.Size.RotatedBy(i / (float)dustCount * MathHelper.TwoPi) * 0.5f; + Vector2 velocity = Main.rand.NextFloat(MathHelper.TwoPi).ToRotationVector2() * Main.rand.NextFloat(6f, 16f); + Dust dust = Dust.NewDustPerfect(spawnPosition, 66, velocity, 0, Main.DiscoColor, 0.7f); + dust.noGravity = true; + dust.noLight = true; + dust.velocity = -projectile.velocity; + } + } + // Fade in. + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + // And make rainbow light. + Lighting.AddLight(projectile.Center / 16, Main.DiscoColor.ToVector3()); + } + + public void Movement(bool stillCanReachTarget) + { + // Homing sharply towards the target in a circular fashion. + // The way this type of homing is by determining the offset between the angle to the target and the velocity's angle. + // This offset can be thought of as how much, in radians, the velocity would need to rotate to move towards the target. + // Then, the velocity is rotated by that offset (which, as established, would give perfect homing) multiplied by a <1 factor. + // This causes the velocity to constantly rotate sharply towards the target. + if (stillCanReachTarget) + { + float angleOffsetToTarget = projectile.AngleTo(Main.npc[TargetIndex].Center) - projectile.velocity.ToRotation(); + angleOffsetToTarget = MathHelper.WrapAngle(angleOffsetToTarget); // Ensure the offset is in the range of -pi to pi. + projectile.velocity = projectile.velocity.RotatedBy(angleOffsetToTarget * AngularMovementSpeed); + } + // Accelerate constantly with time. + float oldSpeed = projectile.velocity.Length(); + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * (oldSpeed + Acceleration); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Magic/Vortex.png b/Projectiles/Magic/Vortex.png index cbcf617436..fd7e0bf39c 100644 Binary files a/Projectiles/Magic/Vortex.png and b/Projectiles/Magic/Vortex.png differ diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index c092e1101d..ce6818f4bd 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 4, false); + CalamityUtils.ModifyHitNPCSticky(projectile, 3, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index b160e1f524..663a68b5f1 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -40,6 +40,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Player player = Main.player[projectile.owner]; + if (player.moonLeech) + return; player.statLife += 5; player.HealEffect(5); } diff --git a/Projectiles/Melee/BloodScythe.png b/Projectiles/Melee/BloodScythe.png index ee0bbd4d2b..92f9025e5d 100644 Binary files a/Projectiles/Melee/BloodScythe.png and b/Projectiles/Melee/BloodScythe.png differ diff --git a/Projectiles/Melee/DemonBlast.cs b/Projectiles/Melee/DemonBlast.cs index 9b25213bf0..6cf91d18e7 100644 --- a/Projectiles/Melee/DemonBlast.cs +++ b/Projectiles/Melee/DemonBlast.cs @@ -1,4 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,46 +14,52 @@ namespace CalamityMod.Projectiles.Melee { public override void SetStaticDefaults() { - DisplayName.SetDefault("Blast"); + DisplayName.SetDefault("Devil Fork"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 30; + projectile.height = 30; projectile.friendly = true; - projectile.aiStyle = 1; projectile.penetrate = -1; projectile.extraUpdates = 5; projectile.tileCollide = false; projectile.melee = true; + projectile.alpha = 180; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.timeLeft = 300; } public override void AI() { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 173, + (int)CalamityDusts.Brimstone, + 172 + }); if (projectile.position.HasNaNs()) { projectile.Kill(); return; } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) + bool tileCheck = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f)]; + dust.position = projectile.Center; + dust.velocity = Vector2.Zero; + dust.noGravity = true; + if (tileCheck) { - dust6.noLight = true; + dust.noLight = true; } if (projectile.ai[1] == -1f) { projectile.ai[0] += 1f; projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; projectile.penetrate = -1; projectile.position = projectile.Center; projectile.width = projectile.height = 140; @@ -58,36 +69,32 @@ namespace CalamityMod.Projectiles.Melee { projectile.alpha = 0; } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) + if (projectile.ai[0] >= projectile.MaxUpdates * 3) { projectile.Kill(); } return; } - projectile.alpha = 255; + else + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45); if (projectile.numUpdates == 0) { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) + int targetIndex = -1; + float detectRange = 60f; + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false)) { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) + float npcDist = projectile.Distance(npc.Center); + if (npcDist < detectRange && Collision.CanHitLine(projectile.Center, 0, 0, npc.Center, 0, 0)) { - num159 = num161; - num158 = num160; + detectRange = npcDist; + targetIndex = npcIndex; } } } - if (num158 != -1) + if (targetIndex != -1) { projectile.ai[0] = 0f; projectile.ai[1] = -1f; @@ -98,34 +105,57 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); + Main.PlaySound(SoundID.Item14, projectile.position); + bool tileCheck = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); for (int m = 0; m < 4; m++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 173, + (int)CalamityDusts.Brimstone, + 172 + }); + Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.5f); } for (int n = 0; n < 4; n++) { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 173, + (int)CalamityDusts.Brimstone, + 172 + }); + int dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + Main.dust[dustInt].noGravity = true; + Main.dust[dustInt].velocity *= 3f; + if (tileCheck) { - Main.dust[num10].noLight = true; + Main.dust[dustInt].noLight = true; } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) + dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1.5f); + Main.dust[dustInt].velocity *= 2f; + Main.dust[dustInt].noGravity = true; + if (tileCheck) { - Main.dust[num10].noLight = true; + Main.dust[dustInt].noLight = true; } } } + //glowmask effect + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.ShadowFlame, 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 120); projectile.Kill(); } } diff --git a/Projectiles/Melee/DemonBlast.png b/Projectiles/Melee/DemonBlast.png index ead80128fa..7cdcec7ec6 100644 Binary files a/Projectiles/Melee/DemonBlast.png and b/Projectiles/Melee/DemonBlast.png differ diff --git a/Projectiles/Melee/DemonBlastType2.cs b/Projectiles/Melee/DemonBlastType2.cs deleted file mode 100644 index a89979647f..0000000000 --- a/Projectiles/Melee/DemonBlastType2.cs +++ /dev/null @@ -1,132 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class DemonBlastType2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = projectile.height = 140; - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - projectile.Kill(); - } - } -} diff --git a/Projectiles/Melee/DemonBlastType2.png b/Projectiles/Melee/DemonBlastType2.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Melee/DemonBlastType2.png and /dev/null differ diff --git a/Projectiles/Melee/DemonBlastType3.cs b/Projectiles/Melee/DemonBlastType3.cs deleted file mode 100644 index fafa0292f9..0000000000 --- a/Projectiles/Melee/DemonBlastType3.cs +++ /dev/null @@ -1,131 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class DemonBlastType3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.aiStyle = 1; - projectile.penetrate = 1; - projectile.extraUpdates = 5; - projectile.tileCollide = false; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] != -1f && projectile.position.Y > projectile.ai[1]) - { - projectile.tileCollide = true; - } - if (projectile.position.HasNaNs()) - { - projectile.Kill(); - return; - } - bool flag5 = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - Dust dust6 = Main.dust[Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default, 1f)]; - dust6.position = projectile.Center; - dust6.velocity = Vector2.Zero; - dust6.noGravity = true; - if (flag5) - { - dust6.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.position = projectile.Center; - projectile.width = projectile.height = 140; - projectile.Center = projectile.position; - projectile.alpha -= 10; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (++projectile.frameCounter >= projectile.MaxUpdates * 3) - { - projectile.frameCounter = 0; - projectile.frame++; - } - if (projectile.ai[0] >= (float)(Main.projFrames[projectile.type] * projectile.MaxUpdates * 3)) - { - projectile.Kill(); - } - return; - } - projectile.alpha = 255; - if (projectile.numUpdates == 0) - { - int num158 = -1; - float num159 = 60f; - for (int num160 = 0; num160 < 200; num160++) - { - NPC nPC = Main.npc[num160]; - if (nPC.CanBeChasedBy(projectile, false)) - { - float num161 = projectile.Distance(nPC.Center); - if (num161 < num159 && Collision.CanHitLine(projectile.Center, 0, 0, nPC.Center, 0, 0)) - { - num159 = num161; - num158 = num160; - } - } - } - if (num158 != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.position.X / 16, (int)projectile.position.Y / 16)); - for (int m = 0; m < 4; m++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default, 1.5f); - } - for (int n = 0; n < 4; n++) - { - int num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 0, default, 2.5f); - Main.dust[num10].noGravity = true; - Main.dust[num10].velocity *= 3f; - if (flag) - { - Main.dust[num10].noLight = true; - } - num10 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 172, 0f, 0f, 100, default, 1.5f); - Main.dust[num10].velocity *= 2f; - Main.dust[num10].noGravity = true; - if (flag) - { - Main.dust[num10].noLight = true; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - projectile.Kill(); - } - } -} diff --git a/Projectiles/Melee/DemonBlastType3.png b/Projectiles/Melee/DemonBlastType3.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Melee/DemonBlastType3.png and /dev/null differ diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index 9e418aff11..09c3cc73b8 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; + projectile.width = 46; + projectile.height = 46; projectile.aiStyle = 18; projectile.alpha = 100; projectile.friendly = true; diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.png b/Projectiles/Melee/ForbiddenOathbladeProjectile.png index e594d983b1..d453f1565e 100644 Binary files a/Projectiles/Melee/ForbiddenOathbladeProjectile.png and b/Projectiles/Melee/ForbiddenOathbladeProjectile.png differ diff --git a/Projectiles/Melee/Leech.cs b/Projectiles/Melee/Leech.cs index 805c041da9..325f29c3f6 100644 --- a/Projectiles/Melee/Leech.cs +++ b/Projectiles/Melee/Leech.cs @@ -47,6 +47,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + if (Main.player[projectile.owner].moonLeech) + return; Player player = Main.player[projectile.owner]; player.statLife += 5; player.HealEffect(5); diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index 416d3324ae..3f9cc6b921 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; + projectile.width = 58; + projectile.height = 58; projectile.aiStyle = 18; projectile.alpha = 100; projectile.friendly = true; diff --git a/Projectiles/Melee/Oathblade.png b/Projectiles/Melee/Oathblade.png index e594d983b1..2fc599ea4b 100644 Binary files a/Projectiles/Melee/Oathblade.png and b/Projectiles/Melee/Oathblade.png differ diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index a9e3c93132..30895a8a21 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; Player player = Main.player[projectile.owner]; diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 1d16adb747..7b1063d648 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 4; projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 5.5f; @@ -34,8 +34,8 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 1.1f; public override Action EffectBeforeReelback => (proj) => { - int damage = Nadir.BaseDamage / 5; - float kb = 5.5f; + int damage = projectile.damage / 4; + float kb = projectile.knockBack * 0.5f; Vector2 projPos = projectile.Center + projectile.velocity; Vector2 projVel = projectile.velocity * 0.75f; if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/VoidEssence.cs b/Projectiles/Melee/VoidEssence.cs index c8d3d72553..aedeb96684 100644 --- a/Projectiles/Melee/VoidEssence.cs +++ b/Projectiles/Melee/VoidEssence.cs @@ -193,8 +193,8 @@ namespace CalamityMod.Projectiles.Melee private void SpawnTentacle(Vector2 tentacleVelocity) { - int damage = Nadir.BaseDamage; - float kb = 7f; + int damage = projectile.damage; + float kb = projectile.knockBack; // Randomize tentacle behavior variables float ai0 = Main.rand.NextFloat(0.01f, 0.08f); diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index c9972ca647..60e5346fbf 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; Player player = Main.player[projectile.owner]; if (Main.rand.NextBool(5)) diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index aae7dae614..aa189fdafe 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 3; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index 5c0f7837e8..37724b66e1 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.myPlayer == projectile.owner) if (projectile.Hitbox.Intersects(player.Hitbox)) { - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(3) && !Main.player[projectile.owner].moonLeech) { player.statLife += 1; player.HealEffect(1); @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 360); target.AddBuff(ModContent.BuffType(), 360); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index a3066f1645..9792dfcd11 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -80,7 +80,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + target.AddBuff(ModContent.BuffType(), 360); + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } @@ -90,7 +91,6 @@ namespace CalamityMod.Projectiles.Ranged player.statLife += 1; player.HealEffect(1); } - target.AddBuff(ModContent.BuffType(), 360); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/BloodfireBullet.cs b/Projectiles/Ranged/BloodfireBullet.cs index bd200a4560..e7c2b5542b 100644 --- a/Projectiles/Ranged/BloodfireBullet.cs +++ b/Projectiles/Ranged/BloodfireBullet.cs @@ -52,7 +52,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + target.AddBuff(ModContent.BuffType(), 360); + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } @@ -62,7 +63,6 @@ namespace CalamityMod.Projectiles.Ranged player.statLife += 1; player.HealEffect(1); } - target.AddBuff(ModContent.BuffType(), 360); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/ButcherGun.cs b/Projectiles/Ranged/ButcherGun.cs index f5e40a58fb..a52885e739 100644 --- a/Projectiles/Ranged/ButcherGun.cs +++ b/Projectiles/Ranged/ButcherGun.cs @@ -27,120 +27,112 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } projectile.ai[0] += 1f; - int num39 = 0; + int incrementAmt = 0; float spreadMult = 0.15f; if (projectile.ai[0] >= 90f) { - num39++; + incrementAmt++; spreadMult = 0.13f; } if (projectile.ai[0] >= 180f) { - num39++; + incrementAmt++; spreadMult = 0.11f; } if (projectile.ai[0] >= 270f) { - num39++; + incrementAmt++; spreadMult = 0.09f; } if (projectile.ai[0] >= 360f) { - num39++; + incrementAmt++; spreadMult = 0.07f; } if (projectile.ai[0] >= 450f) { - num39++; spreadMult = 0.05f; } if (projectile.ai[0] >= 540f) { - num39++; + incrementAmt++; spreadMult = 0.04f; } if (projectile.ai[0] >= 630f) { - num39++; spreadMult = 0.03f; } if (projectile.ai[0] >= 720f) //8 { - num39++; + incrementAmt++; spreadMult = 0.02f; } - int num40 = 40; - int num41 = 3; + int shootDelayBase = 40; + int incrementMult = 3; projectile.ai[1] -= 1f; - bool flag15 = false; + bool willShoot = false; if (projectile.ai[1] <= 0f) { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; + projectile.ai[1] = (float)(shootDelayBase - incrementMult * incrementAmt); + willShoot = true; } - bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; + bool canShoot = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; } - if (projectile.soundDelay <= 0 && flag16) + if (projectile.soundDelay <= 0 && canShoot) { - projectile.soundDelay = num40 - num41 * num39; + projectile.soundDelay = shootDelayBase - incrementMult * incrementAmt; if (projectile.ai[0] != 1f) { Main.PlaySound(SoundID.Item38, projectile.position); } projectile.localAI[0] = 12f; } - if (flag15 && Main.myPlayer == projectile.owner) + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + if (willShoot && Main.myPlayer == projectile.owner) { - int num42 = 14; - float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); - float weaponKnockback2 = player.ActiveItem().knockBack; - if (flag16) + int projType = ProjectileID.Bullet; + float speedMult = 14f; + int damage = player.GetWeaponDamage(player.ActiveItem()); + float kback = player.ActiveItem().knockBack; + if (canShoot) { - player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); - weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); - float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult, ref canShoot, ref damage, ref kback, false); + kback = player.GetWeaponKnockback(player.ActiveItem(), kback); + float speed = player.ActiveItem().shootSpeed * projectile.scale; + Vector2 targetPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source; if (player.gravDir == -1f) { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + targetPos.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - source.Y; } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + Vector2 velMult = Vector2.Normalize(targetPos); + if (float.IsNaN(velMult.X) || float.IsNaN(velMult.Y)) { - value19 = -Vector2.UnitY; + velMult = -Vector2.UnitY; } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + velMult *= speed; + if (velMult.X != projectile.velocity.X || velMult.Y != projectile.velocity.Y) { projectile.netUpdate = true; } - projectile.velocity = value19 * 0.55f; - int randomBulletCount = Main.rand.Next(3, 5); - for (int num43 = 0; num43 < randomBulletCount; num43++) + projectile.velocity = velMult * 0.55f; + int randomBulletCount = Main.rand.Next(3, 5); //3 to 4 bullets + for (int projIndex = 0; projIndex < randomBulletCount; projIndex++) { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * spreadMult); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + Vector2 bulletVel = Vector2.Normalize(projectile.velocity) * speedMult * (0.6f + Main.rand.NextFloat() * spreadMult); + if (float.IsNaN(bulletVel.X) || float.IsNaN(bulletVel.Y)) { - vector20 = -Vector2.UnitY; + bulletVel = -Vector2.UnitY; } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -5f, 5f); - vector20.X += (float)Main.rand.Next(-15, 16) * spreadMult; - vector20.Y += (float)Main.rand.Next(-15, 16) * spreadMult; - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + source += Utils.RandomVector2(Main.rand, -5f, 5f); + bulletVel.X += (float)Main.rand.Next(-15, 16) * spreadMult; + bulletVel.Y += (float)Main.rand.Next(-15, 16) * spreadMult; + int num44 = Projectile.NewProjectile(source, bulletVel, projType, damage, kback, projectile.owner, 0f, 0f); Main.projectile[num44].noDropItem = true; - Main.projectile[num44].extraUpdates += num39 / 2; //0 to 4 + Main.projectile[num44].extraUpdates += incrementAmt / 2; //0 to 4 } } else @@ -149,7 +141,12 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; + float rotationAmt = 0f; + if (projectile.spriteDirection == -1) + { + rotationAmt = MathHelper.Pi; + } + projectile.rotation = projectile.velocity.ToRotation() + rotationAmt; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; player.ChangeDir(projectile.direction); diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index f023af6d53..c6bbcce245 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -60,11 +60,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 360); - if (target.type == NPCID.TargetDummy) + Player player = Main.player[projectile.owner]; + if (target.type == NPCID.TargetDummy || player.moonLeech) { return; } - Player player = Main.player[projectile.owner]; player.statLife += 1; player.HealEffect(1); } diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index aeb75bfddd..e93fc94851 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.45), 0f, projectile.owner, 0f, 0f); } } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 118); diff --git a/Projectiles/Ranged/DualpoonProj.cs b/Projectiles/Ranged/DualpoonProj.cs new file mode 100644 index 0000000000..d5ff61e800 --- /dev/null +++ b/Projectiles/Ranged/DualpoonProj.cs @@ -0,0 +1,98 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class DualpoonProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dualpoon"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.ranged = true; + projectile.extraUpdates = 0; + projectile.timeLeft = 300; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (player.dead) + { + projectile.Kill(); + return; + } + if (projectile.alpha == 0) + { + if (projectile.Center.X > player.Center.X) + { + player.ChangeDir(1); + } + else + { + player.ChangeDir(-1); + } + } + if (projectile.ai[0] == 0f) + { + projectile.extraUpdates = 0; + } + else + { + projectile.extraUpdates = 1; + } + Vector2 playerVector = player.Center - projectile.Center; + float playerDist = playerVector.Length(); + if (projectile.ai[0] == 0f) + { + if (playerDist > 700f) + { + projectile.ai[0] = 1f; + } + else if (playerDist > 350f) + { + projectile.ai[0] = 1f; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; + projectile.ai[1] += 1f; + if (projectile.ai[1] > 5f) + { + projectile.alpha = 0; + } + if (projectile.ai[1] > 8f) + { + projectile.ai[1] = 8f; + } + if (projectile.ai[1] >= 10f) + { + projectile.ai[1] = 15f; + projectile.velocity.Y += 0.3f; + } + } + else if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + projectile.rotation = (float)Math.Atan2((double)playerVector.Y, (double)playerVector.X) - MathHelper.PiOver2; + float returnSpeed = 20f; + if (playerDist < 50f) + { + projectile.Kill(); + } + playerDist = returnSpeed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + projectile.velocity.X = playerVector.X; + projectile.velocity.Y = playerVector.Y; + } + } + } +} diff --git a/Projectiles/Ranged/DualpoonProj.png b/Projectiles/Ranged/DualpoonProj.png new file mode 100644 index 0000000000..e3cad757f3 Binary files /dev/null and b/Projectiles/Ranged/DualpoonProj.png differ diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index b49155e52c..c9cadc1118 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,8 +9,7 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoFire : ModProjectile { - public bool speedXChoice = false; - public bool speedYChoice = false; + public bool ProducedAcceleration = false; public override void SetStaticDefaults() { @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 24; + projectile.height = 24; projectile.friendly = true; projectile.ignoreWater = true; projectile.ranged = true; @@ -27,22 +27,18 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 10; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - projectile.timeLeft = 300; + projectile.timeLeft = 180; } public override void AI() { float speedX = 1f; float speedY = 1f; - if (!speedXChoice) + if (!ProducedAcceleration) { speedX = Main.rand.NextBool(2) ? 1.03f : 0.97f; - speedXChoice = true; - } - if (!speedYChoice) - { - speedY = Main.rand.NextBool(2) ? 1.03f : 0.97f; - speedYChoice = true; + projectile.velocity *= Utils.RandomVector2(Main.rand, 0.97f, 1.03f); + ProducedAcceleration = true; } projectile.velocity.X *= speedX; projectile.velocity.X *= speedY; diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs new file mode 100644 index 0000000000..b86913a0af --- /dev/null +++ b/Projectiles/Ranged/ExoLight.cs @@ -0,0 +1,100 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoLight : ModProjectile + { + public float OffsetSpeed + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float OffsetRotation + { + get => projectile.ai[1]; + set => projectile.ai[1] = value; + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light"); + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.timeLeft = 180; + } + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + OffsetRotation = Main.rand.NextFloat(MathHelper.TwoPi); + OffsetSpeed = Main.rand.NextFloat(MathHelper.ToRadians(2.5f), MathHelper.ToRadians(4f)) * Main.rand.NextBool(2).ToDirectionInt(); + projectile.localAI[0] = 1f; + } + Projectile owner = Main.projectile[(int)projectile.localAI[1]]; + + // Ensure the owner is the correct projectile. + if (owner.type != ModContent.ProjectileType()) + projectile.Kill(); + + // Movement around the owner. + projectile.Center = owner.Center + OffsetRotation.ToRotationVector2() * (float)Math.Cos(OffsetRotation * 0.3f) * owner.Size * 0.5f; + projectile.rotation = (projectile.position - projectile.oldPos[1]).ToRotation(); + OffsetRotation += OffsetSpeed; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D lightTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/PhotovisceratorLight"); + for (int i = 0; i < projectile.oldPos.Length; i++) + { + float colorInterpolation = (float)Math.Cos(projectile.timeLeft / 16f + Main.GlobalTime / 20f + i / (float)projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + Color color = Color.Lerp(Color.LightGreen, Color.LightPink, colorInterpolation) * 0.4f; + color.A = 0; + Vector2 drawPosition = projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Color outerColor = color; + Color innerColor = color * 0.5f; + float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTime % 60f * MathHelper.TwoPi); + + // Become smaller the futher along the old positions we are. + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)projectile.oldPos.Length); + + Vector2 outerScale = new Vector2(1.65f) * intensity; + Vector2 innerScale = new Vector2(1.65f) * intensity * 0.7f; + outerColor *= intensity; + innerColor *= intensity; + spriteBatch.Draw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.6f, SpriteEffects.None, 0); + spriteBatch.Draw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.6f, SpriteEffects.None, 0); + } + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.CursedInferno, 180); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.Ichor, 180); + } + } +} diff --git a/Projectiles/Ranged/ExoLight.png b/Projectiles/Ranged/ExoLight.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/Ranged/ExoLight.png differ diff --git a/Projectiles/Ranged/ExoLightBomb.cs b/Projectiles/Ranged/ExoLightBomb.cs new file mode 100644 index 0000000000..8a0eefce83 --- /dev/null +++ b/Projectiles/Ranged/ExoLightBomb.cs @@ -0,0 +1,184 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoLightBomb : ModProjectile + { + public Vector2 InitialCenter; + public Vector2 Destination; + public const float MaxRadius = 90f; + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public int DustType + { + get => (int)projectile.ai[1]; + set => projectile.ai[1] = value; + } + public float YDirection + { + get => projectile.localAI[1]; + set => projectile.localAI[1] = value; + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Light"); + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 40; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.alpha = 127; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(YDirection); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + YDirection = reader.ReadSingle(); + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.DarkSlateGray.ToVector3()); + projectile.alpha = (int)MathHelper.Lerp(255, 127, Utils.InverseLerp(0f, 25f, Time, true)); + projectile.scale = MathHelper.Lerp(0.001f, 1f, Utils.InverseLerp(0f, 25f, Time, true)); + if (projectile.localAI[0] == 0f) + { + InitialCenter = projectile.Center; + Destination = Main.MouseWorld; + DustType = Main.rand.NextBool(2) ? 107 : 234; + if (Main.rand.NextBool(4)) + { + DustType = 269; + } + projectile.localAI[0] = 1f; + } + if (Time <= 90f) + { + projectile.position = Vector2.Lerp(InitialCenter, Destination, Time / 90f); + projectile.position.Y += (float)Math.Sin(Time / 90f * MathHelper.TwoPi) * 75f; + } + else if (Time < 180f) + { + // For those who haven't seen this yet (namely in the 1.4 source), this allows you to achieve a + // fade-in and fade-out effect with relative ease. At 90, multiply by 0, and somewhere in-between until 115, where you multiply by 1. + // And then do the same for the fade-out effect of 180f-165. These inverse linear interpolations cannot overlap by definition because + // their ranges do not overlap. Overall a really cool trick. + float radius = MaxRadius * Utils.InverseLerp(90f, 115f, Time, true) * Utils.InverseLerp(180f, 165f, Time, true); + radius *= 1f + (float)Math.Cos(Main.GlobalTime / 24f) * 0.25f; + if (radius < 5f) + radius = 5f; + projectile.Center = Destination + ((Time - 90) / 90f * MathHelper.ToRadians(720f) + (YDirection == -1).ToInt() * MathHelper.Pi).ToRotationVector2() * radius; + } + else if (Time == 180f) + { + projectile.Kill(); + } + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Time++; + } + + public void GenerateRotationalDust() + { + for (int i = 0; i < 9; i++) + { + float angle = Time / 45f + i / 9f * MathHelper.TwoPi; + Vector2 offsetSpan = angle.ToRotationVector2() * projectile.Size * 0.65f * projectile.scale; + Vector2 edgePosition = projectile.Center + offsetSpan.RotatedBy(projectile.rotation); + Dust dust = Dust.NewDustPerfect(edgePosition + Main.rand.NextVector2Circular(4f, 4f), DustType); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.scale = 0.65f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return CalamityUtils.MulticolorLerp(Time / 60f % 1f, new Color[] + { + Color.PaleGreen, + Color.Violet, + Color.SlateGray + }) * projectile.Opacity; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D lightTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/PhotovisceratorLight"); + for (int i = 0; i < projectile.oldPos.Length; i++) + { + float colorInterpolation = (float)Math.Cos(projectile.timeLeft / 16f + Main.GlobalTime / 20f + i / (float)projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + Color color = CalamityUtils.MulticolorLerp(MathHelper.Clamp(colorInterpolation, 0f, 0.99f), new Color[] + { + Color.PaleGreen, + Color.Violet, + Color.SlateGray + }) * projectile.Opacity; + color.A = 0; + Vector2 drawPosition = projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); + Color outerColor = color; + Color innerColor = color * 0.5f; + float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTime % 60f * MathHelper.TwoPi); + + // Become smaller the futher along the old positions we are. + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)projectile.oldPos.Length); + + Vector2 outerScale = new Vector2(1.25f) * intensity; + Vector2 innerScale = new Vector2(1.25f) * intensity * 0.7f; + outerColor *= intensity * projectile.scale; + innerColor *= intensity * projectile.scale; + spriteBatch.Draw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.6f, SpriteEffects.None, 0); + spriteBatch.Draw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.6f, SpriteEffects.None, 0); + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item14, projectile.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 3; i++) + { + Projectile.NewProjectileDirect(projectile.Center, + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 16f, + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack * 0.3f, + projectile.owner); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.CursedInferno, 180); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.Ichor, 180); + } + } +} diff --git a/Projectiles/Ranged/ExoLightBomb.png b/Projectiles/Ranged/ExoLightBomb.png new file mode 100644 index 0000000000..67c615a142 Binary files /dev/null and b/Projectiles/Ranged/ExoLightBomb.png differ diff --git a/Projectiles/Ranged/ExoLightBurst.cs b/Projectiles/Ranged/ExoLightBurst.cs new file mode 100644 index 0000000000..b34a586853 --- /dev/null +++ b/Projectiles/Ranged/ExoLightBurst.cs @@ -0,0 +1,91 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoLightBurst : ModProjectile + { + public const float MinDistanceFromTarget = 45f; + public const float MaxDistanceFromTarget = 1350f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Flare"); + ProjectileID.Sets.NeedsUUID[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 190; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.timeLeft = 180; + } + public override void AI() + { + // localAI[0] is used by the sticky AI method. + if (projectile.localAI[1] == 0f) + { + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < 5; i++) + { + Projectile.NewProjectileDirect(projectile.Center, + Vector2.Zero, + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack, + projectile.owner).localAI[1] = Projectile.GetByUUID(projectile.owner, projectile.whoAmI); + } + } + projectile.localAI[1] = 1f; + } + if (projectile.ai[0] == 0f) + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxDistanceFromTarget, true); + if (potentialTarget != null) + { + if (projectile.Distance(potentialTarget.Center) > MinDistanceFromTarget) + { + float angleOffset = projectile.AngleTo(potentialTarget.Center) - projectile.velocity.ToRotation(); + angleOffset = MathHelper.WrapAngle(angleOffset); + projectile.velocity = projectile.velocity.RotatedBy(MathHelper.Clamp(angleOffset, -0.1f, 0.1f)); + } + } + } + CalamityUtils.StickyProjAI(projectile, 5); + } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + CalamityUtils.ModifyHitNPCSticky(projectile, 4, false); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + int width = (int)MathHelper.Max(targetHitbox.Width, 150); + int height = (int)MathHelper.Max(targetHitbox.Height, 150); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, width, height); + return null; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.CursedInferno, 180); + target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.Ichor, 180); + } + } +} diff --git a/Projectiles/Ranged/ExoLightBurst.png b/Projectiles/Ranged/ExoLightBurst.png new file mode 100644 index 0000000000..04c5646fde Binary files /dev/null and b/Projectiles/Ranged/ExoLightBurst.png differ diff --git a/Projectiles/Ranged/ExoSpark.cs b/Projectiles/Ranged/ExoSpark.cs new file mode 100644 index 0000000000..5f9aee48ff --- /dev/null +++ b/Projectiles/Ranged/ExoSpark.cs @@ -0,0 +1,84 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ExoSpark : ModProjectile + { + public static readonly int[] FrameToDustIDTable = new int[] + { + 107, + 234, + 269, + }; + public const float HomingInertia = 10f; + public const float MaxTargetDistance = 750f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Spark"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 14; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.frame = Main.rand.Next(3); + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxTargetDistance); + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * (HomingInertia - 1) + projectile.DirectionTo(potentialTarget.Center) * 16f) / HomingInertia; + } + projectile.rotation = projectile.velocity.ToRotation(); + if (!Main.dedServ) + { + GenerateCircularDust(); + } + } + + public void GenerateCircularDust() + { + for (int i = 0; i < 12; i++) + { + float angle = i / 12f * MathHelper.TwoPi; + Vector2 spawnPosition = projectile.Center + angle.ToRotationVector2().RotatedBy(projectile.rotation) * new Vector2(10f, 6f); + Dust dust = Dust.NewDustPerfect(spawnPosition, FrameToDustIDTable[projectile.frame]); + dust.velocity = Vector2.Zero; + dust.scale = 0.5f; + dust.noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } +} diff --git a/Projectiles/Ranged/ExoSpark.png b/Projectiles/Ranged/ExoSpark.png new file mode 100644 index 0000000000..eb696c6909 Binary files /dev/null and b/Projectiles/Ranged/ExoSpark.png differ diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index 3b338314f4..6a7754a0d9 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 140; - projectile.height = 44; + projectile.width = 152; + projectile.height = 58; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; diff --git a/Projectiles/Ranged/FlakKrakenGun.png b/Projectiles/Ranged/FlakKrakenGun.png index 88f490cdcd..1353a556b8 100644 Binary files a/Projectiles/Ranged/FlakKrakenGun.png and b/Projectiles/Ranged/FlakKrakenGun.png differ diff --git a/Projectiles/Ranged/FlakKrakenProj.cs b/Projectiles/Ranged/FlakKrakenProj.cs index f6e219a0ff..2c11a091fb 100644 --- a/Projectiles/Ranged/FlakKrakenProj.cs +++ b/Projectiles/Ranged/FlakKrakenProj.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; + projectile.width = 54; + projectile.height = 54; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; diff --git a/Projectiles/Ranged/FlakKrakenProj.png b/Projectiles/Ranged/FlakKrakenProj.png index b8303e5d68..ebffc498ad 100644 Binary files a/Projectiles/Ranged/FlakKrakenProj.png and b/Projectiles/Ranged/FlakKrakenProj.png differ diff --git a/Projectiles/Ranged/NeedlerProj.cs b/Projectiles/Ranged/NeedlerProj.cs index 6ad53995fa..d9d9fa4779 100644 --- a/Projectiles/Ranged/NeedlerProj.cs +++ b/Projectiles/Ranged/NeedlerProj.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -22,7 +23,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.extraUpdates = 2; projectile.aiStyle = 93; - aiType = 514; + aiType = ProjectileID.NailFriendly; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 1; } public override void AI() @@ -44,11 +47,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 1; - } - public override void Kill(int timeLeft) { projectile.position = projectile.Center; diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index d5d419f1e6..b91cefe529 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -58,39 +58,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 18f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index 9120c2ec8c..b6ba258d6d 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -20,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 90; } @@ -49,6 +50,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; projectile.Damage(); } } diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index fd7f0cefa0..ff994af960 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); } - if (target.type == NPCID.TargetDummy) + if (target.type == NPCID.TargetDummy || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Ranged/TriploonProj.cs b/Projectiles/Ranged/TriploonProj.cs index 8db99a6d9d..29ba994a5e 100644 --- a/Projectiles/Ranged/TriploonProj.cs +++ b/Projectiles/Ranged/TriploonProj.cs @@ -20,24 +20,26 @@ namespace CalamityMod.Projectiles.Ranged projectile.alpha = 255; projectile.ranged = true; projectile.extraUpdates = 0; + projectile.timeLeft = 300; } public override void AI() { - if (Main.player[projectile.owner].dead) + Player player = Main.player[projectile.owner]; + if (player.dead) { projectile.Kill(); return; } if (projectile.alpha == 0) { - if (projectile.position.X + (float)(projectile.width / 2) > Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2)) + if (projectile.Center.X > player.Center.X) { - Main.player[projectile.owner].ChangeDir(1); + player.ChangeDir(1); } else { - Main.player[projectile.owner].ChangeDir(-1); + player.ChangeDir(-1); } } if (projectile.ai[0] == 0f) @@ -48,21 +50,19 @@ namespace CalamityMod.Projectiles.Ranged { projectile.extraUpdates = 1; } - Vector2 vector14 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num166 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector14.X; - float num167 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector14.Y; - float num168 = (float)Math.Sqrt((double)(num166 * num166 + num167 * num167)); + Vector2 playerVector = player.Center - projectile.Center; + float playerDist = playerVector.Length(); if (projectile.ai[0] == 0f) { - if (num168 > 700f) + if (playerDist > 700f) { projectile.ai[0] = 1f; } - else if (num168 > 350f) + else if (playerDist > 350f) { projectile.ai[0] = 1f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; projectile.ai[1] += 1f; if (projectile.ai[1] > 5f) { @@ -75,23 +75,23 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.ai[1] >= 10f) { projectile.ai[1] = 15f; - projectile.velocity.Y = projectile.velocity.Y + 0.3f; + projectile.velocity.Y += 0.3f; } } else if (projectile.ai[0] == 1f) { projectile.tileCollide = false; - projectile.rotation = (float)Math.Atan2((double)num167, (double)num166) - 1.57f; - float num169 = 20f; - if (num168 < 50f) + projectile.rotation = (float)Math.Atan2((double)playerVector.Y, (double)playerVector.X) - MathHelper.PiOver2; + float returnSpeed = 20f; + if (playerDist < 50f) { projectile.Kill(); } - num168 = num169 / num168; - num166 *= num168; - num167 *= num168; - projectile.velocity.X = num166; - projectile.velocity.Y = num167; + playerDist = returnSpeed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + projectile.velocity.X = playerVector.X; + projectile.velocity.Y = playerVector.Y; } } } diff --git a/Projectiles/Ranged/TriploonProj.png b/Projectiles/Ranged/TriploonProj.png index e3cad757f3..833e8b2e74 100644 Binary files a/Projectiles/Ranged/TriploonProj.png and b/Projectiles/Ranged/TriploonProj.png differ diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index 7ee1c48c78..badefae78c 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue for (float i = 0; i < 5; i++) { float angle = MathHelper.TwoPi / 5f * i; - int star = Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int star = Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.87), projectile.knockBack, projectile.owner, 0f, 0f); Main.projectile[star].Calamity().stealthStrike = projectile.Calamity().stealthStrike; } projectile.position = projectile.Center; diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index ffcedef6f8..e8446cb6e0 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Rogue } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); } int num320 = Main.rand.Next(8, 13); int num3; @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector15.Normalize(); vector15 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)((double)projectile.damage * 0.3), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); num3 = num321; } } diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.png b/Projectiles/Rogue/BallisticPoisonBombProj.png index 41cbdb0949..57ee0af129 100644 Binary files a/Projectiles/Rogue/BallisticPoisonBombProj.png and b/Projectiles/Rogue/BallisticPoisonBombProj.png differ diff --git a/Projectiles/Rogue/BallisticPoisonBombSpike.png b/Projectiles/Rogue/BallisticPoisonBombSpike.png index 586b8e6639..156ae21160 100644 Binary files a/Projectiles/Rogue/BallisticPoisonBombSpike.png and b/Projectiles/Rogue/BallisticPoisonBombSpike.png differ diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 24d20904ab..802f3d0811 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue int stealth = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[stealth].Calamity().forceRogue = true; } - if (!target.canGhostHeal) //canGhostHeal be like lol + if (!target.canGhostHeal || player.moonLeech) //canGhostHeal be like lol { return; } diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index 638cd3ffbd..f78d5f5f79 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -93,8 +93,9 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxPlayers; i++) { + Player owner = Main.player[projectile.owner]; Player player = Main.player[i]; - if ((Main.player[projectile.owner].team != player.team || player.team == 0) && !player.dead && !player.buffImmune[buffType] && Vector2.Distance(projectile.Center, player.Center) <= radius) + if ((owner.team != player.team || player.team == 0) && player.hostile && owner.hostile && !player.dead && !player.buffImmune[buffType] && Vector2.Distance(projectile.Center, player.Center) <= radius) { if (player.FindBuffIndex(buffType) == -1) player.AddBuff(buffType, 180, false); diff --git a/Projectiles/Rogue/LeonidStar.cs b/Projectiles/Rogue/LeonidStar.cs index a601774acf..bf86eb0194 100644 --- a/Projectiles/Rogue/LeonidStar.cs +++ b/Projectiles/Rogue/LeonidStar.cs @@ -40,8 +40,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0]++; if (projectile.ai[0] > 120f) { - projectile.alpha -= 15; - if (projectile.alpha <= 0) + projectile.scale *= 0.98f; + projectile.position = projectile.Center; + projectile.width = (int)(projectile.width * projectile.scale); + projectile.height = (int)(projectile.height * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + if (projectile.scale <= 0.05f) projectile.Kill(); } projectile.rotation += projectile.direction * 0.05f; diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 069cf54644..3014bd7ff8 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -25,12 +25,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.timeLeft = 240; projectile.Calamity().rogue = true; + projectile.extraUpdates = 1; + projectile.alpha = 150; } public override void AI() { projectile.frameCounter++; - if (projectile.frameCounter > 4) + if (projectile.frameCounter > 8) { projectile.frame++; projectile.frameCounter = 0; @@ -47,13 +49,14 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 43); for (int j = 0; j <= 10; j++) { Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); } } + public override Color? GetAlpha(Color lightColor) => new Color(150, 150, 150, 150); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 104c5466d0..41a38ffd9a 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.0075), 0f, projectile.owner, 0f, 0f); - if (target.type == NPCID.TargetDummy || !projectile.Calamity().stealthStrike) + if (target.type == NPCID.TargetDummy || !projectile.Calamity().stealthStrike || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Rogue/SealedSingularityGore.cs b/Projectiles/Rogue/SealedSingularityGore.cs index 1dad8cd775..5b1f906bc4 100644 --- a/Projectiles/Rogue/SealedSingularityGore.cs +++ b/Projectiles/Rogue/SealedSingularityGore.cs @@ -14,21 +14,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { projectile.friendly = true; - projectile.width = 25; - projectile.height = 25; + projectile.width = projectile.height = 25; projectile.Calamity().rogue = true; + projectile.timeLeft = 300; } public override void AI() { //Rotation and gravity projectile.rotation += 0.6f * projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.27f; + projectile.velocity.Y += 0.27f; if (projectile.velocity.Y > 16f) { projectile.velocity.Y = 16f; } - } public override void Kill(int timeLeft) @@ -48,10 +47,9 @@ namespace CalamityMod.Projectiles.Rogue Texture2D texture; switch (projectile.ai[0]) { - - case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore2"); + case 1f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore2"); break; - case 3f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore3"); + case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore3"); break; default: texture = Main.projectileTexture[projectile.type]; break; diff --git a/Projectiles/Rogue/SupernovaSpike.png b/Projectiles/Rogue/SupernovaSpike.png index 586b8e6639..156ae21160 100644 Binary files a/Projectiles/Rogue/SupernovaSpike.png and b/Projectiles/Rogue/SupernovaSpike.png differ diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs index 1de61c3dd4..59bf1b0f2c 100644 --- a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs +++ b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs @@ -58,52 +58,50 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(SoundID.Item7, projectile.position); } - // Returns after some number of frames in the air - if (projectile.timeLeft < lifeTime - 180) + // Returns after 2.5 seconds in the air + if (projectile.timeLeft < lifeTime - 150) projectile.ai[0] = 1f; if (projectile.ai[0] != 0f) { - float returnSpeed = 18f * 1.6f; + float returnSpeed = 30f; float acceleration = 1.4f; Player owner = Main.player[projectile.owner]; // Delete the projectile if it's excessively far away. - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + Vector2 projVector = owner.Center - projectile.Center; + float dist = projVector.Length(); if (dist > 3000f) projectile.Kill(); dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; + projVector.X *= dist; + projVector.Y *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (projectile.velocity.X < projVector.X) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + if (projectile.velocity.X < 0f && projVector.X > 0f) projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (projectile.velocity.X > projVector.X) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + if (projectile.velocity.X > 0f && projVector.X < 0f) projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (projectile.velocity.Y < projVector.Y) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + if (projectile.velocity.Y < 0f && projVector.Y > 0f) projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (projectile.velocity.Y > projVector.Y) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) + projectile.velocity.Y -= acceleration; + if (projectile.velocity.Y > 0f && projVector.Y < 0f) projectile.velocity.Y -= acceleration; } @@ -120,6 +118,8 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + if (projectile.penetrate < 3) + projectile.ai[0] = 1f; target.AddBuff(ModContent.BuffType(), 180); Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int k = 0; k < 10; k++) @@ -132,6 +132,8 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { + if (projectile.penetrate < 3) + projectile.ai[0] = 1f; target.AddBuff(ModContent.BuffType(), 180); Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int k = 0; k < 10; k++) diff --git a/Projectiles/Summon/ApparatusExplosion.cs b/Projectiles/Summon/ApparatusExplosion.cs index 1f5ffacb1d..58143b81b8 100644 --- a/Projectiles/Summon/ApparatusExplosion.cs +++ b/Projectiles/Summon/ApparatusExplosion.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 012c839454..67f2fb93cc 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -64,185 +64,8 @@ namespace CalamityMod.Projectiles.Summon } } projectile.rotation += projectile.velocity.X * 0.04f; - float num633 = 700f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - float SAIMovement = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X -= SAIMovement; - } - else - { - projectile.velocity.X += SAIMovement; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y -= SAIMovement; - } - else - { - projectile.velocity.Y += SAIMovement; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - projectile.tileCollide = true; - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; //4 - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 - } - } - else - { - projectile.tileCollide = false; - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - 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) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; //8 - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, false); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 3478ec1a8c..85162b0476 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -216,11 +216,11 @@ namespace CalamityMod.Projectiles.Summon } if (flag25) { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; } if (projectile.ai[1] > 0f) { diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index d59bdd29a8..c8c761d021 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -64,185 +64,8 @@ namespace CalamityMod.Projectiles.Summon } } projectile.rotation += projectile.velocity.X * 0.04f; - float num633 = 700f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - projectile.tileCollide = true; - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; //4 - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 - } - } - else - { - projectile.tileCollide = false; - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - 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) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; //8 - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, false); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 8ee9315bf7..85b12794b5 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -117,15 +117,17 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } + Vector2 value = new Vector2(0.5f); if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { + Vector2 vector2 = npc.position + npc.Size * value; float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - vector46 = npc.Center; + vector46 = vector2; flag25 = true; } } @@ -134,14 +136,15 @@ namespace CalamityMod.Projectiles.Summon { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + Vector2 vector2 = npc.position + npc.Size * value; + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = vector2; flag25 = true; } } diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index b8372875eb..a4f7b2adbc 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -116,11 +116,13 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } + Vector2 value = new Vector2(0.5f); if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { + Vector2 vector2 = npc.position + npc.Size * value; float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { @@ -133,14 +135,15 @@ namespace CalamityMod.Projectiles.Summon { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + Vector2 vector2 = npc.position + npc.Size * value; + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = vector2; flag25 = true; } } diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 86a4b27f9e..b7036d438e 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -61,10 +61,6 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; bool flag64 = projectile.type == ModContent.ProjectileType(); if (flag64) { @@ -77,178 +73,10 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - projectile.frameCounter++; - if (projectile.frameCounter > 1) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - 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.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; projectile.frameCounter++; - if (projectile.frameCounter > 3) + if (projectile.frameCounter > (projectile.ai[0] == 2f ? 1 : 3)) { projectile.frame++; projectile.frameCounter = 0; @@ -257,30 +85,8 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 700f, 1100f, 2400f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 027ceff01d..872b7f681e 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -82,210 +82,26 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } - float num633 = 500f; //700 - float num634 = 800f; - float num635 = 1200f; - float num636 = 400f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.25f * num, 0.55f * num, 0.75f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 100f) //200 - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; //6 - if (flag26) - { - num650 = 15f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(500f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) //200 and 8 - { - num650 = 8f; //8 - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - 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.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } + float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; + lightScalar *= Main.essScale; + Lighting.AddLight(projectile.Center, 0.25f * lightScalar, 0.55f * lightScalar, 0.75f * lightScalar); + + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 500f, 800f, 1200f, 400f, 0, 30f, 8f, -4f, 40f, 8f, false, true); } } } diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 54747653c6..c409c0ac5d 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -222,7 +222,7 @@ namespace CalamityMod.Projectiles.Summon } if (foundTarget) { - projectile.rotation = (targetVec - projectile.Center).ToRotation() + MathHelper.Pi; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); } else { diff --git a/Projectiles/Summon/Dreadmine.png b/Projectiles/Summon/Dreadmine.png index 2ebb9113cf..a5767d22dd 100644 Binary files a/Projectiles/Summon/Dreadmine.png and b/Projectiles/Summon/Dreadmine.png differ diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index e317b7de9c..3e0902cd6c 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Dreadmine Turret"); - Main.projFrames[projectile.type] = 2; + Main.projFrames[projectile.type] = 4; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 1) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } diff --git a/Projectiles/Summon/DreadmineTurret.png b/Projectiles/Summon/DreadmineTurret.png index caa6bf6b69..ee780cbe3c 100644 Binary files a/Projectiles/Summon/DreadmineTurret.png and b/Projectiles/Summon/DreadmineTurret.png differ diff --git a/Projectiles/Summon/ElementalAxeMinion.cs b/Projectiles/Summon/ElementalAxeMinion.cs index 3899f354c9..43daf58f0f 100644 --- a/Projectiles/Summon/ElementalAxeMinion.cs +++ b/Projectiles/Summon/ElementalAxeMinion.cs @@ -69,183 +69,8 @@ namespace CalamityMod.Projectiles.Summon } } projectile.rotation += 0.075f; - float num633 = 1600f; //range - float num634 = 1800f; - float num635 = 2500f; - float num636 = 400f; - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 24f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 12f; //4 - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - 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) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 16f; //8 - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 1600f, 1800f, 2500f, 400f, 1, 30f, 24f, -12f, 30f, 16f, true, true); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index 04f6c10f2b..864318f7b2 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -124,9 +124,11 @@ namespace CalamityMod.Projectiles.Summon //If summoned by Amalgam, trail poisonous seawater if (Math.Abs(projectile.velocity.X) > 0.1f || Math.Abs(projectile.velocity.Y) > 0.1f) { - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer && amalgam) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 1f, 0f); + int water = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 1f, 0f); + Main.projectile[water].usesIDStaticNPCImmunity = true; + Main.projectile[water].usesLocalNPCImmunity = false; } } @@ -139,35 +141,45 @@ namespace CalamityMod.Projectiles.Summon returnToPlayer = true; //Find an npc to target, or if minion targetting is used, choose that npc - Vector2 center = projectile.Center; + Vector2 targetVec = projectile.Center; float range = 900f; bool npcFound = false; + Vector2 half = new Vector2(0.5f); if (!returnToPlayer) { - projectile.tileCollide = true; - NPC target = projectile.OwnerMinionAttackTargetNPC; - if (target != null && target.CanBeChasedBy(projectile, false)) + if (player.HasMinionAttackTargetNPC) { - float extraDistance = (target.width / 2) + (target.height / 2); - - if (Vector2.Distance(target.Center, projectile.Center) < (range + extraDistance) && Collision.CanHit(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - center = target.Center; - npcFound = true; + //Check the size of the target to make it easier to hit fat targets like Levi + Vector2 sizeCheck = npc.position + npc.Size * half; + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + //Some minions will ignore tiles when choosing a target like Ice Claspers, others will not + bool canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + if (!npcFound && targetDist < range && canHit) + { + range = targetDist; + targetVec = sizeCheck; + npcFound = true; + } } } - if (!npcFound) + //If no npc is specifically targetted, check through the entire array + else { - for (int index = 0; index < Main.maxNPCs; ++index) + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { - NPC npc = Main.npc[index]; + NPC npc = Main.npc[npcIndex]; if (npc.CanBeChasedBy(projectile, false)) { - float extraDistance = (npc.width / 2) + (npc.height / 2); - - if (Vector2.Distance(npc.Center, projectile.Center) < (range + extraDistance) && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + Vector2 sizeCheck = npc.position + npc.Size * half; + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + bool canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + if (!npcFound && targetDist < range && canHit) { - center = npc.Center; + range = targetDist; + targetVec = sizeCheck; npcFound = true; } } @@ -185,35 +197,33 @@ namespace CalamityMod.Projectiles.Summon float turnSpeed = 20f; if (returnToPlayer) //move faster if returning to the player homingSpeed = amalgam ? 30f : 12f; - Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); - float xDist = player.Center.X - projPos.X; - float yDist = player.Center.Y - projPos.Y - 60f; - Vector2 playerVector = new Vector2(xDist, yDist); + Vector2 playerVector = player.Center - projectile.Center; + playerVector.Y -= 60f; float playerDist = playerVector.Length(); - if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - projectile.ai[0] = 0f; + if (playerDist < 100f && returnToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + returnToPlayer = false; if (playerDist > 2000f) { projectile.position.X = player.Center.X - projectile.width / 2; projectile.position.Y = player.Center.Y - projectile.width / 2; } - if (playerDist > 70f) - { - Vector2 homeInVector = projectile.DirectionTo(playerVector); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * turnSpeed + homeInVector * homingSpeed) / (turnSpeed + 1f); - } - else - { + //If more than 70 pixels away, move toward the player + if (playerDist > 70f) + { + playerVector.Normalize(); + playerVector *= homingSpeed; + projectile.velocity = (projectile.velocity * turnSpeed + playerVector) / (turnSpeed + 1f); + } + //Minions never stay still + else + { if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } projectile.velocity *= 1.01f; - } + } projectile.friendly = false; projectile.rotation = projectile.velocity.X * 0.05f; if (Math.Abs(projectile.velocity.X) <= 0f) @@ -233,19 +243,18 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; float minionSpeed = amalgam ? 20f : 8f; float turnSpeed = 14f; - Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); - float xDist = center.X - projPos.X; - float yDist = center.Y - projPos.Y - 60f; - Vector2 targetVector = new Vector2(xDist, yDist); - float targetDist = targetVector.Length(); + Vector2 targetLocation = targetVec - projectile.Center; + float targetDist = targetLocation.Length(); if (targetDist < 100f) minionSpeed = amalgam ? 25f : 10f; - Vector2 homeInVector = projectile.DirectionTo(targetVector); + Vector2 homeInVector = projectile.DirectionTo(targetLocation); if (homeInVector.HasNaNs()) homeInVector = Vector2.UnitY; - projectile.velocity = (projectile.velocity * turnSpeed + homeInVector * minionSpeed) / (turnSpeed + 1f); + targetLocation.Normalize(); + targetLocation *= minionSpeed; + projectile.velocity = (projectile.velocity * turnSpeed + targetLocation) / (turnSpeed + 1f); } else { @@ -277,5 +286,7 @@ namespace CalamityMod.Projectiles.Summon } CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs new file mode 100644 index 0000000000..a262d973a0 --- /dev/null +++ b/Projectiles/Summon/GastricBelcher.cs @@ -0,0 +1,352 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class GastricBelcher : ModProjectile + { + private bool initialized = false; + private int bubbleCounter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gastric Belcher"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + //Set namespaces + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = projectile.Calamity(); + + //On spawn effects + if (!initialized) + { + //Set constants + modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); + modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + //Spawn dust + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 33, + 89 + }); + Vector2 direction = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f; + direction = direction.RotatedBy((double)((dustIndex - (dustAmt / 2f - 1f)) * MathHelper.TwoPi / dustAmt), default) + projectile.Center; + Vector2 dustVel = direction - projectile.Center; + int water = Dust.NewDust(direction + dustVel, 0, 0, randomDust, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity = dustVel; + } + initialized = true; + } + + //Flexible minion damage update + if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(modProj.spawnedPlayerMinionProjectileDamageValue / + modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); + projectile.damage = damage2; + } + + //Update frames + if (projectile.frameCounter++ % 6 == 0) + { + projectile.frame++; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + //Set up buff and timeLeft + bool typeCheck = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (typeCheck) + { + if (player.dead) + { + modPlayer.gastricBelcher = false; + } + if (modPlayer.gastricBelcher) + { + projectile.timeLeft = 2; + } + } + + //Anti sticky movement to prevent overlapping minions + float antiStickMvt = 0.05f; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + bool correctMinion = proj.type == ModContent.ProjectileType(); + if (projIndex != projectile.whoAmI && proj.active && proj.owner == projectile.owner && correctMinion && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) + { + if (projectile.position.X < proj.position.X) + { + projectile.velocity.X -= antiStickMvt; + } + else + { + projectile.velocity.X += antiStickMvt; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= antiStickMvt; + } + else + { + projectile.velocity.Y += antiStickMvt; + } + } + } + + //Find a target + float maxDistance = 700f; + Vector2 targetVec = projectile.position; + Vector2 half = new Vector2(0.5f); + bool foundTarget = false; + //If targeting something, prioritize that enemy + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + //Adding a check on the NPC's size allows it to target big things like Providence + Vector2 sizeCheck = npc.position + npc.Size * half; + //Check if blocks are in the way + bool collisionCheck = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + //Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && targetDist < maxDistance && collisionCheck) + { + maxDistance = targetDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + else + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + bool collisionCheck = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && targetDist < maxDistance && collisionCheck) + { + maxDistance = targetDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + } + + //If too far, make the minion start returning to the player. + float returnDist = 1000f; + if (foundTarget) + { + //Max travel distance increases if targeting something + returnDist = 2200f; + } + if (Vector2.Distance(player.Center, projectile.Center) > returnDist) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + + //If a target is found, move toward it + if (foundTarget && projectile.ai[0] == 0f) + { + Vector2 vecToTarget = targetVec - projectile.Center; + float targetDist = vecToTarget.Length(); + vecToTarget.Normalize(); + //If farther than 200 pixels, move toward it + if (targetDist > 200f) + { + float speedMult = (targetDist > 400f) ? 12f : (targetDist > 250) ? 6f : 3f; + vecToTarget *= speedMult; + projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + } + //Otherwise, back it up slowly + else + { + float speedMult = -3f; + vecToTarget *= speedMult; + projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f; + } + } + + //If not targeting something, act passively + else + { + bool returningToPlayer = false; + if (!returningToPlayer) + { + returningToPlayer = projectile.ai[0] == 1f; + } + //Move faster if actively returning to the player + float speedMult = 10f; + if (returningToPlayer) + { + speedMult = 21f; + } + Vector2 vecToPlayer = player.Center - projectile.Center + new Vector2(0f, -60f); + float playerDist = vecToPlayer.Length(); + //Slow down if near the player + if (playerDist < 200f && speedMult > 8f) + { + speedMult = 1f; + } + //If close enough to the player, return to normal + if (playerDist < 150f && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + //If abnormally far, teleport to the player + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - (projectile.width / 2f); + projectile.position.Y = player.Center.Y - (projectile.height / 2f); + projectile.netUpdate = true; + } + //Move toward player if more than 70 pixels away + if (playerDist > 70f) + { + vecToPlayer.Normalize(); + vecToPlayer *= speedMult; + projectile.velocity = (projectile.velocity * 40f + vecToPlayer) / 41f; + } + //Move if still + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + + //Update sprite direction and rotation + if (foundTarget) + { + projectile.spriteDirection = projectile.direction = ((targetVec.X - projectile.Center.X) > 0).ToDirectionInt(); + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi), 0.1f); + } + else + { + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + } + + //Increment attack cooldown + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += Main.rand.Next(1, 4); + } + //Set the minion to be ready for attack + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + //Return if on attack cooldown, has no target, or returning to the player + if (projectile.ai[0] != 0f || !foundTarget || projectile.ai[1] != 0f) + return; + + if (Main.myPlayer == projectile.owner) + { + //Play vomit sound + if (modPlayer.soundCooldown <= 0) + { + Main.PlaySound(SoundID.NPCKilled, (int)projectile.Center.X, (int)projectile.Center.Y, 13, 0.5f, 0f); + modPlayer.soundCooldown = Main.rand.Next(120, 180); + } + + //Increment the attack counter + projectile.ai[1]++; + + int projType = ModContent.ProjectileType(); + + //Calculate the general velocity + Vector2 velocity = targetVec - projectile.Center; + velocity.Normalize(); + + //Add some inaccuracy for the vomit projectiles + float vomitSpeedMult = 16f; + Vector2 vomitVel = velocity * vomitSpeedMult; + vomitVel.Y += Main.rand.NextFloat(-30f, 30f) * 0.05f; + vomitVel.X += Main.rand.NextFloat(-30f, 30f) * 0.05f; + + //Fire the vomit projectile + Projectile.NewProjectile(projectile.Center, vomitVel, projType, projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(3), 0f); + + //Fire 5 bubbles for every three attacks + if (bubbleCounter++ % 3 == 2) + { + for (int projCount = 0; projCount < 5; projCount++) + { + //Add a shotgun spread to the bubbles + float bubbleSpeedMult = 14f; + Vector2 bubbleVel = velocity * bubbleSpeedMult; + bubbleVel.Y += Main.rand.NextFloat(-50f, 50f) * 0.05f; + bubbleVel.X += Main.rand.NextFloat(-50f, 50f) * 0.05f; + + Projectile.NewProjectile(projectile.Center, bubbleVel, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + projectile.netUpdate = true; + } + } + + //This minion does no contact damage + public override bool CanDamage() => false; + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = frameHeight * projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/GastricBelcher.png b/Projectiles/Summon/GastricBelcher.png new file mode 100644 index 0000000000..f5fd2d0d20 Binary files /dev/null and b/Projectiles/Summon/GastricBelcher.png differ diff --git a/Projectiles/Summon/GastricBelcherBubble.cs b/Projectiles/Summon/GastricBelcherBubble.cs new file mode 100644 index 0000000000..786a429c28 --- /dev/null +++ b/Projectiles/Summon/GastricBelcherBubble.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class GastricBelcherBubble : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gastric Bubble"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = projectile.height = 18; + projectile.minion = true; + projectile.timeLeft = 180; + projectile.aiStyle = 72; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item54, projectile.position); + Vector2 center = projectile.Center; + for (int dustIndex = 0; dustIndex < 10; ++dustIndex) + { + int scalar = (int)(10 * projectile.ai[1]); + int bubble = Dust.NewDust(projectile.Center - Vector2.One * scalar, scalar * 2, scalar * 2, 212, 0.0f, 0.0f, 0, new Color(), 1f); + Dust dust = Main.dust[bubble]; + Vector2 dustVec = Vector2.Normalize(dust.position - projectile.Center); + dust.position = projectile.Center + dustVec * scalar * projectile.scale; + dust.velocity = dustIndex >= 30 ? dustVec * Main.rand.Next(45, 91) / 10f : dustVec * dust.velocity.Length(); + dust.color = Main.hslToRgb(0.4f + Main.rand.NextFloat() * 0.2f, 0.9f, 0.5f); + dust.color = Color.Lerp(dust.color, Color.White, 0.3f); + dust.noGravity = true; + dust.scale = 0.7f; + } + } + } +} diff --git a/Projectiles/Summon/GastricBelcherBubble.png b/Projectiles/Summon/GastricBelcherBubble.png new file mode 100644 index 0000000000..c919f9c2d5 Binary files /dev/null and b/Projectiles/Summon/GastricBelcherBubble.png differ diff --git a/Projectiles/Summon/GastricBelcherVomit.cs b/Projectiles/Summon/GastricBelcherVomit.cs new file mode 100644 index 0000000000..bb9909b9cf --- /dev/null +++ b/Projectiles/Summon/GastricBelcherVomit.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class GastricBelcherVomit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gastric Vomit"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = projectile.height = 18; + projectile.minion = true; + projectile.timeLeft = 300; + projectile.penetrate = 3; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } + + public override void AI() + { + //Rotation and gravity + projectile.rotation += 0.6f * projectile.direction; + projectile.velocity.Y += 0.27f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y); + //Dust effect + int splash = 0; + while (splash < 4) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 233, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); + splash += 1; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture; + switch (projectile.ai[0]) + { + case 1f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GastricBelcherVomit2"); + break; + case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GastricBelcherVomit3"); + break; + default: texture = Main.projectileTexture[projectile.type]; + break; + } + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/GastricBelcherVomit.png b/Projectiles/Summon/GastricBelcherVomit.png new file mode 100644 index 0000000000..6e22f7d039 Binary files /dev/null and b/Projectiles/Summon/GastricBelcherVomit.png differ diff --git a/Projectiles/Summon/GastricBelcherVomit2.png b/Projectiles/Summon/GastricBelcherVomit2.png new file mode 100644 index 0000000000..717b9e9ebe Binary files /dev/null and b/Projectiles/Summon/GastricBelcherVomit2.png differ diff --git a/Projectiles/Summon/GastricBelcherVomit3.png b/Projectiles/Summon/GastricBelcherVomit3.png new file mode 100644 index 0000000000..83ec95521f Binary files /dev/null and b/Projectiles/Summon/GastricBelcherVomit3.png differ diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 6ce24ae4d3..cc014a1faa 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = projectile.direction; } @@ -78,10 +78,7 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - float num633 = 600f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; + bool flag64 = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) @@ -95,180 +92,8 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && - flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - 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.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 7f; //8 - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 7f, false, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index 1c063c2e31..b4c7fe8aa2 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon projectile.height = 54; projectile.netImportant = true; projectile.friendly = true; - projectile.minionSlots = 1f; + projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.timeLeft *= 5; diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index 3d20d0f0be..50d81e9ade 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -75,10 +75,6 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.05f, 0.15f, 0.2f); - float num633 = 700f; - float num634 = 1000f; - float num635 = 2200f; - float num636 = 150f; bool flag64 = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) @@ -92,182 +88,10 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && - flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.rotation = projectile.velocity.ToRotation() - 1.57f; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 9f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - 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.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 700f, 1000f, 2200f, 150f, 0, 40f, 9f, -4f, 40f, 9f, true, true); + projectile.rotation = projectile.velocity.ToRotation() - 1.57f; - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 9f; //8 - projectile.netUpdate = true; - } - } - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index dbbf55d8b7..b40fc8ced3 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -84,10 +84,7 @@ namespace CalamityMod.Projectiles.Summon projectile.localAI[0] = 0f; } } - float num633 = 700f; - float num634 = 1000f; - float num635 = 2200f; - float num636 = 150f; + bool flag64 = projectile.type == ModContent.ProjectileType(); if (flag64) { @@ -96,182 +93,10 @@ namespace CalamityMod.Projectiles.Summon projectile.Kill(); } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && - flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.rotation = projectile.velocity.ToRotation() + 1.57f; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 9f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - 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.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 700f, 1000f, 2200f, 150f, 0, 40f, 9f, -4f, 40f, 9f, true, true); + projectile.rotation = projectile.velocity.ToRotation() + 1.57f; - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 9f; //8 - projectile.netUpdate = true; - } - } - } } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index 42c0e72143..47bdf7321f 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -187,8 +187,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) @@ -205,11 +205,11 @@ namespace CalamityMod.Projectiles.Summon } if (flag25) { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; } if (projectile.ai[1] > 0f) { diff --git a/Projectiles/Summon/PlantSummon.cs b/Projectiles/Summon/PlantSummon.cs index e54d51b734..55f9d2f5d0 100644 --- a/Projectiles/Summon/PlantSummon.cs +++ b/Projectiles/Summon/PlantSummon.cs @@ -152,16 +152,18 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] = 0f; Vector2 vector46 = projectile.position; bool flag25 = false; + Vector2 value = new Vector2(0.5f); if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { + Vector2 vector2 = npc.position + npc.Size * value; float num646 = Vector2.Distance(npc.Center, projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; - vector46 = npc.Center; + vector46 = vector2; flag25 = true; } } @@ -170,14 +172,15 @@ namespace CalamityMod.Projectiles.Summon { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + Vector2 vector2 = npc.position + npc.Size * value; + float num646 = Vector2.Distance(npc.Center, projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; - vector46 = nPC2.Center; + vector46 = vector2; flag25 = true; } } @@ -255,11 +258,11 @@ namespace CalamityMod.Projectiles.Summon } if (flag25) { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; } if (projectile.ai[1] > 0f) { @@ -273,14 +276,14 @@ namespace CalamityMod.Projectiles.Summon if (projectile.ai[0] == 0f) { float scaleFactor3 = 6f; - int num658 = (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()); + int projType = (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()); int projDmg = (int)(projectile.damage * 0.7f); float speedMult = 1f; if (Main.rand.NextBool(4)) { - num658 = ModContent.ProjectileType(); + projType = ModContent.ProjectileType(); } - if (num658 == ModContent.ProjectileType()) + if (projType == ModContent.ProjectileType()) { speedMult = 2f; projDmg = (int)(projectile.damage * 1.2f); @@ -294,7 +297,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 value19 = vector46 - projectile.Center; value19.Normalize(); value19 *= scaleFactor3; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X * speedMult, value19.Y * speedMult, num658, projDmg, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X * speedMult, value19.Y * speedMult, projType, projDmg, 0f, projectile.owner, 0f, 0f); projectile.netUpdate = true; } } @@ -326,16 +329,18 @@ namespace CalamityMod.Projectiles.Summon } Vector2 vector46 = projectile.position; bool flag25 = false; + Vector2 value = new Vector2(0.5f); if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { + Vector2 vector2 = npc.position + npc.Size * value; float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = npc.Center; + vector46 = vector2; flag25 = true; } } @@ -344,14 +349,15 @@ namespace CalamityMod.Projectiles.Summon { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + Vector2 vector2 = npc.position + npc.Size * value; + float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = nPC2.Center; + vector46 = vector2; flag25 = true; } } diff --git a/Projectiles/Summon/SonOfYharon.cs b/Projectiles/Summon/SonOfYharon.cs index 361eac8190..ed48037b59 100644 --- a/Projectiles/Summon/SonOfYharon.cs +++ b/Projectiles/Summon/SonOfYharon.cs @@ -60,20 +60,16 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } - float num633 = 1000f; - float num634 = 2000f; - float num635 = 3000f; - float num636 = 500f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1.2f * num, 0.8f * num, 0f * num); - bool flag64 = projectile.type == ModContent.ProjectileType(); + float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; + lightScalar *= Main.essScale; + Lighting.AddLight(projectile.Center, 1.2f * lightScalar, 0.8f * lightScalar, 0f * lightScalar); + bool correctMinion = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (correctMinion) { if (player.dead) { @@ -84,35 +80,8 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; if (projectile.ai[0] == 2f) { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; projectile.frameCounter++; if (projectile.frameCounter > 3) { @@ -123,160 +92,22 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - 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.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 1000f, 2000f, 3000f, 500f, 1, 30f, 8f, -4f, 40f, 8f, true, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 746ecdfc04..83cd9fc2d0 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.valkyrie) @@ -45,7 +44,8 @@ namespace CalamityMod.Projectiles.Summon projectile.active = false; return; } - if (flag64) + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (correctMinion) { if (player.dead) { @@ -76,175 +76,21 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + + //Adjust sprite direction so it faces correctly + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } - float num633 = 700f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0f * num, 0.2f * num, 0.45f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - 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.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 700f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, true); + + //Give off some light + float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; + lightScalar *= Main.essScale; + Lighting.AddLight(projectile.Center, 0f * lightScalar, 0.2f * lightScalar, 0.45f * lightScalar); + + //Frames projectile.frameCounter++; if (projectile.frameCounter > 7) { @@ -255,30 +101,6 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Typeless/BallisticPoisonCloud.cs b/Projectiles/Typeless/BallisticPoisonCloud.cs index d2a0a701dd..ed123003ff 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud.cs @@ -1,4 +1,5 @@ -using Terraria; +using System; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 10; } public override void SetDefaults() @@ -28,34 +29,26 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { + projectile.ai[0] += 1f; projectile.frameCounter++; - if (projectile.frameCounter > 9) + if (projectile.frameCounter > 6) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + if (projectile.ai[0] < 219f) //255 - frameCounter tick * number of disippation frames + { + if (projectile.frame >= 4) + { + projectile.frame = 0; + } + } + else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.Kill(); + } projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) + if (projectile.alpha > 80) { projectile.alpha -= 30; if (projectile.alpha < 80) @@ -63,6 +56,10 @@ namespace CalamityMod.Projectiles.Typeless projectile.alpha = 80; } } + if (Math.Abs(projectile.velocity.X) > 0.1f) + { + projectile.spriteDirection = -projectile.direction; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/BallisticPoisonCloud.png b/Projectiles/Typeless/BallisticPoisonCloud.png index 65fcbd400d..f9a1139c25 100644 Binary files a/Projectiles/Typeless/BallisticPoisonCloud.png and b/Projectiles/Typeless/BallisticPoisonCloud.png differ diff --git a/Projectiles/Typeless/BallisticPoisonCloud2.cs b/Projectiles/Typeless/BallisticPoisonCloud2.cs deleted file mode 100644 index 06e12c4d98..0000000000 --- a/Projectiles/Typeless/BallisticPoisonCloud2.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class BallisticPoisonCloud2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.99f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 150f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - } -} diff --git a/Projectiles/Typeless/BallisticPoisonCloud2.png b/Projectiles/Typeless/BallisticPoisonCloud2.png deleted file mode 100644 index 9c040a1165..0000000000 Binary files a/Projectiles/Typeless/BallisticPoisonCloud2.png and /dev/null differ diff --git a/Projectiles/Typeless/BallisticPoisonCloud3.cs b/Projectiles/Typeless/BallisticPoisonCloud3.cs deleted file mode 100644 index 29ff512173..0000000000 --- a/Projectiles/Typeless/BallisticPoisonCloud3.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class BallisticPoisonCloud3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 40; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 9) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.97f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 90f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Venom, 240); - } - } -} diff --git a/Projectiles/Typeless/BallisticPoisonCloud3.png b/Projectiles/Typeless/BallisticPoisonCloud3.png deleted file mode 100644 index 49ca5a9c3e..0000000000 Binary files a/Projectiles/Typeless/BallisticPoisonCloud3.png and /dev/null differ diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 029e62f3b8..c855387dae 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ai[0] = 10 + Main.rand.Next(10); float maxDistance = hentai ? 900f : 600f; int target = -1; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(projectile)) @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f && target.type != NPCID.TargetDummy) + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f && target.type != NPCID.TargetDummy && !Main.player[projectile.owner].moonLeech) { int healAmount = 10 * damage / projectile.damage; //should always be around max, less if enemy has defense/DR if (healAmount > 0) @@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f) + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f && !Main.player[projectile.owner].moonLeech) { int healAmount = 10 * damage / projectile.damage; //should always be around max, less if enemy has defense/DR if (healAmount > 0) diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index 619dcb6611..4951f8fa4a 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.timeLeft = 6; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Sounds/Custom/MicrowaveBeep.cs b/Sounds/Custom/MicrowaveBeep.cs new file mode 100644 index 0000000000..4e13043f45 --- /dev/null +++ b/Sounds/Custom/MicrowaveBeep.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class MicrowaveBeep : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/MicrowaveBeep.ogg b/Sounds/Custom/MicrowaveBeep.ogg new file mode 100644 index 0000000000..30e6018102 Binary files /dev/null and b/Sounds/Custom/MicrowaveBeep.ogg differ diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 65b1349c2e..d8285b60a6 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -220,7 +220,8 @@ namespace CalamityMod ItemID.SonarPotion, ItemID.GenderChangePotion, ItemID.LovePotion, - ItemID.StinkPotion + ItemID.StinkPotion, + ItemID.RecallPotion }; ModRecipe r; diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 2d9d3c5dc9..e7251ed1be 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -2419,6 +2419,19 @@ namespace CalamityMod float colorMePurple = (float)((Math.Sin(timeMult * Main.GlobalTime) + 1) * 0.5f); return Color.Lerp(firstColor, secondColor, colorMePurple); } + /// + /// Returns a color lerp that supports multiple colors. + /// + /// The 0-1 incremental value used when interpolating. + /// The various colors to interpolate across. + /// + public static Color MulticolorLerp(float increment, params Color[] colors) + { + int currentColorIndex = (int)(increment * colors.Length); + Color currentColor = colors[currentColorIndex]; + Color nextColor = colors[(currentColorIndex + 1) % colors.Length]; + return Color.Lerp(currentColor, nextColor, increment * colors.Length % 1f); + } #endregion #region Miscellaneous Utilities diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 5b7748ec10..0241a79a34 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1919,7 +1919,7 @@ namespace CalamityMod.World } } - if (!downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient) + if (!downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient && !Main.hardMode) CalamityUtils.StopSandstorm(); if (Main.netMode != NetmodeID.MultiplayerClient)