diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 0d504b4f9f..f9bd94077a 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -59,9 +59,14 @@ namespace CalamityMod.Buffs else if (type == BuffID.Slow) { if (npc.Calamity().slowed < npc.buffTime[buffIndex]) - { npc.Calamity().slowed = npc.buffTime[buffIndex]; - } + npc.DelBuff(buffIndex); + buffIndex--; + } + if (type == BuffID.Electrified) + { + if (npc.Calamity().electrified < npc.buffTime[buffIndex]) + npc.Calamity().electrified = npc.buffTime[buffIndex]; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/Summon/WulfrumDroidBuff.cs b/Buffs/Summon/WulfrumDroidBuff.cs new file mode 100644 index 0000000000..7e2f0bfcd5 --- /dev/null +++ b/Buffs/Summon/WulfrumDroidBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class WulfrumDroidBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Wulfrum Droid"); + Description.SetDefault("The wulfrum droid will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.wDroid = true; + } + if (!modPlayer.wDroid) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/WulfrumDroidBuff.png b/Buffs/Summon/WulfrumDroidBuff.png new file mode 100644 index 0000000000..34b1c798e4 Binary files /dev/null and b/Buffs/Summon/WulfrumDroidBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 881f7d58a8..33e1f4a1b6 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -67,7 +67,6 @@ namespace CalamityMod.CalPlayer LoseRage = 0, None = 1 } - public class CalamityPlayer : ModPlayer { #region Variables @@ -76,6 +75,7 @@ namespace CalamityMod.CalPlayer public bool drawBossHPBar = true; public bool shouldDrawSmallText = true; private const int saveVersion = 0; + //public int distanceFromBoss = -1; public int dashMod; public int projTypeJustHitBy; public int sCalDeathCount = 0; @@ -126,6 +126,7 @@ namespace CalamityMod.CalPlayer public float aquaticBoost = 1f; public float shieldInvinc = 5f; public GaelSwitchPhase gaelSwitchTimer = 0; + public int galileoCooldown = 0; // Sound public bool playRogueStealthSound = false; @@ -196,7 +197,7 @@ namespace CalamityMod.CalPlayer public bool radiator = false; // Rage - public int stressMax = 10000; + public const int stressMax = 10000; public int stress; public int stressCD; public bool stressLevel500 = false; @@ -204,7 +205,7 @@ namespace CalamityMod.CalPlayer public int gainRageCooldown = 60; // Adrenaline - public int adrenalineMax = 10000; + public const int adrenalineMax = 10000; public int adrenalineMaxTimer = 300; public int adrenalineDmgDown = 600; public float adrenalineDmgMult = 1f; @@ -323,6 +324,7 @@ namespace CalamityMod.CalPlayer public bool lol = false; public bool raiderTalisman = false; public int raiderStack = 0; + public int raiderCooldown = 0; public bool sGenerator = false; public bool sDefense = false; public bool sPower = false; @@ -397,6 +399,7 @@ namespace CalamityMod.CalPlayer public bool moonCrown = false; public int featherCrownCooldown = 0; public int moonCrownCooldown = 0; + public int nanoFlareCooldown = 0; public bool dragonScales = false; public bool gloveOfPrecision = false; public bool gloveOfRecklessness = false; @@ -472,6 +475,8 @@ namespace CalamityMod.CalPlayer public bool umbraphileSet = false; public bool reaverBlast = false; public bool reaverBurst = false; + //public bool fathomSwarmer = false; + //public bool fathomSwarmerVisage = false; public bool astralStarRain = false; public int astralStarRainCooldown = 0; public bool plagueReaper = false; @@ -615,6 +620,7 @@ namespace CalamityMod.CalPlayer public int bloodfinTimer = 30; // Minion + public bool wDroid = false; public bool resButterfly = false; public bool glSword = false; public bool mWorm = false; @@ -862,79 +868,20 @@ namespace CalamityMod.CalPlayer #region ResetEffects public override void ResetEffects() { - // Max health bonuses - if (absorber) - player.statLifeMax2 += 20; - player.statLifeMax2 += - (mFruit ? 25 : 0) + - (bOrange ? 25 : 0) + - (eBerry ? 25 : 0) + - (dFruit ? 25 : 0); - if (ZoneAbyss && abyssalAmulet) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); - if (coreOfTheBloodGod) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; - if (bloodPact) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; - if (leviathanAndSirenLore) - { - if (sirenBoobsPrevious || sirenBoobsAltPrevious) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5; - } - if (hAttack) - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; - if (affliction || afflicted) - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 10; - if (cadence) - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; - if (community) - { - float floatTypeBoost = 0.01f + - (NPC.downedSlimeKing ? 0.01f : 0f) + - (NPC.downedBoss1 ? 0.01f : 0f) + - (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + - (Main.hardMode ? 0.01f : 0f) + - (NPC.downedMechBossAny ? 0.01f : 0f) + - (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + - (NPC.downedAncientCultist ? 0.01f : 0f) + - (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 - int integerTypeBoost = (int)(floatTypeBoost * 50f); - player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; - } - - // Max health reductions - if (crimEffigy) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.8); - if (badgeOfBraveryRare) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); - if (regenator) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.5); - if (calamitasLore) - player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); - - // Max mana bonuses - player.statManaMax2 += - (pHeart ? 50 : 0) + - (eCore ? 50 : 0) + - (cShard ? 50 : 0) + - (starBeamRye ? 50 : 0); - - // Extra accessory slots - if (extraAccessoryML) + if (extraAccessoryML) + { player.extraAccessorySlots = 1; + } if (extraAccessoryML && player.extraAccessory && (Main.expertMode || Main.gameMenu)) + { player.extraAccessorySlots = 2; + } if (CalamityWorld.bossRushActive) { if (Config.BossRushAccessoryCurse) + { player.extraAccessorySlots = 0; + } } ResetRogueStealth(); @@ -1185,6 +1132,8 @@ namespace CalamityMod.CalPlayer umbraphileSet = false; plagueReaper = false; + //fathomSwarmer = false; + //fathomSwarmerVisage = false; tarraSet = false; tarraMelee = false; @@ -1340,6 +1289,7 @@ namespace CalamityMod.CalPlayer pinkCandle = false; yellowCandle = false; + wDroid = false; resButterfly = false; glSword = false; mWorm = false; @@ -1421,12 +1371,14 @@ namespace CalamityMod.CalPlayer gaelRageCooldown = 0; gaelSwipes = 0; gaelSwitchTimer = (GaelSwitchPhase)0; + galileoCooldown = 0; stress = 0; adrenaline = 0; adrenalineMaxTimer = 300; adrenalineDmgDown = 600; adrenalineDmgMult = 1f; raiderStack = 0; + raiderCooldown = 0; fleshTotemCooldown = 0; astralStarRainCooldown = 0; bloodflareMageCooldown = 0; @@ -1475,6 +1427,7 @@ namespace CalamityMod.CalPlayer eclipseMirrorCooldown = false; moonCrownCooldown = 0; featherCrownCooldown = 0; + nanoFlareCooldown = 0; sulphurPoison = false; sandCloakCooldown = 0; spectralVeilImmunity = 0; @@ -1626,6 +1579,8 @@ namespace CalamityMod.CalPlayer umbraphileSet = false; reaverBlast = false; reaverBurst = false; + //fathomSwarmer = false; + //fathomSwarmerVisage = false; astralStarRain = false; plagueReaper = false; plagueReaperCooldown = 0; @@ -2790,8 +2745,334 @@ namespace CalamityMod.CalPlayer public override void PostUpdateMiscEffects() { - CalamityPlayerMiscEffects.CalamityPostUpdateMiscEffects(player, mod); + if (Config.ExpertDebuffDurationReduction) + Main.expertDebuffTime = 1f; + areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS(); + + if (areThereAnyDamnBosses) + { + if (player.whoAmI == Main.myPlayer) + player.AddBuff(ModContent.BuffType(), 2, false); + } + + #region RevengeanceEffects + /*if (!areThereAnyDamnBosses) + { + distanceFromBoss = -1; + }*/ + if (CalamityWorld.revenge) + { + if (player.lifeSteal > (CalamityWorld.death ? 50f : 60f)) + { + player.lifeSteal = CalamityWorld.death ? 50f : 60f; + } + if (player.whoAmI == Main.myPlayer) + { + if (player.onHitDodge) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge) + { + player.buffTime[l] = 360; + } + } + } + if (player.immuneTime > 120) + { + player.immuneTime = 120; + } + if (Config.AdrenalineAndRage) + { + int stressGain = 0; + if (rageMode) + { + stressGain = -2000; + } + else + { + if (draedonsHeart) + { + if (draedonsStressGain) + { + stressGain += 60; + } + } + else if (heartOfDarkness) + { + stressGain += 30; + } + } + stressCD++; + if (stressCD >= 60) + { + stressCD = 0; + stress += stressGain; + if (stress < 0) + { + stress = 0; + } + if (stress >= stressMax) + { + if (playFullRageSound) + { + playFullRageSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); + } + stress = stressMax; + } + else + { + playFullRageSound = true; + } + } + stressLevel500 = stress >= 9800; + if (stressLevel500 && !hAttack) + { + int heartAttackChance = (draedonsHeart || heartOfDarkness) ? 2000 : 10000; + if (Main.rand.Next(heartAttackChance) == 0) + { + player.AddBuff(ModContent.BuffType(), 18000); + } + } + if (adrenaline >= adrenalineMax) + { + adrenalineMaxTimer--; + if (adrenalineMaxTimer <= 0) + { + if (playAdrenalineBurnoutSound) + { + playAdrenalineBurnoutSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout1"), (int)player.position.X, (int)player.position.Y); + } + adrenalineDmgDown--; + if (adrenalineDmgDown < 0) + { + if (playFullAdrenalineBurnoutSound) + { + playFullAdrenalineBurnoutSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout2"), (int)player.position.X, (int)player.position.Y); + } + adrenalineDmgDown = 0; + } + adrenalineMaxTimer = 0; + } + } + else if (!adrenalineMode && adrenaline <= 0) + { + playAdrenalineBurnoutSound = true; + playFullAdrenalineBurnoutSound = true; + adrenalineDmgDown = 600; + adrenalineMaxTimer = 300; + adrenalineDmgMult = 1f; + } + adrenalineDmgMult = 0.1f * (float)(adrenalineDmgDown / 60); + if (adrenalineDmgMult < 0.33f) + adrenalineDmgMult = 0.33f; + int adrenalineGain = 0; + bool SCalAlive = NPC.AnyNPCs(ModContent.NPCType()); + if (adrenalineMode) + { + adrenalineGain = SCalAlive ? -10000 : -2000; + } + else + { + if (Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16)) // > + { + adrenaline = 0; + } + else if (areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0) + { + int adrenalineTickBoost = 0 + + (adrenalineBoostOne ? 63 : 0) + //286 + (adrenalineBoostTwo ? 115 : 0) + //401 + (adrenalineBoostThree ? 100 : 0); //501 + adrenalineGain = 223 + adrenalineTickBoost; //pre-slime god = 45, pre-astrum deus = 35, pre-polterghast = 25, post-polter = 20 + /*if (distanceFromBoss == -1 || distanceFromBoss > 5600) + { + adrenalineGain /= 4; + }*/ + } + else + { + adrenaline = 0; + } + } + adrenalineCD++; + if (adrenalineCD >= (SCalAlive ? 135 : 60)) + { + adrenalineCD = 0; + adrenaline += adrenalineGain; + if (adrenaline < 0) + { + adrenaline = 0; + } + if (adrenaline >= adrenalineMax) + { + if (playFullAdrenalineSound) + { + playFullAdrenalineSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); + } + adrenaline = adrenalineMax; + } + else + { + playFullAdrenalineSound = true; + } + } + } + } + } + else + { + if (player.whoAmI == Main.myPlayer) + { + stressCD++; + if (stressCD >= 60) + { + stressCD = 0; + stress += -30; + if (stress < 0) + { + stress = 0; + } + } + adrenalineCD++; + if (adrenalineCD >= 60) + { + adrenalineCD = 0; + adrenaline += -30; + if (adrenaline < 0) + { + adrenaline = 0; + } + } + } + } + if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + { + packetTimer++; + if (packetTimer == 60) + { + packetTimer = 0; + StressPacket(false); + AdrenalinePacket(false); + /*if (areThereAnyDamnBosses) + DistanceFromBossPacket(false);*/ + } + } + #endregion + + #region STRESSNOLONGEREXISTSYOUSEXUALDINOSAUR + if (stressPills) + { + player.statDefense += 8; + player.allDamage += 0.08f; + } + if (laudanum) + { + player.statDefense += 6; + player.allDamage += 0.06f; + } + if (draedonsHeart) + { + player.allDamage += 0.1f; + } + if (!stressLevel500 && player.FindBuffIndex(ModContent.BuffType()) > -1) + { player.ClearBuff(ModContent.BuffType()); } + if (draedonsHeart && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.statDefense += 25; + } + if (hAttack) + { + if (heartOfDarkness || draedonsHeart) + { + player.allDamage += 0.1f; + } + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; + } + if (affliction || afflicted) + { + player.endurance += 0.07f; + player.statDefense += 20; + player.allDamage += 0.12f; + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 10; + } + #endregion + + #region MaxLifeAndManaBoosts + player.statLifeMax2 += + (mFruit ? 25 : 0) + + (bOrange ? 25 : 0) + + (eBerry ? 25 : 0) + + (dFruit ? 25 : 0); + if (silvaHitCounter > 0) + { + player.statLifeMax2 -= silvaHitCounter * 100; + if (player.statLifeMax2 <= 400) + { + player.statLifeMax2 = 400; + if (silvaCountdown > 0) + { + if (player.FindBuffIndex(ModContent.BuffType()) > -1) + { player.ClearBuff(ModContent.BuffType()); } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); + } + silvaCountdown = 0; + } + } + player.statManaMax2 += + (pHeart ? 50 : 0) + + (eCore ? 50 : 0) + + (cShard ? 50 : 0) + + (starBeamRye ? 50 : 0); + if (Main.netMode != NetmodeID.Server && player.whoAmI == Main.myPlayer) + { + Texture2D rain3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Rain3"); + Texture2D rainOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/RainOriginal"); + Texture2D mana2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Mana2"); + Texture2D mana3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Mana3"); + Texture2D mana4 = ModContent.GetTexture("CalamityMod/ExtraTextures/Mana4"); + Texture2D manaOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/ManaOriginal"); + Texture2D carpetAuric = ModContent.GetTexture("CalamityMod/ExtraTextures/AuricCarpet"); + Texture2D carpetOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/Carpet"); + int totalManaBoost = + (pHeart ? 1 : 0) + + (eCore ? 1 : 0) + + (cShard ? 1 : 0); + switch (totalManaBoost) + { + default: + Main.manaTexture = manaOriginal; + break; + case 3: + Main.manaTexture = mana4; + break; + case 2: + Main.manaTexture = mana3; + break; + case 1: + Main.manaTexture = mana2; + break; + } + if (Main.bloodMoon) + { Main.rainTexture = rainOriginal; } + else if (Main.raining && ZoneSulphur) + { Main.rainTexture = rain3; } + else + { Main.rainTexture = rainOriginal; } + if (auricSet) + { Main.flyingCarpetTexture = carpetAuric; } + else + { Main.flyingCarpetTexture = carpetOriginal; } + } + #endregion + + #region MiscEffects if (player.HeldItem.type == ModContent.ItemType()) { gaelSwitchTimer = GaelSwitchPhase.LoseRage; @@ -2802,6 +3083,2454 @@ namespace CalamityMod.CalPlayer stress = 0; gaelSwitchTimer = GaelSwitchPhase.None; } + if (Config.ProficiencyEnabled) + { + GetExactLevelUp(); + } + + if (gainRageCooldown > 0) + gainRageCooldown--; + + if (player.nebulaLevelMana > 0 && player.statMana < player.statManaMax2) + { + int num = 12; + nebulaManaNerfCounter += player.nebulaLevelMana; + if (nebulaManaNerfCounter >= num) + { + nebulaManaNerfCounter -= num; + player.statMana--; + if (player.statMana < 0) + { + player.statMana = 0; + } + } + } + else + { + nebulaManaNerfCounter = 0; + } + if (Main.myPlayer == player.whoAmI) + { + BossHealthBarManager.SHOULD_DRAW_SMALLTEXT_HEALTH = shouldDrawSmallText; + /*if (player.chest != -1) + { + if (player.chest != -2) + { + trashManChest = -1; + } + if (trashManChest >= 0) + { + if (!Main.projectile[trashManChest].active || Main.projectile[trashManChest].type != ModContent.ProjectileType()) + { + Main.PlaySound(SoundID.Item11, -1, -1); + player.chest = -1; + Recipe.FindRecipes(); + } + else + { + int num16 = (int)(((double)player.position.X + (double)player.width * 0.5) / 16.0); + int num17 = (int)(((double)player.position.Y + (double)player.height * 0.5) / 16.0); + player.chestX = (int)Main.projectile[trashManChest].Center.X / 16; + player.chestY = (int)Main.projectile[trashManChest].Center.Y / 16; + if (num16 < player.chestX - Player.tileRangeX || num16 > player.chestX + Player.tileRangeX + 1 || num17 < player.chestY - Player.tileRangeY || num17 > player.chestY + Player.tileRangeY + 1) + { + if (player.chest != -1) + { + Main.PlaySound(SoundID.Item11, -1, -1); + } + player.chest = -1; + Recipe.FindRecipes(); + } + } + } + } + else + { + trashManChest = -1; + }*/ + } + if (silvaSet || invincible || margarita) + { + foreach (int debuff in CalamityMod.debuffList) + player.buffImmune[debuff] = true; + } + if (aSparkRare) + { + player.buffImmune[BuffID.Electrified] = true; + } + if (Config.ExpertChilledWaterRemoval) + { + if (Main.expertMode && player.ZoneSnow && player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear) + { + player.buffImmune[BuffID.Chilled] = true; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + if (Main.myPlayer == player.whoAmI && !player.gills && !player.merman) + { + if (player.breath > 0) + player.breath--; + } + } + } + } + + int lightStrength = 0 + + ((player.lightOrb || player.crimsonHeart || player.magicLantern || radiator) ? 1 : 0) + //1 + (aquaticEmblem ? 1 : 0) + //2 + (player.arcticDivingGear ? 1 : 0) + //3 + (jellyfishNecklace ? 1 : 0) + //4 + ((player.blueFairy || player.greenFairy || player.redFairy || player.petFlagDD2Ghost || babyGhostBell) ? 2 : 0) + //6 + //(fathomSwarmerVisage ? 1 : 0) + //8 + ((shine || lumenousAmulet) ? 2 : 0) + //10 + ((player.wisp || player.suspiciouslookingTentacle || sirenPet) ? 3 : 0); //13 + + double breathLossMult = 1.0 - + (player.gills ? 0.2 : 0.0) - //0.8 + (player.accDivingHelm ? 0.25 : 0.0) - //0.75 + (player.arcticDivingGear ? 0.25 : 0.0) - //0.75 + (aquaticEmblem ? 0.25 : 0.0) - //0.75 + //(fathomSwarmerVisage ? 0.25 : 0.0) - //0.75 + (player.accMerman ? 0.3 : 0.0) - //0.7 + (victideSet ? 0.2 : 0.0) - //0.85 + (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 0.3 : 0.0) - //0.7 + (abyssalDivingSuit ? 0.3 : 0.0); //0.7 + + if (breathLossMult < 0.05) + breathLossMult = 0.05; + + double tickMult = 1.0 + + (player.gills ? 4.0 : 0.0) + //5 + (player.ignoreWater ? 5.0 : 0.0) + //10 + (player.accDivingHelm ? 10.0 : 0.0) + //20 + (player.arcticDivingGear ? 10.0 : 0.0) + //30 + (aquaticEmblem ? 10.0 : 0.0) + //40 + (player.accMerman ? 15.0 : 0.0) + //55 + (victideSet ? 5.0 : 0.0) + //60 + (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 15.0 : 0.0) + //75 + (abyssalDivingSuit ? 15.0 : 0.0); //90 + + if (tickMult > 50.0) + tickMult = 50.0; + + int lifeLossAtZeroBreathResist = 0; + if (depthCharm) + { + lifeLossAtZeroBreathResist += 3; + if (abyssalDivingSuit) + lifeLossAtZeroBreathResist += 6; + } + + abyssLightLevelStat = lightStrength; + abyssBreathLossStats[0] = (int)(2D * breathLossMult); + abyssBreathLossStats[1] = (int)(6D * breathLossMult); + abyssBreathLossStats[2] = (int)(18D * breathLossMult); + abyssBreathLossStats[3] = (int)(54D * breathLossMult); + abyssBreathLossRateStat = (int)(6D * tickMult); + abyssLifeLostAtZeroBreathStats[0] = 3 - lifeLossAtZeroBreathResist; + abyssLifeLostAtZeroBreathStats[1] = 6 - lifeLossAtZeroBreathResist; + abyssLifeLostAtZeroBreathStats[2] = 12 - lifeLossAtZeroBreathResist; + abyssLifeLostAtZeroBreathStats[3] = 24 - lifeLossAtZeroBreathResist; + + if (abyssLifeLostAtZeroBreathStats[0] < 0) + abyssLifeLostAtZeroBreathStats[0] = 0; + if (abyssLifeLostAtZeroBreathStats[1] < 0) + abyssLifeLostAtZeroBreathStats[1] = 0; + + if (ZoneAbyss) + { + if (abyssalAmulet) + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); + + if (Main.myPlayer == player.whoAmI) //4200 total tiles small world + { + int breathLoss = 2; + int lifeLossAtZeroBreath = 3; + int tick = 6; + + bool lightLevelOne = lightStrength > 0; //1+ + bool lightLevelTwo = lightStrength > 2; //3+ + bool lightLevelThree = lightStrength > 4; //5+ + bool lightLevelFour = lightStrength > 6; //7+ + + if (ZoneAbyssLayer4) //3200 and below + { + breathLoss = 54; + if (!lightLevelFour) + player.blind = true; + if (!lightLevelThree) + player.headcovered = true; + player.bleed = true; + lifeLossAtZeroBreath = 24; + player.statDefense -= anechoicPlating ? 40 : 120; + } + else if (ZoneAbyssLayer3) //2700 to 3200 + { + breathLoss = 18; + if (!lightLevelThree) + player.blind = true; + if (!lightLevelTwo) + player.headcovered = true; + if (!abyssalDivingSuit) + player.bleed = true; + lifeLossAtZeroBreath = 12; + player.statDefense -= anechoicPlating ? 20 : 60; + } + else if (ZoneAbyssLayer2) //2100 to 2700 + { + breathLoss = 6; + if (!lightLevelTwo) + player.blind = true; + if (!depthCharm) + player.bleed = true; + lifeLossAtZeroBreath = 6; + player.statDefense -= anechoicPlating ? 10 : 30; + } + else if (ZoneAbyssLayer1) //1500 to 2100 + { + if (!lightLevelOne) + player.blind = true; + player.statDefense -= anechoicPlating ? 5 : 15; + } + + breathLoss = (int)((double)breathLoss * breathLossMult); + tick = (int)((double)tick * tickMult); + + if (player.gills || player.merman) + { + if (player.breath > 0) + player.breath -= 3; + } + + abyssBreathCD++; + if (abyssBreathCD >= tick) + { + abyssBreathCD = 0; + + if (player.breath > 0) + player.breath -= breathLoss; + + if (cDepth) + { + if (player.breath > 0) + player.breath--; + } + + if (player.breath <= 0) + { + lifeLossAtZeroBreath -= lifeLossAtZeroBreathResist; + + if (lifeLossAtZeroBreath < 0) + lifeLossAtZeroBreath = 0; + + player.statLife -= lifeLossAtZeroBreath; + + if (player.statLife <= 0) + { + abyssDeath = true; + KillPlayer(); + } + } + } + } + } + else + { + abyssBreathCD = 0; + abyssDeath = false; + } + + if (!player.mount.Active) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && ironBoots) + { + player.maxFallSpeed = 9f; + } + if (aeroSet && !player.wet) + { + player.maxFallSpeed = 15f; + } + if (normalityRelocator) + { + player.maxFallSpeed *= 1.1f; + } + if (etherealExtorter && player.ZoneSkyHeight) + { + player.maxFallSpeed *= 1.25f; + } + } + if (normalityRelocator) + { + player.moveSpeed += 0.1f; + } + if (player.ZoneSkyHeight) + { + if (astrumDeusLore) + { + player.moveSpeed += 0.2f; + } + if (astrumAureusLore) + { + player.jumpSpeedBoost += 0.5f; + } + } + if (omegaBlueSet) //should apply after rev caps, actually those are gone so AAAAA + { + //add tentacles + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 6) + { + bool[] tentaclesPresent = new bool[6]; + for (int i = 0; i < 1000; i++) + { + Projectile projectile = Main.projectile[i]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.owner == Main.myPlayer && projectile.ai[1] >= 0f && projectile.ai[1] < 6f) + { + tentaclesPresent[(int)projectile.ai[1]] = true; + } + } + for (int i = 0; i < 6; i++) + { + if (!tentaclesPresent[i]) + { + float modifier = player.meleeDamage + player.magicDamage + player.rangedDamage + + player.Calamity().throwingDamage + player.minionDamage; + modifier /= 5f; + int damage = (int)(666 * modifier); + Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; + Projectile.NewProjectile(player.Center, vel, ModContent.ProjectileType(), damage, 8f, Main.myPlayer, Main.rand.Next(120), i); + } + } + } + float damageUp = 0.1f; + int critUp = 10; + if (omegaBlueHentai) + { + damageUp *= 2f; + critUp *= 2; + } + player.allDamage += damageUp; + AllCritBoost(critUp); + } + if (!bOut) + { + if (gHealer) + { + if (healCounter > 0) + { + healCounter--; + } + if (healCounter <= 0) + { + healCounter = 300; + if (player.whoAmI == Main.myPlayer) + { + int healAmount = 5 + + (gDefense ? 5 : 0) + + (gOffense ? 5 : 0); + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + } + if (gDefense) + { + player.moveSpeed += 0.1f + + (gOffense ? 0.1f : 0f); + player.endurance += 0.025f + + (gOffense ? 0.025f : 0f); + } + if (gOffense) + { + player.minionDamage += 0.1f + + (gDefense ? 0.05f : 0f); + } + } + + // You always get the max minions, even during the effect of the burnout debuff + if (gOffense) + player.maxMinions++; + + if (draconicSurgeCooldown > 0) + draconicSurgeCooldown--; + if (galileoCooldown > 0) + galileoCooldown--; + if (raiderCooldown > 0) + raiderCooldown--; + if (fleshTotemCooldown > 0) + fleshTotemCooldown--; + if (astralStarRainCooldown > 0) + astralStarRainCooldown--; + if (bloodflareMageCooldown > 0) + bloodflareMageCooldown--; + if (tarraMageHealCooldown > 0) + tarraMageHealCooldown--; + if (featherCrownCooldown > 0) + featherCrownCooldown--; + if (moonCrownCooldown > 0) + moonCrownCooldown--; + if (nanoFlareCooldown > 0) + nanoFlareCooldown--; + if (sandCloakCooldown > 0) + sandCloakCooldown--; + if (spectralVeilImmunity > 0) + spectralVeilImmunity--; + if (plaguedFuelPackCooldown > 0) + plaguedFuelPackCooldown--; + if (plaguedFuelPackDash > 0) + plaguedFuelPackDash--; + if (ataxiaDmg > 0f) + ataxiaDmg -= 1.5f; + if (ataxiaDmg < 0f) + ataxiaDmg = 0f; + if (xerocDmg > 0f) + xerocDmg -= 2f; + if (xerocDmg < 0f) + xerocDmg = 0f; + if (godSlayerDmg > 0f) + godSlayerDmg -= 2.5f; + if (godSlayerDmg < 0f) + godSlayerDmg = 0f; + if (aBulwarkRareMeleeBoostTimer > 0) + aBulwarkRareMeleeBoostTimer--; + if (bossRushImmunityFrameCurseTimer > 0) + bossRushImmunityFrameCurseTimer--; + if (gaelRageCooldown > 0) + gaelRageCooldown--; + + if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) + { + player.buffImmune[ModContent.BuffType()] = true; + silvaCountdown--; + if (silvaCountdown <= 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); + } + for (int j = 0; j < 2; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + Main.dust[num].position.X += (float)Main.rand.Next(-20, 21); + Main.dust[num].position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].noGravity = true; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + } + + if (tarragonCloak) + { + tarraDefenseTime--; + if (tarraDefenseTime <= 0) + { + tarraDefenseTime = 600; + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 1800, false); + } + } + for (int j = 0; j < 2; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].noGravity = true; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + } + + if (tarraThrowing) + { + if (tarragonImmunity) + { + player.immune = true; + player.immuneTime = 2; + } + + if (tarraThrowingCrits >= 25) + { + tarraThrowingCrits = 0; + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 300, false); + } + } + + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType()) + { + if (player.whoAmI == Main.myPlayer) + player.AddBuff(ModContent.BuffType(), 1500, false); + } + + bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff); + if (shouldAffect) + { + player.Calamity().throwingDamage += 0.1f; + } + } + } + + if (bloodflareSet) + { + if (bloodflareHeartTimer > 0) + bloodflareHeartTimer--; + if (bloodflareManaTimer > 0) + bloodflareManaTimer--; + } + + if (bloodflareMelee) + { + if (bloodflareMeleeHits >= 15) + { + bloodflareMeleeHits = 0; + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 302, false); + } + } + + if (bloodflareFrenzy) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType()) + { + if (player.whoAmI == Main.myPlayer) + player.AddBuff(ModContent.BuffType(), 1800, false); + } + } + player.meleeCrit += 25; + player.meleeDamage += 0.25f; + for (int j = 0; j < 2; j++) + { + int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 5, 0f, 0f, 100, default, 2f); + Dust expr_A4_cp_0 = Main.dust[num]; + expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); + Dust expr_CB_cp_0 = Main.dust[num]; + expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].velocity *= 0.9f; + Main.dust[num].noGravity = true; + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + } + } + } + } + + if (Main.raining && ZoneSulphur) + { + if (player.ZoneOverworldHeight || player.ZoneSkyHeight) + player.AddBuff(ModContent.BuffType(), 2); + } + if (raiderTalisman) + { + if (nanotech) //so nanotech isn't so broken + { + player.Calamity().throwingDamage += (float)raiderStack / 250f * 0.1f; + } + else + { + player.Calamity().throwingDamage += (float)raiderStack / 250f * 0.25f; + } + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon) + { + player.maxMinions += 2; + } + if (sDefense) + { + player.statDefense += 5; + player.endurance += 0.05f; + } + if (absorber) + { + player.moveSpeed += 0.12f; + player.jumpSpeedBoost += 1.2f; + player.statLifeMax2 += 20; + player.thorns = 0.5f; + player.endurance += 0.05f; + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.manaRegenBonus += 2; + } + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.statDefense += 2; + player.moveSpeed += 0.05f; + } + } + if (seaShell) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + player.statDefense += 3; + player.endurance += 0.05f; + player.moveSpeed += 0.15f; + player.ignoreWater = true; + } + } + if (coreOfTheBloodGod) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; + } + if (bloodPact) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; + } + if (aAmpoule) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 1f, 0.6f); + player.endurance += 0.05f; + player.pickSpeed -= 0.25f; + player.buffImmune[70] = true; + player.buffImmune[47] = true; + player.buffImmune[46] = true; + player.buffImmune[44] = true; + player.buffImmune[20] = true; + } + else if (cFreeze) + { + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.3f, (float)Main.DiscoG / 400f, 0.5f); + } + else if (sirenIce) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.35f, 1f, 1.25f); + } + else if (sirenBoobs || sirenBoobsAlt) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1.5f, 1f, 0.1f); + } + else if (tarraSummon) + { + Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 3f, 0f); + } + if (blazingCore) + { + player.endurance += 0.1f; + } + if (cFreeze) + { + int num = ModContent.BuffType(); + float num2 = 200f; + int random = Main.rand.Next(5); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1) + { + nPC.AddBuff(num, 120, false); + } + } + } + } + } + } + if (invincible || lol) + { + player.thorns = 0f; + player.turtleThorns = false; + } + if (player.vortexStealthActive) + { + player.rangedDamage -= (1f - player.stealth) * 0.4f; //change 80 to 40 + player.rangedCrit -= (int)((1f - player.stealth) * 5f); //change 20 to 15 + } + if (polarisBoost) + { + player.endurance += 0.01f; + player.statDefense += 2; + } + if (!polarisBoost || player.inventory[player.selectedItem].type != ModContent.ItemType()) + { + polarisBoost = false; + if (player.FindBuffIndex(ModContent.BuffType()) > -1) + { player.ClearBuff(ModContent.BuffType()); } + polarisBoostCounter = 0; + polarisBoostTwo = false; + polarisBoostThree = false; + } + if (polarisBoostCounter >= 20) + { + polarisBoostTwo = false; + polarisBoostThree = true; + } + else if (polarisBoostCounter >= 10) + { + polarisBoostTwo = true; + } + if (projRefRareLifeRegenCounter > 0) + { + projRefRareLifeRegenCounter--; + } + if(kingSlimeLore) + { + player.moveSpeed += 0.05f; + player.jumpSpeedBoost += player.autoJump ? 0f : 0.1f; + } + if (desertScourgeLore) + { + player.statDefense += 5; + } + if (skeletronPrimeLore) + { + player.armorPenetration += 5; + } + if (destroyerLore) + { + player.pickSpeed -= 0.05f; + } + if (golemLore) + { + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.statDefense += 10; + } + } + if (aquaticScourgeLore && player.wellFed) + { + player.statDefense += 1; + player.allDamage += 0.025f; + AllCritBoost(1); + player.meleeSpeed += 0.025f; + player.minionKB += 0.25f; + player.moveSpeed += 0.1f; + } + if (eaterOfWorldsLore) + { + int damage = 10; + float knockBack = 1f; + if (Main.rand.NextBool(15)) + { + int num = 0; + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType()) + { + num++; + } + } + if (Main.rand.Next(15) >= num && num < 6) + { + int num2 = 50; + int num3 = 24; + int num4 = 90; + for (int j = 0; j < num2; j++) + { + int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2); + Vector2 center = player.Center; + center.X += (float)Main.rand.Next(-num5, num5 + 1); + center.Y += (float)Main.rand.Next(-num5, num5 + 1); + if (!Collision.SolidCollision(center, num3, num3) && !Collision.WetCollision(center, num3, num3)) + { + center.X += (float)(num3 / 2); + center.Y += (float)(num3 / 2); + if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) + { + int num6 = (int)center.X / 16; + int num7 = (int)center.Y / 16; + bool flag = false; + if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0) + { + flag = true; + } + else + { + center.X -= (float)(num4 / 2); + center.Y -= (float)(num4 / 2); + if (Collision.SolidCollision(center, num4, num4)) + { + center.X += (float)(num4 / 2); + center.Y += (float)(num4 / 2); + flag = true; + } + } + if (flag) + { + for (int k = 0; k < 1000; k++) + { + if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) + { + flag = false; + break; + } + } + if (flag && Main.myPlayer == player.whoAmI) + { + Projectile.NewProjectile(center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + } + } + } + } + } + } + } + } + if (calcium) + { + player.noFallDmg = true; + } + if (skeletronLore) + { + player.allDamage += 0.05f; + AllCritBoost(5); + player.statDefense += 5; + } + if (ceaselessHunger) + { + for (int j = 0; j < 400; j++) + { + if (Main.item[j].active && Main.item[j].noGrabDelay == 0 && Main.item[j].owner == player.whoAmI) + { + Main.item[j].beingGrabbed = true; + if ((double)player.position.X + (double)player.width * 0.5 > (double)Main.item[j].position.X + (double)Main.item[j].width * 0.5) + { + if (Main.item[j].velocity.X < 90f + player.velocity.X) + { + Item item = Main.item[j]; + item.velocity.X += 9f; + } + if (Main.item[j].velocity.X < 0f) + { + Item item = Main.item[j]; + item.velocity.X += 9f * 0.75f; + } + } + else + { + if (Main.item[j].velocity.X > -90f + player.velocity.X) + { + Item item = Main.item[j]; + item.velocity.X -= 9f; + } + if (Main.item[j].velocity.X > 0f) + { + Item item = Main.item[j]; + item.velocity.X -= 9f * 0.75f; + } + } + if ((double)player.position.Y + (double)player.height * 0.5 > (double)Main.item[j].position.Y + (double)Main.item[j].height * 0.5) + { + if (Main.item[j].velocity.Y < 90f) + { + Item item = Main.item[j]; + item.velocity.Y += 9f; + } + if (Main.item[j].velocity.Y < 0f) + { + Item item = Main.item[j]; + item.velocity.Y += 9f * 0.75f; + } + } + else + { + if (Main.item[j].velocity.Y > -90f) + { + Item item = Main.item[j]; + item.velocity.Y -= 9f; + } + if (Main.item[j].velocity.Y > 0f) + { + Item item = Main.item[j]; + item.velocity.Y -= 9f * 0.75f; + } + } + } + } + } + if (dukeFishronLore) + { + player.allDamage += 0.05f; + AllCritBoost(5); + player.moveSpeed += 0.1f; + } + if (lunaticCultistLore) + { + player.endurance += 0.04f; + player.statDefense += 4; + player.allDamage += 0.04f; + AllCritBoost(4); + player.minionKB += 0.5f; + player.moveSpeed += 0.1f; + } + if (moonLordLore) + { + if (player.gravDir == -1f && player.gravControl2) + { + player.endurance += 0.05f; + player.statDefense += 10; + player.allDamage += 0.1f; + AllCritBoost(10); + player.minionKB += 1.5f; + player.moveSpeed += 0.15f; + } + } + if (leviathanAndSirenLore) + { + if (sirenBoobsPrevious || sirenBoobsAltPrevious) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5; + } + if (sirenPet) + { + player.spelunkerTimer += 1; + if (player.spelunkerTimer >= 10) + { + player.spelunkerTimer = 0; + int num65 = 30; + int num66 = (int)player.Center.X / 16; + int num67 = (int)player.Center.Y / 16; + for (int num68 = num66 - num65; num68 <= num66 + num65; num68++) + { + for (int num69 = num67 - num65; num69 <= num67 + num65; num69++) + { + if (Main.rand.NextBool(4)) + { + Vector2 vector = new Vector2((float)(num66 - num68), (float)(num67 - num69)); + if (vector.Length() < (float)num65 && num68 > 0 && num68 < Main.maxTilesX - 1 && num69 > 0 && num69 < Main.maxTilesY - 1 && Main.tile[num68, num69] != null && Main.tile[num68, num69].active()) + { + bool flag7 = false; + if (Main.tile[num68, num69].type == 185 && Main.tile[num68, num69].frameY == 18) + { + if (Main.tile[num68, num69].frameX >= 576 && Main.tile[num68, num69].frameX <= 882) + { + flag7 = true; + } + } + else if (Main.tile[num68, num69].type == 186 && Main.tile[num68, num69].frameX >= 864 && Main.tile[num68, num69].frameX <= 1170) + { + flag7 = true; + } + if (flag7 || Main.tileSpelunker[(int)Main.tile[num68, num69].type] || (Main.tileAlch[(int)Main.tile[num68, num69].type] && Main.tile[num68, num69].type != 82)) + { + int num70 = Dust.NewDust(new Vector2((float)(num68 * 16), (float)(num69 * 16)), 16, 16, 204, 0f, 0f, 150, default, 0.3f); + Main.dust[num70].fadeIn = 0.75f; + Main.dust[num70].velocity *= 0.1f; + Main.dust[num70].noLight = true; + } + } + } + } + } + } + } + } + if (spectralVeil && spectralVeilImmunity > 0) + { + Rectangle sVeilRectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (sVeilRectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + if (player.whoAmI == Main.myPlayer) + { + player.noKnockback = true; + rogueStealth = rogueStealthMax; + spectralVeilImmunity = 0; + + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + + Vector2 sVeilDustDir = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); + sVeilDustDir.Normalize(); + sVeilDustDir *= 0.5f; + for (int j = 0; j < 20; j++) + { + int sVeilDustIndex1 = Dust.NewDust(player.Center, 1, 1, 21, sVeilDustDir.X * j, sVeilDustDir.Y * j); + int sVeilDustIndex2 = Dust.NewDust(player.Center, 1, 1, 21, -sVeilDustDir.X * j, -sVeilDustDir.Y * j); + Main.dust[sVeilDustIndex1].noGravity = false; + Main.dust[sVeilDustIndex1].noLight = false; + Main.dust[sVeilDustIndex2].noGravity = false; + Main.dust[sVeilDustIndex2].noLight = false; + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + break; + } + } + } + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0) + { + Projectile proj = Main.projectile[i]; + Rectangle rect = proj.getRect(); + if (sVeilRectangle.Intersects(rect)) + { + if (player.whoAmI == Main.myPlayer) + { + player.noKnockback = true; + rogueStealth = rogueStealthMax; + spectralVeilImmunity = 0; + + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + + Vector2 sVeilDustDir = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); + sVeilDustDir.Normalize(); + sVeilDustDir *= 0.5f; + for (int j = 0; j < 20; j++) + { + int sVeilDustIndex1 = Dust.NewDust(player.Center, 1, 1, 21, sVeilDustDir.X * j, sVeilDustDir.Y * j); + int sVeilDustIndex2 = Dust.NewDust(player.Center, 1, 1, 21, -sVeilDustDir.X * j, -sVeilDustDir.Y * j); + Main.dust[sVeilDustIndex1].noGravity = false; + Main.dust[sVeilDustIndex1].noLight = false; + Main.dust[sVeilDustIndex2].noGravity = false; + Main.dust[sVeilDustIndex2].noLight = false; + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + break; + } + } + } + } + if (plaguedFuelPack && plaguedFuelPackDash > 0) + { + if (plaguedFuelPackDash > 1) + player.velocity = new Vector2(plaguedFuelPackDirection, -1) * 25; + else + player.velocity = new Vector2(plaguedFuelPackDirection, -1) * 5; + + int numClouds = Main.rand.Next(2, 10); + for (int i = 0; i < numClouds; i++) + { + Vector2 cloudVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + cloudVelocity.Normalize(); + cloudVelocity *= Main.rand.NextFloat(0f, 1f); + int projectile = Projectile.NewProjectile(player.Center, cloudVelocity, ModContent.ProjectileType(), 20, 0, player.whoAmI, 0, 0); + Main.projectile[projectile].timeLeft = Main.rand.Next(75, 125); + } + for (int i = 0; i < 3; i++) + { + int dust = Dust.NewDust(player.Center, 1, 1, 89, player.velocity.X * -0.1f, player.velocity.Y * -0.1f, 100, default, 3.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + } + } + #endregion + + #region StandingStillEffects + UpdateRogueStealth(); + + if (trinketOfChi) + { + if (trinketOfChiBuff) + { + player.allDamage += 0.5f; + if (player.itemAnimation > 0) + chiBuffTimer = 0; + } + if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + { + if (chiBuffTimer < 120) + chiBuffTimer++; + else + player.AddBuff(ModContent.BuffType(), 6); + } + else + chiBuffTimer--; + } + else + chiBuffTimer = 0; + + if (aquaticEmblem) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && player.wet && !player.lavaWet && !player.honeyWet && + !player.mount.Active) + { + if (aquaticBoost > 0f) + { + aquaticBoost -= 0.0002f; //0.015 + if ((double)aquaticBoost <= 0.0) + { + aquaticBoost = 0f; + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + aquaticBoost += 0.0002f; + if (aquaticBoost > 1f) + aquaticBoost = 1f; + if (player.mount.Active) + aquaticBoost = 1f; + } + player.statDefense += (int)((1f - aquaticBoost) * 30f); + player.moveSpeed -= (1f - aquaticBoost) * 0.1f; + } + else + aquaticBoost = 1f; + + if (auricBoost) + { + if (player.itemAnimation > 0) + { + modStealthTimer = 5; + } + if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + { + if (modStealthTimer == 0 && modStealth > 0f) + { + modStealth -= 0.015f; + if ((double)modStealth <= 0.0) + { + modStealth = 0f; + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + modStealth += num27 * 0.0075f; + if (modStealth > 1f) + modStealth = 1f; + if (player.mount.Active) + modStealth = 1f; + } + float damageBoost = (1f - modStealth) * 0.2f; + player.allDamage += damageBoost; + int critBoost = (int)((1f - modStealth) * 10f); + AllCritBoost(critBoost); + if (modStealthTimer > 0) + modStealthTimer--; + } + else if (pAmulet) + { + if (player.itemAnimation > 0) + { + modStealthTimer = 5; + } + if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + { + if (modStealthTimer == 0 && modStealth > 0f) + { + modStealth -= 0.015f; + if ((double)modStealth <= 0.0) + { + modStealth = 0f; + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + modStealth += num27 * 0.0075f; + if (modStealth > 1f) + modStealth = 1f; + if (player.mount.Active) + modStealth = 1f; + } + player.Calamity().throwingDamage += (1f - modStealth) * 0.2f; + player.Calamity().throwingCrit += (int)((1f - modStealth) * 10f); + player.aggro -= (int)((1f - modStealth) * 750f); + if (modStealthTimer > 0) + modStealthTimer--; + } + else + modStealth = 1f; + #endregion + + #region ElysianAegis + if (elysianAegis) + { + bool flag14 = false; + if (elysianGuard) + { + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 2, false); + } + float num29 = shieldInvinc; + shieldInvinc -= 0.08f; + if (shieldInvinc < 0f) + { + shieldInvinc = 0f; + } + else + { + flag14 = true; + } + if (shieldInvinc == 0f && num29 != shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + float damageBoost = (5f - shieldInvinc) * 0.03f; + player.allDamage += damageBoost; + int critBoost = (int)((5f - shieldInvinc) * 2f); + AllCritBoost(critBoost); + player.aggro += (int)((5f - shieldInvinc) * 220f); + player.statDefense += (int)((5f - shieldInvinc) * 4f); + player.moveSpeed *= 0.85f; + if (player.mount.Active) + { + elysianGuard = false; + } + } + else + { + float num30 = shieldInvinc; + shieldInvinc += 0.08f; + if (shieldInvinc > 5f) + { + shieldInvinc = 5f; + } + else + { + flag14 = true; + } + if (shieldInvinc == 5f && num30 != shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + if (flag14) + { + if (Main.rand.NextBool(2)) + { + Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust = Main.dust[Dust.NewDust(player.Center - vector * 30f, 0, 0, 244, 0f, 0f, 0, default, 1f)]; + dust.noGravity = true; + dust.position = player.Center - vector * (float)Main.rand.Next(5, 11); + dust.velocity = vector.RotatedBy(1.5707963705062866, default) * 4f; + dust.scale = 0.5f + Main.rand.NextFloat(); + dust.fadeIn = 0.5f; + } + if (Main.rand.NextBool(2)) + { + Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Dust dust2 = Main.dust[Dust.NewDust(player.Center - vector2 * 30f, 0, 0, 246, 0f, 0f, 0, default, 1f)]; + dust2.noGravity = true; + dust2.position = player.Center - vector2 * 12f; + dust2.velocity = vector2.RotatedBy(-1.5707963705062866, default) * 2f; + dust2.scale = 0.5f + Main.rand.NextFloat(); + dust2.fadeIn = 0.5f; + } + } + } + else + { + elysianGuard = false; + } + #endregion + + #region OtherBuffs + if (gravityNormalizer) + { + player.buffImmune[BuffID.VortexDebuff] = true; + float x = (float)(Main.maxTilesX / 4200); + x *= x; + float spaceGravityMult = (float)((double)(player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / 6.0)); + if (spaceGravityMult < 1f) + { + player.gravity = Player.defaultGravity; + if (player.wet) + { + if (player.honeyWet) + player.gravity = 0.1f; + else if (player.merman) + player.gravity = 0.3f; + else + player.gravity = 0.2f; + } + } + } + if (astralInjection) + { + if (player.statMana < player.statManaMax2) + { + player.statMana += 3; + } + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + } + if (armorCrumbling) + { + player.Calamity().throwingCrit += 5; + player.meleeCrit += 5; + } + if (armorShattering) + { + if (player.FindBuffIndex(ModContent.BuffType()) > -1) + { player.ClearBuff(ModContent.BuffType()); } + player.Calamity().throwingDamage += 0.08f; + player.meleeDamage += 0.08f; + player.Calamity().throwingCrit += 8; + player.meleeCrit += 8; + } + if (holyWrath) + { + if (player.FindBuffIndex(BuffID.Wrath) > -1) + { player.ClearBuff(BuffID.Wrath); } + player.allDamage += 0.12f; + player.moveSpeed += 0.05f; + } + if (profanedRage) + { + if (player.FindBuffIndex(BuffID.Rage) > -1) + { player.ClearBuff(BuffID.Rage); } + AllCritBoost(12); + player.moveSpeed += 0.05f; + } + if (irradiated) + { + player.statDefense -= 10; + player.allDamage += 0.05f; + player.minionKB += 0.5f; + player.moveSpeed += 0.05f; + } + if (rRage) + { + player.allDamage += 0.05f; + player.moveSpeed += 0.05f; + } + if (xRage) + { + player.allDamage += 0.1f; + } + if (xWrath) + { + AllCritBoost(5); + } + if (godSlayerCooldown) + { + player.allDamage += 0.1f; + } + if (graxDefense) + { + player.statDefense += 30; + player.endurance += 0.1f; + player.meleeDamage += 0.2f; + } + if (sMeleeBoost) + { + player.allDamage += 0.1f; + AllCritBoost(5); + } + if (tFury) + { + player.meleeDamage += 0.3f; + player.meleeCrit += 10; + } + if (yPower) + { + player.endurance += 0.05f; + player.statDefense += 5; + player.allDamage += 0.06f; + AllCritBoost(2); + player.minionKB += 1f; + player.moveSpeed += 0.15f; + } + if (tScale) + { + player.endurance += 0.05f; + player.statDefense += 5; + player.kbBuff = true; + } + if (darkSunRing) + { + player.maxMinions += 2; + player.allDamage += 0.12f; + player.minionKB += 1.2f; + player.pickSpeed -= 0.15f; + if (!Main.dayTime) + { + player.statDefense += 30; + } + } + if (eGauntlet) + { + player.longInvince = true; + player.kbGlove = true; + player.meleeDamage += 0.15f; + player.meleeCrit += 5; + player.lavaMax += 240; + } + if (fabsolVodka) + { + player.allDamage += 0.08f; + player.statDefense -= 20; + } + if (vodka) + { + player.statDefense -= 4; + player.allDamage += 0.06f; + AllCritBoost(2); + } + if (grapeBeer) + { + player.statDefense -= 2; + player.moveSpeed -= 0.05f; + } + if (moonshine) + { + player.statDefense += 10; + player.endurance += 0.05f; + } + if (rum) + { + player.moveSpeed += 0.1f; + player.statDefense -= 8; + } + if (whiskey) + { + player.statDefense -= 8; + player.allDamage += 0.04f; + AllCritBoost(2); + } + if (everclear) + { + player.statDefense -= 40; + player.allDamage += 0.25f; + } + if (bloodyMary) + { + if (Main.bloodMoon) + { + player.statDefense -= 6; + player.allDamage += 0.15f; + AllCritBoost(7); + player.moveSpeed += 0.15f; + } + } + if (tequila) + { + if (Main.dayTime) + { + player.statDefense += 5; + player.allDamage += 0.03f; + AllCritBoost(2); + player.endurance += 0.03f; + } + } + if (tequilaSunrise) + { + if (Main.dayTime) + { + player.statDefense += 15; + player.allDamage += 0.07f; + AllCritBoost(3); + player.endurance += 0.07f; + } + } + if (caribbeanRum) + { + player.moveSpeed += 0.2f; + player.statDefense -= 12; + } + if (cinnamonRoll) + { + player.statDefense -= 12; + player.manaRegenDelay--; + player.manaRegenBonus += 10; + } + if (margarita) + { + player.statDefense -= 6; + } + if (starBeamRye) + { + player.statDefense -= 6; + player.magicDamage += 0.08f; + player.manaCost *= 0.9f; + } + if (moscowMule) + { + player.allDamage += 0.09f; + AllCritBoost(3); + } + if (whiteWine) + { + player.statDefense -= 6; + player.magicDamage += 0.1f; + } + if (evergreenGin) + { + player.endurance += 0.05f; + } + if (giantPearl) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int m = 0; m < 200; m++) + { + if (Main.npc[m].active && !Main.npc[m].friendly) + { + float distance = (Main.npc[m].Center - player.Center).Length(); + if (distance < 120f) + Main.npc[m].AddBuff(ModContent.BuffType(), 20, false); + } + } + } + } + if (CalamityMod.scopedWeaponList.Contains(player.inventory[player.selectedItem].type)) + { + player.scope = true; + } + if (CalamityMod.highTestFishList.Contains(player.inventory[player.selectedItem].type)) + { + player.accFishingLine = true; + } + if (CalamityMod.boomerangList.Contains(player.inventory[player.selectedItem].type) && player.invis) + { + player.Calamity().throwingDamage += 0.1f; + } + if (CalamityMod.javelinList.Contains(player.inventory[player.selectedItem].type) && player.invis) + { + player.armorPenetration += 5; + } + if (CalamityMod.flaskBombList.Contains(player.inventory[player.selectedItem].type) && player.invis) + { + player.Calamity().throwingVelocity += 0.1f; + } + if (CalamityMod.spikyBallList.Contains(player.inventory[player.selectedItem].type) && player.invis) + { + player.Calamity().throwingCrit += 10; + } + if (etherealExtorter) + { + bool ZoneForest = !ZoneAbyss && !ZoneSulphur && !ZoneAstral && !ZoneCalamity && !ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; + if (player.ZoneUnderworldHeight && !ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type)) + { + player.endurance += 0.03f; + } + if ((player.ZoneDesert || player.ZoneUndergroundDesert) && CalamityMod.daggerList.Contains(player.inventory[player.selectedItem].type)) + { + player.scope = true; + } + if (ZoneSunkenSea) + { + player.gills = true; + player.ignoreWater = true; + } + if (player.ZoneSnow && CalamityMod.iceWeaponList.Contains(player.inventory[player.selectedItem].type)) + { + player.statDefense += 5; + } + if (ZoneAstral) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.05); + } + if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.inventory[player.selectedItem].type)) + { + player.AddBuff(165, 5, true); //Dryad's Blessing + } + if (ZoneAbyss) + { + player.blind = true; + player.headcovered = true; + player.blackout = true; + if (player.FindBuffIndex(BuffID.Shine) > -1) + { player.ClearBuff(BuffID.Shine); } + if (player.FindBuffIndex(BuffID.NightOwl) > -1) + { player.ClearBuff(BuffID.NightOwl); } + player.nightVision = false; + shine = false; + player.allDamage += 0.2f; + AllCritBoost(5); + player.statDefense += 8; + player.endurance += 0.05f; + } + if (player.ZoneRockLayerHeight && ZoneForest && CalamityMod.flaskBombList.Contains(player.inventory[player.selectedItem].type)) + { + player.blackBelt = true; + } + if (player.ZoneHoly) + { + player.maxMinions += 1; + player.manaCost *= 0.9f; + player.ammoCost75 = true; //25% chance to not use ranged ammo + throwingAmmoCost75 = true; //25% chance to not consume rogue consumables + } + if (player.ZoneBeach) + { + player.moveSpeed += 0.05f; + } + if (player.ZoneGlowshroom) + { + player.statDefense += 3; + } + if (player.ZoneMeteor) + { + gravityNormalizer = true; + player.slowFall = true; + } + if (Main.moonPhase == 0) //full moon + { + player.fishingSkill += 30; + } + if (Main.moonPhase == 6) //first quarter + { + player.discount = true; + } + } + if (harpyRing) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); + player.moveSpeed += 0.2f; + } + if (blueCandle) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.1); + player.moveSpeed += 0.15f; + } + if (plaguebringerGoliathLore) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); + } + if (soaring) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.1); + } + if (plagueReaper) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.05); + } + if (draconicSurge) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.35); + } + if (bounding) + { + player.jumpSpeedBoost += 0.5f; + Player.jumpHeight += 10; + player.extraFall += 25; + } + + if (mushy) + player.statDefense += 5; + + if (omniscience) + { + player.detectCreature = true; + player.dangerSense = true; + player.findTreasure = true; + } + + if (aWeapon) + player.moveSpeed += 0.15f; + + if (molten) + player.resistCold = true; + + if (shellBoost) + player.moveSpeed += 0.9f; + + if (tarraSet) + { + player.calmed = tarraMelee ? false : true; + player.lifeMagnet = true; + } + + if (aChicken) + { + player.statDefense += 5; + player.moveSpeed += 0.1f; + } + + if (cadence) + { + if (player.FindBuffIndex(BuffID.Regeneration) > -1) + { player.ClearBuff(BuffID.Regeneration); } + if (player.FindBuffIndex(BuffID.Lifeforce) > -1) + { player.ClearBuff(BuffID.Lifeforce); } + player.discount = true; + player.lifeMagnet = true; + player.calmed = true; + player.loveStruck = true; + player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; + } + + if (community) + { + float floatTypeBoost = 0.01f + + (NPC.downedSlimeKing ? 0.01f : 0f) + + (NPC.downedBoss1 ? 0.01f : 0f) + + (NPC.downedBoss2 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 + (NPC.downedBoss3 ? 0.01f : 0f) + + (Main.hardMode ? 0.01f : 0f) + + (NPC.downedMechBossAny ? 0.01f : 0f) + + (NPC.downedPlantBoss ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 + (NPC.downedFishron ? 0.01f : 0f) + + (NPC.downedAncientCultist ? 0.01f : 0f) + + (NPC.downedMoonlord ? 0.01f : 0f) + + (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 + (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 + (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 + int integerTypeBoost = (int)(floatTypeBoost * 50f); + int critBoost = integerTypeBoost / 2; + float damageBoost = floatTypeBoost * 0.5f; + player.endurance += floatTypeBoost * 0.25f; + player.statDefense += integerTypeBoost; + player.allDamage += damageBoost; + AllCritBoost(critBoost); + player.minionKB += floatTypeBoost; + player.moveSpeed += floatTypeBoost; + player.statLifeMax2 += player.statLifeMax / 5 / 20 * integerTypeBoost; + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.15); + } + + if (ravagerLore) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); + player.allDamage += 0.1f; + } + + if (wDeath) + { + player.statDefense -= WhisperingDeath.DefenseReduction; + player.allDamage -= 0.1f; + } + + if (aFlames) + player.statDefense -= AbyssalFlames.DefenseReduction; + + if (gsInferno) + player.statDefense -= GodSlayerInferno.DefenseReduction; + + if (astralInfection) + player.statDefense -= AstralInfectionDebuff.DefenseReduction; + + if (pFlames) + { + player.blind = true; + player.statDefense -= Plague.DefenseReduction; + player.moveSpeed -= 0.15f; + } + + if (bBlood) + { + player.blind = true; + player.statDefense -= 3; + player.moveSpeed += 0.2f; + player.meleeDamage += 0.05f; + player.rangedDamage -= 0.1f; + player.magicDamage -= 0.1f; + } + + if (horror) + { + player.blind = true; + player.statDefense -= 15; + player.moveSpeed -= 0.15f; + } + + if (aCrunch) + { + player.statDefense -= ArmorCrunch.DefenseReduction; + player.endurance *= 0.33f; + } + + if (vHex) + { + player.blind = true; + player.statDefense -= 30; + player.moveSpeed -= 0.1f; + + if (player.wingTimeMax <= 0) + player.wingTimeMax = 0; + + player.wingTimeMax /= 2; + } + + if (gState) + { + player.statDefense -= GlacialState.DefenseReduction; + player.velocity.Y = 0f; + player.velocity.X = 0f; + } + + if (eGravity) + { + if (player.wingTimeMax < 0) + player.wingTimeMax = 0; + + if (player.wingTimeMax > 400) + player.wingTimeMax = 400; + + player.wingTimeMax /= 4; + } + + if (eGrav) + { + if (player.wingTimeMax < 0) + player.wingTimeMax = 0; + + if (player.wingTimeMax > 400) + player.wingTimeMax = 400; + + player.wingTimeMax /= 2; + } + + if (molluskSet) + player.velocity.X *= 0.985f; + + if ((warped || caribbeanRum) && !player.slowFall && !player.mount.Active) + player.velocity.Y *= 1.01f; + + if (corrEffigy) + { + player.moveSpeed += 0.15f; + AllCritBoost(10); + } + + if (crimEffigy) + { + player.allDamage += 0.15f; + player.statDefense += 10; + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.8); + } + + if (badgeOfBraveryRare) + { + player.meleeDamage += 0.2f; + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); + } + + if (regenator) + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.5); + + if (calamitasLore) + { + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); + player.maxMinions += 2; + } + + // The player's true max life value with Calamity adjustments + actualMaxLife = player.statLifeMax2; + + if (thirdSageH && !player.dead && player.HasBuff(ModContent.BuffType())) + { + player.statLife = player.statLifeMax2; + } + + if (pinkCandle) + { + // every frame, add up 1/60th of the healing value (0.4% max HP per second) + pinkCandleHealFraction += player.statLifeMax2 * 0.004 / 60; + if (pinkCandleHealFraction >= 1D) + { + pinkCandleHealFraction = 0D; + if (player.statLife < player.statLifeMax2) + player.statLife++; + } + } + else + pinkCandleHealFraction = 0D; + + if (manaOverloader) + { + player.magicDamage += 0.06f; + if (player.statMana < (int)((double)player.statManaMax2 * 0.1)) + player.ghostHeal = true; + } + + if (rBrain) + { + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.75)) + player.allDamage += 0.1f; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + player.moveSpeed -= 0.05f; + } + + if (bloodyWormTooth) + { + if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) + { + player.meleeDamage += 0.1f; + player.meleeSpeed += 0.1f; + player.endurance += 0.1f; + } + else + { + player.meleeDamage += 0.05f; + player.meleeSpeed += 0.05f; + player.endurance += 0.05f; + } + } + + if (dAmulet) + { + player.panic = true; + player.pStone = true; + player.armorPenetration += 10; + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 1.35f, 0.3f, 0.9f); + } + } + + if (rampartOfDeities) + { + player.armorPenetration += 10; + player.noKnockback = true; + if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) + { + player.hasPaladinShield = true; + if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) + { + int myPlayer = Main.myPlayer; + if (Main.player[myPlayer].team == player.team && player.team != 0) + { + float arg = player.position.X - Main.player[myPlayer].position.X; + float num3 = player.position.Y - Main.player[myPlayer].position.Y; + if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) + { + Main.player[myPlayer].AddBuff(43, 20, true); + } + } + } + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(62, 5, true); + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.05f; + } + } + else if (fBulwark) + { + player.noKnockback = true; + if (player.statLife > (int)((double)player.statLifeMax2 * 0.25)) + { + player.hasPaladinShield = true; + if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) + { + int myPlayer = Main.myPlayer; + if (Main.player[myPlayer].team == player.team && player.team != 0) + { + float arg = player.position.X - Main.player[myPlayer].position.X; + float num3 = player.position.Y - Main.player[myPlayer].position.Y; + if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) + { + Main.player[myPlayer].AddBuff(43, 20, true); + } + } + } + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(62, 5, true); + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.05f; + } + } + + if (frostFlare) + { + player.resistCold = true; + player.buffImmune[44] = true; + player.buffImmune[46] = true; + player.buffImmune[47] = true; + if (player.statLife > (int)((double)player.statLifeMax2 * 0.75)) + { + player.allDamage += 0.1f; + } + if (player.statLife < (int)((double)player.statLifeMax2 * 0.25)) + { + player.statDefense += 10; + } + } + + if (vexation) + { + if (player.statLife < (int)((double)player.statLifeMax2 * 0.5)) + { + player.allDamage += 0.15f; + } + } + + if (ataxiaBlaze) + { + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.AddBuff(BuffID.Inferno, 2); + } + } + + if (bloodflareThrowing) + { + if (player.statLife > (int)((double)player.statLifeMax2 * 0.8)) + { + player.Calamity().throwingCrit += 5; + player.statDefense += 30; + } + else + { + player.Calamity().throwingDamage += 0.1f; + } + } + + if (bloodflareSummon) + { + if (player.statLife >= (int)((double)player.statLifeMax2 * 0.9)) + { + player.minionDamage += 0.1f; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.statDefense += 20; + } + if (bloodflareSummonTimer > 0) + { bloodflareSummonTimer--; } + if (player.whoAmI == Main.myPlayer && bloodflareSummonTimer <= 0) + { + bloodflareSummonTimer = 900; + for (int I = 0; I < 3; I++) + { + float ai1 = (float)(I * 120); + Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, + ModContent.ProjectileType(), (int)((auricSet ? 15000f : 5000f) * player.minionDamage), 1f, player.whoAmI, ai1, 0f); + } + } + } + + if (yInsignia) + { + player.longInvince = true; + player.kbGlove = true; + player.meleeDamage += 0.05f; + player.lavaMax += 240; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.allDamage += 0.1f; + } + } + + if (reaperToothNecklace) + { + player.allDamage += 0.25f; + player.statDefense /= 2; + } + + if (deepDiver) + { + player.allDamage += 0.15f; + player.statDefense += (int)((double)player.statDefense * 0.15); + player.moveSpeed += 0.15f; + } + + if (coreOfTheBloodGod) + { + player.endurance += 0.05f; + player.allDamage += 0.07f; + if (player.statDefense < 100) + { + player.allDamage += 0.15f; + } + } + else if (bloodflareCore) + { + if (player.statDefense < 100) + { + player.allDamage += 0.15f; + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.endurance += 0.1f; + player.allDamage += 0.2f; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.endurance += 0.05f; + player.allDamage += 0.1f; + } + } + + if (godSlayerThrowing) + { + if (player.statLife >= player.statLifeMax2) + { + player.Calamity().throwingCrit += 10; + player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingVelocity += 0.1f; + } + } + + if (tarraSummon) + { + int lifeCounter = 0; + float num2 = 300f; + bool flag = lifeCounter % 60 == 0; + int num3 = 200; + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (flag) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + p.minion = true; + p.Calamity().forceMinion = true; + } + } + } + } + } + lifeCounter++; + } + + if (player.inventory[player.selectedItem].type == ModContent.ItemType() && player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) + { + int auraCounter = 0; + float num2 = 200f; + bool flag = auraCounter % 60 == 0; + int num3 = 10; + int random = Main.rand.Next(15); + if (player.whoAmI == Main.myPlayer) + { + if (random == 0) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (flag) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + } + Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(30, 61) * 0.1f; + int num17 = Projectile.NewProjectile(nPC.Center.X, nPC.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), 5, 0f, player.whoAmI, 0f, 0f); + Main.projectile[num17].melee = false; + Main.projectile[num17].localNPCHitCooldown = -1; + } + } + } + } + } + auraCounter++; + } + + if (brimstoneElementalLore && player.inferno) + { + int num = ModContent.BuffType(); + float num2 = 300f; + bool flag = player.infernoCounter % 30 == 0; + int damage = 50; + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1 && !nPC.buffImmune[num]) + { + nPC.AddBuff(num, 120, false); + } + if (flag) + { + player.ApplyDamageToNPC(nPC, damage, 0f, 0, false); + } + } + } + } + } + + if (royalGel) + { + player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; + // LATER -- When Wulfrum Slimes start being definitely robots, remove this immunity. + player.npcTypeNoAggro[ModContent.NPCType()] = true; + } + + /*if (dukeScales) + { + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[BuffID.Poisoned] = true; + player.buffImmune[BuffID.Venom] = true; + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.75)) + { + player.allDamage += 0.03f; + AllCritBoost(3); + } + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.allDamage += 0.05f; + AllCritBoost(5); + } + if (player.lifeRegen < 0) + { + player.allDamage += 0.1f; + AllCritBoost(5); + } + }*/ + #endregion + + #region LimitsAndOtherShit + if (player.meleeSpeed < 0.5f) + { + player.meleeSpeed = 0.5f; + } + if (auricSet && silvaMelee) + { + double multiplier = (double)player.statLife / (double)player.statLifeMax2; + player.meleeDamage += (float)(multiplier * 0.2); //ranges from 1.2 times to 1 times + } + // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% + player.endurance = 1f - (1f / (1f + player.endurance)); + if (vHex) + { + player.endurance -= 0.3f; + } + if (irradiated) + { + player.endurance -= 0.1f; + } + if (corrEffigy) + { + player.endurance -= 0.2f; + } + if (Config.ProficiencyEnabled) + { + GetStatBonuses(); + } + if (dArtifact) + { + player.allDamage += 0.25f; + } + if (trippy) + { + player.allDamage += 0.5f; + } + if (eArtifact) + { + player.manaCost *= 0.85f; + player.Calamity().throwingDamage += 0.15f; + player.maxMinions += 2; + } + if (gArtifact) + { + player.maxMinions += 8; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(232f * player.minionDamage), 2f, Main.myPlayer, 0f, 0f); + } + } + } + if (pArtifact) + { + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + } + float baseDamage = 100f + + (CalamityWorld.downedDoG ? 100f : 0f) + + (CalamityWorld.downedYharon ? 100f : 0f); + if (player.maxMinions >= 8) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, ModContent.ProjectileType(), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); + } + } + if (tarraSummon || bloodflareSummon || godSlayerSummon || silvaSummon || dsSetBonus || omegaBlueSet) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(baseDamage * player.minionDamage), 1f, Main.myPlayer, 0f, 0f); + } + } + } + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || + player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || + player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1) + { + for (int projIndex = 0; projIndex < 1000; projIndex++) + { + if (Main.projectile[projIndex].active && Main.projectile[projIndex].owner == player.whoAmI) + { + if (Main.projectile[projIndex].type == ModContent.ProjectileType() || Main.projectile[projIndex].type == ModContent.ProjectileType() || + Main.projectile[projIndex].type == ModContent.ProjectileType() || Main.projectile[projIndex].type == ModContent.ProjectileType() || + Main.projectile[projIndex].type == ModContent.ProjectileType() || Main.projectile[projIndex].type == ModContent.ProjectileType()) + { + Main.projectile[projIndex].Kill(); + } + } + } + } + if (marked || reaperToothNecklace) + { + if (player.endurance > 0f) + player.endurance *= 0.5f; + } + if (yharonLore && !CalamityWorld.defiled) + { + if (player.wingTimeMax < 50000) + player.wingTimeMax = 50000; + } + + // For the stat meter + float allDamageStat = player.allDamage - 1f; + damageStats[0] = (int)((player.meleeDamage + allDamageStat - 1f) * 100f); + damageStats[1] = (int)((player.rangedDamage + allDamageStat - 1f) * 100f); + damageStats[2] = (int)((player.magicDamage + allDamageStat - 1f) * 100f); + damageStats[3] = (int)((player.minionDamage + allDamageStat - 1f) * 100f); + damageStats[4] = (int)((player.Calamity().throwingDamage + allDamageStat - 1f) * 100f); + critStats[0] = player.meleeCrit; + critStats[1] = player.rangedCrit; + critStats[2] = player.magicCrit; + critStats[3] = player.Calamity().throwingCrit; + defenseStat = player.statDefense; + DRStat = (int)(player.endurance * 100f); + meleeSpeedStat = (int)((1f - player.meleeSpeed) * (100f / player.meleeSpeed)); + manaCostStat = (int)(player.manaCost * 100f); + rogueVelocityStat = (int)((player.Calamity().throwingVelocity - 1f) * 100f); + minionSlotStat = player.maxMinions; + manaRegenStat = player.manaRegen; + armorPenetrationStat = player.armorPenetration; + moveSpeedStat = (int)((player.moveSpeed - 1f) * 100f); + wingFlightTimeStat = player.wingTimeMax; + adrenalineChargeStat = 45 - + (adrenalineBoostOne ? 10 : 0) - + (adrenalineBoostTwo ? 10 : 0) - + (adrenalineBoostThree ? 5 : 0); + bool DHorHoD = draedonsHeart || heartOfDarkness; + int rageDamageBoost = 0 + + (rageBoostOne ? (CalamityWorld.death ? 50 : 15) : 0) + + (rageBoostTwo ? (CalamityWorld.death ? 50 : 15) : 0) + + (rageBoostThree ? (CalamityWorld.death ? 50 : 15) : 0); + rageDamageStat = (CalamityWorld.death ? (DHorHoD ? 200 : 170) : (DHorHoD ? 65 : 50)) + rageDamageBoost; // Death Mode values: 2.3 and 2.0, rev: 0.65 and 0.5 + + #endregion + + #region Rogue Mirrors + Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + if (Main.rand.Next(0, 10) == 0 && player.immuneTime <= 0) + { + AbyssMirrorEvade(); + EclipseMirrorEvade(); + } + break; + } + } + } + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0) + { + Projectile proj = Main.projectile[i]; + Rectangle rect = proj.getRect(); + if (rectangle.Intersects(rect)) + { + if (Main.rand.Next(0, 10) == 0) + { + AbyssMirrorEvade(); + EclipseMirrorEvade(); + } + break; + } + } + } + #endregion } #region Dragon Scale Logic @@ -2914,7 +5643,7 @@ namespace CalamityMod.CalPlayer } #region Rogue Mirrors - public void AbyssMirrorEvade() + private void AbyssMirrorEvade() { if (player.whoAmI == Main.myPlayer && abyssalMirror && !abyssalMirrorCooldown) { @@ -2940,7 +5669,7 @@ namespace CalamityMod.CalPlayer } } - public void EclipseMirrorEvade() + private void EclipseMirrorEvade() { if (player.whoAmI == Main.myPlayer && eclipseMirror && !eclipseMirrorCooldown) { @@ -4536,7 +7265,10 @@ namespace CalamityMod.CalPlayer } if ((filthyGlove || electricianGlove) && proj.Calamity().stealthStrike && proj.Calamity().rogue) { - damageMult += 0.1; + if (nanotech) + damageMult += 0.05; + else + damageMult += 0.1; } if (etherealExtorter && proj.Calamity().rogue) { @@ -4593,9 +7325,15 @@ namespace CalamityMod.CalPlayer { damage += Main.rand.Next(20, 31); } - if (proj.Calamity().stealthStrike && proj.Calamity().rogue && electricianGlove) + if (proj.Calamity().stealthStrike && proj.Calamity().rogue && nanotech) { //Ozzatron insists on counting for edge-cases + int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, 20); //nanotech is weaker + damage += (int)(0.5f * penetratedDefense); + } + else if (proj.Calamity().stealthStrike && proj.Calamity().rogue && electricianGlove) + { int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); int penetratedDefense = Math.Min(penetratableDefense, 30); damage += (int)(0.5f * penetratedDefense); @@ -4918,9 +7656,10 @@ namespace CalamityMod.CalPlayer } } } - if (raiderTalisman && raiderStack < 250 && proj.Calamity().rogue && crit) + if (raiderTalisman && raiderStack < 250 && proj.Calamity().rogue && crit && raiderCooldown <= 0) { raiderStack++; + raiderCooldown = 30; } if (CalamityWorld.revenge && Config.AdrenalineAndRage) { @@ -8664,7 +11403,7 @@ namespace CalamityMod.CalPlayer stealthStrikeAlwaysCrits = false; } - public void UpdateRogueStealth() + private void UpdateRogueStealth() { // If the player un-equips rogue armor, then reset the sound so it'll play again when they re-equip it if (!wearingRogueArmor) @@ -8903,7 +11642,7 @@ namespace CalamityMod.CalPlayer packet.Send(-1, player.whoAmI); } - public void StressPacket(bool server) + private void StressPacket(bool server) { ModPacket packet = mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.StressSync); @@ -8916,7 +11655,7 @@ namespace CalamityMod.CalPlayer packet.Send(-1, player.whoAmI); } - public void AdrenalinePacket(bool server) + private void AdrenalinePacket(bool server) { ModPacket packet = mod.GetPacket(256); packet.Write((byte)CalamityModMessageType.AdrenalineSync); @@ -8929,6 +11668,22 @@ namespace CalamityMod.CalPlayer packet.Send(-1, player.whoAmI); } + /*private void DistanceFromBossPacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DistanceFromBossSync); + packet.Write(player.whoAmI); + packet.Write(distanceFromBoss); + if (!server) + { + packet.Send(); + } + else + { + packet.Send(-1, player.whoAmI); + } + }*/ + private void DeathPacket(bool server) { ModPacket packet = mod.GetPacket(256); @@ -9045,7 +11800,7 @@ namespace CalamityMod.CalPlayer #endregion #region Proficiency Stuff - public void GetExactLevelUp() + private void GetExactLevelUp() { if (gainLevelCooldown > 0) gainLevelCooldown--; @@ -9452,7 +12207,7 @@ namespace CalamityMod.CalPlayer } } - public void GetStatBonuses() + private void GetStatBonuses() { #region MeleeLevelBoosts if (meleeLevel >= 12500) diff --git a/CalamityMod.cs b/CalamityMod.cs index e98998037d..dde896fbb5 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1968,7 +1968,8 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; flaskBombProjList = new List() @@ -1983,7 +1984,8 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType() }; spikyBallList = new List() diff --git a/Items/Accessories/BloomStone.cs b/Items/Accessories/BloomStone.cs index 1a2a2a3af4..b30a539f2e 100644 --- a/Items/Accessories/BloomStone.cs +++ b/Items/Accessories/BloomStone.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -53,10 +54,9 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); } } } @@ -64,9 +64,6 @@ namespace CalamityMod.Items.Accessories } } bloomCounter++; - if (bloomCounter >= 180) - { - } if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) { int num4 = (int)player.Center.X / 16; diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index 0f877d3c59..4efd95bcc2 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -73,10 +73,9 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); } } } @@ -84,9 +83,6 @@ namespace CalamityMod.Items.Accessories } } seaCounter++; - if (seaCounter >= 180) - { - } } } } diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 9a5de3067b..6c8860a212 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -34,12 +34,12 @@ namespace CalamityMod.Items.Accessories { line2.text = "Rogue projectiles create nanoblades as they travel\n" + "Stealth strikes summon lunar flares and sparks on enemy hits\n" + - "Stealth strikes have +30 armor penetration, deal 10% more damage, and heal for 1 HP\n" + + "Stealth strikes have +20 armor penetration, deal 5% more damage, and heal for 1 HP\n" + "Rogue weapons have a chance to instantly kill normal enemies\n" + "5% increased rogue damage, 5% increased rogue crit chance, and 15% increased rogue velocity\n" + "Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" + "This effect can stack up to 250 times\n" + - "Max rogue damage boost is 25%\n" + + "Max rogue damage boost is 10%\n" + "Rogue Crit Level: " + critLevel; } } @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.nanotech = true; - modPlayer.moonCrown = true; modPlayer.raiderTalisman = true; modPlayer.electricianGlove = true; player.Calamity().throwingDamage += 0.05f; diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index 3cd9b72779..cc33b3d11b 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -73,10 +74,11 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + p.minion = true; + p.Calamity().forceMinion = true; } } } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index c1ad433bfb..714d62af2c 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -141,10 +141,11 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + p.minion = true; + p.Calamity().forceMinion = true; } } } diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index 3bb39cf667..05cd3d3166 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -48,10 +49,11 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + p.minion = true; + p.Calamity().forceMinion = true; } } } diff --git a/Items/Armor/PlagueReaperMask.cs b/Items/Armor/PlagueReaperMask.cs index 9c99da6e57..77df8d18a0 100644 --- a/Items/Armor/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaperMask.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); item.rare = 8; - item.defense = 12; //45 + item.defense = 9; //35 } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/PlagueReaperStriders.cs b/Items/Armor/PlagueReaperStriders.cs index b8284a5238..286c290dc4 100644 --- a/Items/Armor/PlagueReaperStriders.cs +++ b/Items/Armor/PlagueReaperStriders.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 18, 0, 0); item.rare = 8; - item.defense = 15; + item.defense = 11; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/PlagueReaperVest.cs b/Items/Armor/PlagueReaperVest.cs index 8d0dfff39d..797920e71e 100644 --- a/Items/Armor/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaperVest.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 24, 0, 0); item.rare = 8; - item.defense = 18; + item.defense = 14; } public override void UpdateEquip(Player player) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index f07e4cf54f..284fb43305 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1886,6 +1886,7 @@ Grants immunity to fire blocks, and temporary immunity to lava"; case ItemID.HallowedFishingCrate: DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.2f, 5, 10); + DropHelper.DropItemCondition(player, (WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType()), CalamityWorld.downedProvidence, 0.2f, 1, 3); break; case ItemID.DungeonFishingCrate: diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index ebd64a48af..e88f901d70 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -46,6 +46,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches DropHelper.DropItem(player, ItemID.Starfish, 2, 3); DropHelper.DropItem(player, ItemID.Seashell, 2, 3); DropHelper.DropItem(player, ItemID.Coral, 2, 3); + DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 2, 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 2, 3); if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs new file mode 100644 index 0000000000..094fea7b29 --- /dev/null +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -0,0 +1,64 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles.Magic; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class AbyssShocker : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Shocker"); + Tooltip.SetDefault("Fires an erratic lightning bolt that arcs and bounces between enemies"); + } + + public override void SetDefaults() + { + item.damage = 24; + item.noMelee = true; + item.magic = true; + item.channel = true; + item.width = 86; + item.height = 32; + item.useTime = 50; + item.useAnimation = 20; + item.UseSound = SoundID.Item13; + item.useStyle = 5; + item.mana = 10; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.Calamity().postMoonLordRarity = 21; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/AbyssShocker_mask"); + spriteBatch.Draw + ( + texture, + new Vector2 + ( + item.position.X - Main.screenPosition.X + item.width * 0.5f, + item.position.Y - Main.screenPosition.Y + item.height - texture.Height * 0.5f + 2f + ), + new Rectangle(0, 0, texture.Width, texture.Height), + Color.White, + rotation, + texture.Size() * 0.5f, + scale, + SpriteEffects.None, + 0f + ); + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-14, 0); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Magic/AbyssShocker.png b/Items/Weapons/Magic/AbyssShocker.png new file mode 100644 index 0000000000..9263d1a1b3 Binary files /dev/null and b/Items/Weapons/Magic/AbyssShocker.png differ diff --git a/Items/Weapons/Magic/AbyssShocker_mask.png b/Items/Weapons/Magic/AbyssShocker_mask.png new file mode 100644 index 0000000000..51925f14ea Binary files /dev/null and b/Items/Weapons/Magic/AbyssShocker_mask.png differ diff --git a/Items/Weapons/Magic/ClamorNoctus.cs b/Items/Weapons/Magic/ClamorNoctus.cs index 4f5e6d2639..92ca25c461 100644 --- a/Items/Weapons/Magic/ClamorNoctus.cs +++ b/Items/Weapons/Magic/ClamorNoctus.cs @@ -21,7 +21,7 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e public override void SetDefaults() { - item.damage = 300; + item.damage = 450; item.magic = true; item.mana = 12; item.width = 52; @@ -37,7 +37,7 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e item.UseSound = SoundID.Item105; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + item.shootSpeed = 25f; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 6aec678d06..2a229734d9 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -11,9 +11,6 @@ namespace CalamityMod.Items.Weapons.Magic { public class HeliumFlash : ModItem { - public static int BaseDamage = 1280; - public static float Speed = 15f; - public override void SetStaticDefaults() { DisplayName.SetDefault("Helium Flash"); @@ -26,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = 76; item.height = 76; item.magic = true; - item.damage = BaseDamage; + item.damage = 1280; item.knockBack = 9.5f; item.mana = 26; item.useAnimation = 37; @@ -42,12 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic item.value = Item.buyPrice(1, 80, 0, 0); item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - } - - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); + item.shootSpeed = 15f; } // Creates dust at the tip of the staff when used. diff --git a/Items/Weapons/Magic/StratusSphere.cs b/Items/Weapons/Magic/StratusSphere.cs new file mode 100644 index 0000000000..6b975065a9 --- /dev/null +++ b/Items/Weapons/Magic/StratusSphere.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class StratusSphere : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stratus Sphere"); + Tooltip.SetDefault("Fires an energy orb containing the essence of our stratosphere\n" + + "Up to six of these can be active at a time"); + } + public override void SetDefaults() + { + item.damage = 500; + item.noMelee = true; + item.magic = true; + item.width = 50; + item.height = 50; + item.useTime = 45; + item.useAnimation = 45; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7f; + item.useStyle = 5; + item.mana = 30; + item.knockBack = 2; + item.UseSound = SoundID.Item20; + item.rare = 4; + item.autoReuse = true; + item.useTurn = true; + item.holdStyle = 3; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + if (player.ownedProjectileCounts[item.shoot] >= 6) + { + return false; + } + else + { + return true; + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.NebulaArcanum); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} + diff --git a/Items/Weapons/Magic/StratusSphere.png b/Items/Weapons/Magic/StratusSphere.png new file mode 100644 index 0000000000..c948342b48 Binary files /dev/null and b/Items/Weapons/Magic/StratusSphere.png differ diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 1c1ef8517a..3bd257f851 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -11,24 +11,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Air Spinner"); - Tooltip.SetDefault("Fires feathers when enemies are near"); + Tooltip.SetDefault("Fires feathers when enemies are near\nAn exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Valor); + item.width = 28; + item.height = 28; + item.melee = true; item.damage = 20; + item.knockBack = 4f; item.useTime = 22; item.useAnimation = 22; + item.autoReuse = true; + item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; - item.melee = true; - item.knockBack = 4; - item.value = Item.buyPrice(0, 4, 0, 0); + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + item.rare = 3; - item.autoReuse = false; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(gold: 4); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index f6a7e3481e..83390a98b1 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -11,23 +11,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Aorta"); + Tooltip.SetDefault("An exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Valor); + item.width = 30; + item.height = 26; + item.melee = true; item.damage = 25; + item.knockBack = 4.25f; item.useTime = 22; item.useAnimation = 22; + item.autoReuse = true; + item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; - item.melee = true; - item.knockBack = 4.25f; - item.value = Item.buyPrice(0, 4, 0, 0); + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 8f; + item.rare = 3; - item.autoReuse = false; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(gold: 4); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index 04a88b0927..b617ed98ba 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -12,26 +12,36 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Azathoth"); - Tooltip.SetDefault("Destroy the universe in the blink of an eye\n" + - "Fires cosmic orbs that blast nearby enemies with lasers"); + Tooltip.SetDefault("Fires cosmic orbs that blast nearby enemies with lasers\nAn exceptionally agile yoyo\n'Destroy the universe in the blink of an eye'"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Kraken); + item.width = 30; + item.height = 26; + item.melee = true; item.damage = 200; + item.knockBack = 6f; item.useTime = 20; item.useAnimation = 20; + item.autoReuse = true; + item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; - item.melee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(5, 0, 0, 0); + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); item.Calamity().postMoonLordRarity = 16; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 5); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Chaotrix.cs b/Items/Weapons/Melee/Chaotrix.cs index 6ab047c487..a3c79c3e05 100644 --- a/Items/Weapons/Melee/Chaotrix.cs +++ b/Items/Weapons/Melee/Chaotrix.cs @@ -11,24 +11,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Chaotrix"); - Tooltip.SetDefault("Explodes on enemy hits"); + Tooltip.SetDefault("Explodes on enemy hits\nAn exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Yelets); - item.damage = 110; + item.width = 30; + item.height = 26; + item.melee = true; + item.damage = 88; // 110 pre-nerf + item.knockBack = 4f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.rare = 8; + item.value = Item.buyPrice(gold: 80); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Cnidarian.cs b/Items/Weapons/Melee/Cnidarian.cs index 453b2616d8..830a0a369b 100644 --- a/Items/Weapons/Melee/Cnidarian.cs +++ b/Items/Weapons/Melee/Cnidarian.cs @@ -12,23 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Cnidarian"); Tooltip.SetDefault("Fires a seashell when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.CorruptYoyo); + item.width = 30; + item.height = 26; + item.melee = true; item.damage = 13; + item.knockBack = 3f; item.useTime = 25; item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.rare = 2; + item.value = Item.buyPrice(gold: 2); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs new file mode 100644 index 0000000000..a99abd4b4e --- /dev/null +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -0,0 +1,58 @@ +using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class CrescentMoon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crescent Moon"); + Tooltip.SetDefault("People wanted the moon, let's bring the moon to them.\n" + + "Fires a whip sword that summons homing crescent moons"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.damage = 500; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.autoReuse = true; + item.melee = true; + item.useAnimation = 18; + item.useTime = 18; + item.useStyle = 5; + item.knockBack = 4f; + item.UseSound = SoundID.Item82; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 13; + item.shootSpeed = 24f; + item.shoot = ModContent.ProjectileType(); + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float ai3 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; //0.5 + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, ai3); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Melee/CrescentMoon.png b/Items/Weapons/Melee/CrescentMoon.png new file mode 100644 index 0000000000..f904a47c3e Binary files /dev/null and b/Items/Weapons/Melee/CrescentMoon.png differ diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index 44e391521e..90d2811c54 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class DragonPow : ModItem { - public static int BaseDamage = 11800; + public static int BaseDamage = 7670; public static float Speed = 13f; public static float ReturnSpeed = 20f; public static float SparkSpeed = 0.6f; diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index c11d26028b..eaf40852c1 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 18; - item.damage = 1100; + item.damage = 600; item.melee = true; item.noMelee = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs new file mode 100644 index 0000000000..ae2d0ab12d --- /dev/null +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -0,0 +1,95 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class GalileoGladius : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galileo Gladius"); + Tooltip.SetDefault("Don't underestimate the power of small space swords\n" + + "Shoots a homing crescent moon\n" + + "Spawns planetoids on enemy hits"); + } + + public override void SetDefaults() + { + item.useStyle = 3; + item.useTurn = false; + item.useAnimation = 10; + item.useTime = 10; + item.width = 44; + item.height = 44; + item.damage = 300; + item.melee = true; + item.knockBack = 10f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 13; + } + + 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, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, (Main.rand.NextBool(2) ? 20 : 176), (float)(player.direction * 2), 0f, 150, default, 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 25; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + if (player.whoAmI == Main.myPlayer) + { + if (player.Calamity().galileoCooldown <= 0) + { + int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)((float)item.damage * player.meleeDamage * 2f), 15f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + player.Calamity().galileoCooldown = 15; + } + } + } + } +} diff --git a/Items/Weapons/Melee/GalileoGladius.png b/Items/Weapons/Melee/GalileoGladius.png new file mode 100644 index 0000000000..221da36309 Binary files /dev/null and b/Items/Weapons/Melee/GalileoGladius.png differ diff --git a/Items/Weapons/Melee/GreatswordofBlah.cs b/Items/Weapons/Melee/GreatswordofBlah.cs index ddf1ab965d..134891cf55 100644 --- a/Items/Weapons/Melee/GreatswordofBlah.cs +++ b/Items/Weapons/Melee/GreatswordofBlah.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 110; - item.damage = 480; + item.damage = 300; item.melee = true; item.useAnimation = 18; item.useStyle = 1; diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index 33c2ec7326..36b13272ee 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -11,26 +11,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Lacerator"); - Tooltip.SetDefault("Enemies that are hit by the yoyo will have their life drained\n" + - "Someone thought this was a viable weapon against DoG at one point lol"); + Tooltip.SetDefault("Enemies that are hit by the yoyo will have their life drained\nAn exceptionally agile yoyo\n'Someone thought this was a viable weapon against DoG at one point lol'"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 30; + item.height = 26; + item.melee = true; item.damage = 150; + item.knockBack = 7f; item.useTime = 20; item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + + item.rare = 10; item.Calamity().postMoonLordRarity = 13; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 1, gold: 40); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index 4c01a6ac4d..9f6fc0a9f1 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 = 1100; + public static int BaseDamage = 800; public static float ShootSpeed = 12f; public override void SetStaticDefaults() diff --git a/Items/Weapons/Melee/Oracle.cs b/Items/Weapons/Melee/Oracle.cs index b9fd0539ad..e974ecba00 100644 --- a/Items/Weapons/Melee/Oracle.cs +++ b/Items/Weapons/Melee/Oracle.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -11,36 +10,38 @@ namespace CalamityMod.Items.Weapons.Melee { public class Oracle : ModItem { - public static int BaseDamage = 480; - public override void SetStaticDefaults() { DisplayName.SetDefault("The Oracle"); - Tooltip.SetDefault("Emits an aura of red lightning\nFires auric orbs when supercharged\nHitting enemies charges the yoyo\n'Gaze into the past, the present, the future... and the circumstances of your inevitable demise'"); + Tooltip.SetDefault("Emits an aura of red lightning which charges up when hitting enemies\nFires auric orbs when supercharged\nAn exceptionally agile yoyo\n'Gaze into the past, the present, the future... and the circumstances of your inevitable demise'"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Kraken); - ItemID.Sets.Yoyo[item.type] = true; - item.width = 54; item.height = 42; item.melee = true; - item.damage = BaseDamage; + item.damage = 420; item.knockBack = 4f; item.useTime = 20; item.useAnimation = 20; item.autoReuse = true; item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; item.rare = 10; item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(2, 50, 0, 0); - - item.shoot = ModContent.ProjectileType(); + item.value = Item.buyPrice(platinum: 2, gold: 50); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/Quagmire.cs b/Items/Weapons/Melee/Quagmire.cs index 785949619e..bd2ecd28a2 100644 --- a/Items/Weapons/Melee/Quagmire.cs +++ b/Items/Weapons/Melee/Quagmire.cs @@ -12,25 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Quagmire"); Tooltip.SetDefault("Fires spore clouds"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.HelFire); item.width = 30; item.height = 36; + item.melee = true; item.damage = 52; + item.knockBack = 3.5f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.rare = 7; + item.value = Item.buyPrice(gold: 60); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index 55d3754251..0467808069 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 = 2200; + item.damage = 1550; item.melee = true; item.noMelee = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/Shimmerspark.cs b/Items/Weapons/Melee/Shimmerspark.cs index f4ca5f6ef9..c303468917 100644 --- a/Items/Weapons/Melee/Shimmerspark.cs +++ b/Items/Weapons/Melee/Shimmerspark.cs @@ -12,23 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Shimmerspark"); Tooltip.SetDefault("Fires stars when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Chik); + item.width = 50; + item.height = 36; + item.melee = true; item.damage = 36; + item.knockBack = 3.5f; item.useTime = 25; item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + + item.rare = 5; + item.value = Item.buyPrice(gold: 36); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/SolarFlare.cs b/Items/Weapons/Melee/SolarFlare.cs index d8fed7e8bb..534a992a3d 100644 --- a/Items/Weapons/Melee/SolarFlare.cs +++ b/Items/Weapons/Melee/SolarFlare.cs @@ -10,25 +10,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Solar Flare"); - Tooltip.SetDefault("Emits large holy explosions on hit"); + Tooltip.SetDefault("Emits large holy explosions on hit\nAn exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 40; + item.height = 38; + item.melee = true; item.damage = 60; + item.knockBack = 7.5f; item.useTime = 20; item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; item.autoReuse = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + + item.rare = 10; item.Calamity().postMoonLordRarity = 12; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 1, gold: 20); } } } diff --git a/Items/Weapons/Melee/TheEyeofCalamitas.cs b/Items/Weapons/Melee/TheEyeofCalamitas.cs index 56f329ac8e..8f21300764 100644 --- a/Items/Weapons/Melee/TheEyeofCalamitas.cs +++ b/Items/Weapons/Melee/TheEyeofCalamitas.cs @@ -11,23 +11,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Oblivion"); Tooltip.SetDefault("Fires brimstone lasers when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 28; + item.height = 38; + item.melee = true; item.damage = 41; + item.knockBack = 4f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.rare = 7; + item.value = Item.buyPrice(gold: 60); } } } diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index 460e17d929..b4860c4b8e 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -12,23 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("The God's Gambit"); Tooltip.SetDefault("Fires a stream of slime when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(3291); + item.width = 40; + item.height = 26; + item.melee = true; item.damage = 28; + item.knockBack = 3.5f; item.useTime = 21; item.useAnimation = 21; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.rare = 4; + item.value = Item.buyPrice(gold: 12); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs index d03e440dd7..919f854634 100644 --- a/Items/Weapons/Melee/TheMicrowave.cs +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -10,26 +10,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("The Microwave"); - //Tooltip.SetDefault("MMMMMMMMMMMMMM, 13th letter of the alphabet moments"); - Tooltip.SetDefault("Baking enemies in the astral infection\n\n" + - "Summons an aura around the yoyo that damages nearby enemies"); + //Tooltip.SetDefault("MMMMMMMMMMMMM"); + Tooltip.SetDefault("Fries nearby enemies with radiation\nAn exceptionally agile yoyo\n'Cooking, Astral Infection style'"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 34; + item.height = 34; + item.melee = true; item.damage = 80; + item.knockBack = 3f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.rare = 9; + item.value = Item.buyPrice(gold: 95); } } } diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index ded5f2aca3..8359146dc9 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -10,25 +10,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("The Obliterator"); - Tooltip.SetDefault("Fires death lasers when enemies are near"); + Tooltip.SetDefault("Ruins nearby enemies with death lasers\nAn exceptionally agile yoyo\n"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 240; + item.width = 42; + item.height = 40; + item.melee = true; + item.damage = 370; + item.knockBack = 7.5f; item.useTime = 20; item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.autoReuse = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + + item.rare = 10; item.Calamity().postMoonLordRarity = 13; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 1, gold: 40); } } } diff --git a/Items/Weapons/Melee/ThePlaguebringer.cs b/Items/Weapons/Melee/ThePlaguebringer.cs index 6e582ced72..5657766a41 100644 --- a/Items/Weapons/Melee/ThePlaguebringer.cs +++ b/Items/Weapons/Melee/ThePlaguebringer.cs @@ -11,23 +11,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Pandemic"); Tooltip.SetDefault("Fires plague seekers when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 30; + item.height = 32; + item.melee = true; item.damage = 100; + item.knockBack = 2.5f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.rare = 8; + item.value = Item.buyPrice(gold: 80); } } } diff --git a/Items/Weapons/Melee/Verdant.cs b/Items/Weapons/Melee/Verdant.cs index db902cbdbb..2fb5164206 100644 --- a/Items/Weapons/Melee/Verdant.cs +++ b/Items/Weapons/Melee/Verdant.cs @@ -11,25 +11,36 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Verdant"); - Tooltip.SetDefault("Fires crystal leafs when enemies are near"); + Tooltip.SetDefault("Fires crystal leaves when enemies are near\nAn exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Kraken); + item.width = 30; + item.height = 30; + item.melee = true; item.damage = 218; + item.knockBack = 6f; item.useTime = 22; item.useAnimation = 22; + item.autoReuse = true; + item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; - item.melee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(1, 20, 0, 0); + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); item.Calamity().postMoonLordRarity = 12; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 1, gold: 20); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Whirlpool.cs b/Items/Weapons/Melee/Whirlpool.cs index 0f264976a1..7a33f3adc7 100644 --- a/Items/Weapons/Melee/Whirlpool.cs +++ b/Items/Weapons/Melee/Whirlpool.cs @@ -12,26 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Riptide"); Tooltip.SetDefault("Sprays a spiral of aqua streams in random directions"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 18; item.width = 30; item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.knockBack = 1f; - item.channel = true; item.melee = true; - item.useStyle = 5; - item.useAnimation = 25; + item.damage = 18; + item.knockBack = 1f; item.useTime = 25; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + item.useAnimation = 25; + item.autoReuse = true; + + item.useStyle = 5; item.UseSound = SoundID.Item1; - ItemID.Sets.Yoyo[item.type] = true; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 18f; + + item.rare = 2; + item.value = Item.buyPrice(gold: 2); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index 1049f12f8f..9f6998ec83 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -9,26 +9,36 @@ namespace CalamityMod.Items.Weapons.Melee { public override void SetStaticDefaults() { - DisplayName.SetDefault("YinYo"); + DisplayName.SetDefault("Yin-Yo"); Tooltip.SetDefault("Fires light or dark shards when enemies are near\n" + "Light shards fly up and down while dark shards fly left and right"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Chik); + item.width = 26; + item.height = 24; + item.melee = true; item.damage = 34; + item.knockBack = 3.5f; item.useTime = 25; item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; item.autoReuse = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + item.shootSpeed = 12f; + + item.rare = 5; + item.value = Item.buyPrice(gold: 36); } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index 9bb415b481..8f2f053ae5 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -10,8 +10,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public class AngelicShotgun : ModItem { - private static int BaseDamage = 150; - private static int NumBullets = 8; + private static int BaseDamage = 120; private static float BulletSpeed = 13f; public override void SetStaticDefaults() @@ -32,8 +31,8 @@ Fighting 'til the war's won"); item.width = 44; item.height = 7; - item.useTime = 14; - item.useAnimation = 14; + item.useTime = 21; + item.useAnimation = 21; item.UseSound = SoundID.Item38; item.useStyle = 5; @@ -53,6 +52,7 @@ Fighting 'til the war's won"); 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 NumBullets = Main.rand.Next(6,9); Vector2 baseVelocity = new Vector2(speedX, speedY).SafeNormalize(Vector2.Zero) * BulletSpeed; // Fire a shotgun spread of bullets. diff --git a/Items/Weapons/Ranged/GreatbowofTurmoil.cs b/Items/Weapons/Ranged/GreatbowofTurmoil.cs index 313efab401..bcefb0140b 100644 --- a/Items/Weapons/Ranged/GreatbowofTurmoil.cs +++ b/Items/Weapons/Ranged/GreatbowofTurmoil.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Ranged default: break; } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.5f), knockBack, player.whoAmI, 0f, 0f); Main.projectile[index].noDropItem = true; } return false; diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index 27d40f4890..7d44b2cec1 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.useAnimation = 25; item.useTime = 25; - item.damage = 50; + item.damage = 60; item.crit = 8; item.shootSpeed = 8f; item.shoot = ModContent.ProjectileType(); @@ -40,7 +40,12 @@ 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) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + float speedMult = 1f; + if (player.Calamity().StealthStrikeAvailable()) + { + speedMult = 1.25f; + } + int proj = Projectile.NewProjectile(position, new Vector2(speedX * speedMult, speedY * speedMult), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); if (player.Calamity().StealthStrikeAvailable()) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/DesecratedWater.cs b/Items/Weapons/Rogue/DesecratedWater.cs index d8bb2d81be..fb8ef41490 100644 --- a/Items/Weapons/Rogue/DesecratedWater.cs +++ b/Items/Weapons/Rogue/DesecratedWater.cs @@ -53,7 +53,7 @@ Stealth strikes spawn additional bubbles that inflict Ichor and Cursed Inferno") recipe.AddRecipeGroup("AnyEvilWater", 100); recipe.AddIngredient(ItemID.HallowedBar, 5); recipe.AddRecipeGroup("CursedFlameIchor", 5); - recipe.AddIngredient(ItemID.SoulofLight, 7); + recipe.AddIngredient(ItemID.SoulofNight, 7); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs index 09401b0638..f4351d3219 100644 --- a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs +++ b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 18; - item.damage = 1100; + item.damage = 600; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 15; diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 2cae553eb0..da370fbf90 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 64; - item.damage = 475; + item.damage = 420; item.noMelee = true; item.noUseGraphic = true; item.useTime = 3; diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index 0ea360ab65..4f153d8685 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.value = Item.buyPrice(1, 80, 0, 0); item.rare = 10; - item.damage = 1800; + item.damage = 1600; item.useAnimation = 40; item.useTime = 40; item.crit = 16; diff --git a/Items/Weapons/Rogue/ProfanedTrident.cs b/Items/Weapons/Rogue/ProfanedTrident.cs index 427f2f9968..b7481dff91 100644 --- a/Items/Weapons/Rogue/ProfanedTrident.cs +++ b/Items/Weapons/Rogue/ProfanedTrident.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 72; - item.damage = 1500; + item.damage = 1000; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 13; diff --git a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs index f08f4f3878..05ef663de7 100644 --- a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs +++ b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 18; - item.damage = 2200; + item.damage = 1550; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 20; diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs new file mode 100644 index 0000000000..3d44ae0a60 --- /dev/null +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -0,0 +1,69 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class ShockGrenade : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shock Grenade"); + Tooltip.SetDefault("Throws a grenade that explodes into a burst of lightning\n" + + "Stealth strikes cause the grenade to leave an electrifying aura when it explodes"); + } + + public override void SafeSetDefaults() + { + item.width = 14; + item.damage = 100; + item.noMelee = true; + item.noUseGraphic = true; + item.consumable = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 1f; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 8; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7.5f; + 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) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[p].Calamity().stealthStrike = true; + return false; + } + return true; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(item.width / 2, item.height / 2); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Grenade, 10); + recipe.AddIngredient(ItemID.MartianConduitPlating, 2); + recipe.AddIngredient(ItemID.Nanites, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this, 10); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Rogue/ShockGrenade.png b/Items/Weapons/Rogue/ShockGrenade.png new file mode 100644 index 0000000000..9d72d6d1f6 Binary files /dev/null and b/Items/Weapons/Rogue/ShockGrenade.png differ diff --git a/Items/Weapons/Rogue/ShockGrenadeGlow.png b/Items/Weapons/Rogue/ShockGrenadeGlow.png new file mode 100644 index 0000000000..1dc546dcbe Binary files /dev/null and b/Items/Weapons/Rogue/ShockGrenadeGlow.png differ diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index 8ab7e061a8..572adae7c0 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 0; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7.5f; + item.shootSpeed = 10f; item.Calamity().rogue = true; } diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 633c898116..162b8f44b1 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -42,5 +44,16 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.SetResult(this, 50); recipe.AddRecipe(); } + + 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.Calamity().StealthStrikeAvailable()) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY) * 1.3f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().stealthStrike = true; + return false; + } + return true; + } } } diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs new file mode 100644 index 0000000000..04101457b6 --- /dev/null +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -0,0 +1,73 @@ +using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class WulfrumController : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Controller"); + Tooltip.SetDefault("Summons a wulfrum droid to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 10; + item.mana = 10; + item.width = 28; + item.height = 20; + item.useTime = 36; + item.useAnimation = 36; + item.useStyle = 4; + item.noMelee = true; + item.knockBack = 0.5f; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item15; //phaseblade sound effect + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 9); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/WulfrumController.png b/Items/Weapons/Summon/WulfrumController.png new file mode 100644 index 0000000000..c419f9b6ac Binary files /dev/null and b/Items/Weapons/Summon/WulfrumController.png differ diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index a3e9c73d60..0a0b066222 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -374,7 +374,8 @@ namespace CalamityMod new List() {ModContent.ItemType(), ModContent.ItemType()}, new List() {ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ItemID.SuperHealingPotion}, "Use a [i:" + ModContent.ItemType() + "] in Space", - "[c/EE82EE:Storm Weaver hid itself once again within the stormfront.]"); + "[c/EE82EE:Storm Weaver hid itself once again within the stormfront.]", + "CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist"); //Signus bossChecklist.Call( diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 7f3d2f6f63..c5a4e36b01 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Magic; namespace CalamityMod.NPCs.Abyss { @@ -209,5 +210,10 @@ namespace CalamityMod.NPCs.Abyss } } } + + public override void NPCLoot() + { + DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, Main.expertMode ? 40 : 50, 1, 1); + } } } diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 74101c1811..254cd17a05 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -194,6 +195,7 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { + DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, 10, 1, 1); if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 183c4cfc2b..b475af11dc 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -98,6 +98,7 @@ namespace CalamityMod.NPCs public int silvaStun = 0; public int webbed = 0; public int slowed = 0; + public int electrified = 0; public int yellowCandle = 0; public int pearlAura = 0; public int wCleave = 0; @@ -544,6 +545,10 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage); + if (npc.velocity.X == 0) + ApplyDPSDebuff(electrified, 4, 2, ref npc.lifeRegen, ref damage); + else + ApplyDPSDebuff(electrified, 16, 16, ref npc.lifeRegen, ref damage); } public void ApplyDPSDebuff(int debuff, int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage) @@ -611,6 +616,7 @@ namespace CalamityMod.NPCs npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Webbed] = true; npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Electrified] = true; } if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) @@ -2121,6 +2127,8 @@ namespace CalamityMod.NPCs webbed--; if (slowed > 0) slowed--; + if (electrified > 0) + electrified--; if (yellowCandle > 0) yellowCandle--; if (pearlAura > 0) @@ -3189,6 +3197,21 @@ namespace CalamityMod.NPCs } } } + if (electrified > 0) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 132, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.1f; + Main.dust[dust].velocity.Y += 0.25f; + if (Main.rand.NextBool(2)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + } if (gState > 0 || eFreeze > 0) { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index b91f7e069a..49b7344778 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1667,6 +1667,18 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedBuffedMothron, Main.expertMode ? 0.06f : 0.04f, 1, 1); break; + case NPCID.MartianOfficer: + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4, 3, 8); + break; + case NPCID.BrainScrambler: + case NPCID.GrayGrunt: + case NPCID.GigaZapper: + case NPCID.MartianEngineer: + case NPCID.RayGunner: + case NPCID.ScutlixRider: + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5, 1, 4); + break; + default: break; } diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 9d8de958ba..d73c470299 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -37,6 +37,8 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 571900e40d..e94a587092 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -36,6 +36,8 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index ece671a39b..b9e74330c0 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -36,6 +36,8 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 41fb9ac6ef..dd0a5c04df 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -43,6 +43,8 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 0dee77d5c0..5ae91b2cdb 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -44,6 +44,8 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index eb014aabe8..8a334cb707 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -42,6 +42,8 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 04e36b42e7..e55b97bfb1 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -34,6 +34,8 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index bc740c8b2f..6d5dc3f7f9 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -34,6 +34,8 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index b389a650fb..95cbee6084 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -35,6 +35,8 @@ namespace CalamityMod.NPCs.Perforator npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 8d7072cdc0..2555876697 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -34,6 +34,8 @@ namespace CalamityMod.NPCs.SlimeGod aiType = -1; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.knockBackResist = 0f; animationType = 50; npc.value = 0f; diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 41d2e36586..31d1aa73c8 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -34,6 +34,8 @@ namespace CalamityMod.NPCs.SlimeGod animationType = 50; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; npc.value = 0f; npc.alpha = 60; npc.lavaImmune = false; diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 2b39aaca2c..4c136c162d 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -33,6 +33,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.knockBackResist = 0f; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; animationType = 50; npc.value = Item.buyPrice(0, 1, 0, 0); npc.alpha = 60; diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index fe49f1d8c4..27cb6b6f12 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -35,6 +35,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.knockBackResist = 0f; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Webbed] = true; animationType = 50; npc.value = Item.buyPrice(0, 1, 0, 0); npc.alpha = 60; diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 470bba8656..a0e43df825 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -1,4 +1,5 @@ using CalamityMod.World; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -257,6 +258,10 @@ namespace CalamityMod.NPCs.StormWeaver { damage /= projectile.penetrate; } + if (projectile.type == ModContent.ProjectileType()) + { + damage /= 2; + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 344bfca599..5b0b2722b0 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.World; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -553,6 +554,10 @@ namespace CalamityMod.NPCs.StormWeaver { damage /= projectile.penetrate; } + if (projectile.type == ModContent.ProjectileType()) + { + damage /= 2; + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index ddfbbc1053..b6c6ea6c43 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -1,4 +1,5 @@ using CalamityMod.World; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -245,6 +246,10 @@ namespace CalamityMod.NPCs.StormWeaver { damage /= projectile.penetrate; } + if (projectile.type == ModContent.ProjectileType()) + { + damage /= 2; + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/StormWeaver/StormWeaver_BossChecklist.png b/NPCs/StormWeaver/StormWeaver_BossChecklist.png new file mode 100644 index 0000000000..b9c3f3740e Binary files /dev/null and b/NPCs/StormWeaver/StormWeaver_BossChecklist.png differ diff --git a/Projectiles/Boss/ShadowflameFireball.cs b/Projectiles/Boss/ShadowflameFireball.cs index 45ddfcb70d..ad7d0637d4 100644 --- a/Projectiles/Boss/ShadowflameFireball.cs +++ b/Projectiles/Boss/ShadowflameFireball.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Boss { public override void SetStaticDefaults() { - DisplayName.SetDefault("Shadowflame"); + DisplayName.SetDefault("Shadowflame Fireball"); } public override void SetDefaults() @@ -34,8 +34,28 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item20, projectile.position); } - int dust = Dust.NewDust(new Vector2(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y), projectile.width, projectile.height, 27, projectile.velocity.X, projectile.velocity.Y, 100, default, 3f); - Main.dust[dust].noGravity = true; + // Main chunky dark purple dust at the front of the fireball + for(int i = 0; i < 2; ++i) + { + int dustType = 27; + float dustScale = Main.rand.NextFloat(1.4f, 2.4f); + int dustID = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity = projectile.velocity; + Main.dust[dustID].scale = dustScale; + } + + // Trailing brighter purple fire trail dust + { + int dustType = 70; + float velMult = Main.rand.NextFloat(0.05f, 0.6f); + float dustScale = Main.rand.NextFloat(1.2f, 1.8f); + int dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].velocity *= 0.1f; + Main.dust[dustID].velocity += projectile.velocity * velMult; + Main.dust[dustID].scale = dustScale; + } projectile.rotation += 0.3f * (float)projectile.direction; @@ -77,17 +97,14 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num584 = 0; num584 < 20; num584 = num3 + 1) + int killDust = 20; + for (int i = 0; i < killDust; ++i) { - int num585 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, -projectile.velocity.X * 0.2f, -projectile.velocity.Y * 0.2f, 100, default, 2.5f); - Main.dust[num585].noGravity = true; - Dust dust = Main.dust[num585]; - dust.velocity *= 2f; - num585 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, -projectile.velocity.X * 0.2f, -projectile.velocity.Y * 0.2f, 100, default, 1.2f); - dust = Main.dust[num585]; - dust.velocity *= 2f; - num3 = num584; + int dustType = Main.rand.NextBool() ? 70 : 27; + float dustScale = Main.rand.NextFloat(1f, 1.6f); + int dustID = Dust.NewDust(projectile.Center, 1, 1, dustType); + Main.dust[dustID].velocity *= 4f; + Main.dust[dustID].scale = dustScale; } } } diff --git a/Projectiles/Boss/Shadowflamethrower.cs b/Projectiles/Boss/Shadowflamethrower.cs index eed55b9109..12a5a257d7 100644 --- a/Projectiles/Boss/Shadowflamethrower.cs +++ b/Projectiles/Boss/Shadowflamethrower.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Boss { public override void SetStaticDefaults() { - DisplayName.SetDefault("Shadowflamethrower"); + DisplayName.SetDefault("Shadowflame Breath"); } public override void SetDefaults() @@ -27,43 +27,42 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.ai[0] > 7f) { - float num302 = 1f; - if (projectile.ai[0] == 8f) - num302 = 0.25f; - else if (projectile.ai[0] == 9f) - num302 = 0.5f; - else if (projectile.ai[0] == 10f) - num302 = 0.75f; - - projectile.ai[0] += 1f; - if (Main.rand.NextBool(2)) + int[] dustTypes = new int[] { 27, 27, 112, 173 }; + if(true) { - int num305 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust; - - if (Main.rand.Next(3) != 0 || Main.rand.NextBool(3)) + int dustType = dustTypes[Main.rand.Next(4)]; + int dustID; + Vector2 corner = projectile.position - new Vector2(6f, 6f); + int width = 18; + int height = 18; + switch (dustType) { - Main.dust[num305].noGravity = true; - dust = Main.dust[num305]; - dust.scale *= 3f; - dust.velocity.X *= 2f; - dust.velocity.Y *= 2f; + case 27: + dustID = Dust.NewDust(corner, width, height, dustType); + Main.dust[dustID].noGravity = false; + Main.dust[dustID].scale = Main.rand.NextFloat(1f, 1.2f); + Main.dust[dustID].velocity *= 0.9f; + Main.dust[dustID].velocity += projectile.velocity * 0.7f; + break; + case 112: + dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[dustID].noGravity = true; + Main.dust[dustID].scale = Main.rand.NextFloat(1.4f, 2f); + Main.dust[dustID].velocity *= 2.2f; + Main.dust[dustID].velocity += projectile.velocity * Main.rand.NextFloat(0.15f, 0.4f); + break; + case 173: + dustID = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[dustID].noGravity = false; + Main.dust[dustID].scale = Main.rand.NextFloat(1.9f, 3f); + Main.dust[dustID].velocity *= 1.5f; + Main.dust[dustID].velocity += projectile.velocity * Main.rand.NextFloat(0.6f, 1f); + break; } - - dust = Main.dust[num305]; - dust.scale *= 2f; - dust.velocity.X *= 1.2f; - dust.velocity.Y *= 1.2f; - dust.scale *= num302; - dust.velocity += projectile.velocity; - - if (!dust.noGravity) - dust.velocity *= 0.5f; } } - else - projectile.ai[0] += 1f; + projectile.ai[0]++; projectile.rotation += 0.3f * (float)projectile.direction; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 730cc5e7b2..753b5fd0bb 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -656,10 +656,10 @@ namespace CalamityMod.Projectiles { if (counter % 30 == 0) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 30) + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 25) { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + (int)((double)projectile.damage * 0.1), 0f, projectile.owner, 0f, 0f); } } } @@ -1450,12 +1450,13 @@ namespace CalamityMod.Projectiles Player playerC = Main.player[projectile.owner]; if (playerC.Calamity().featherCrown && stealthStrike && playerC.Calamity().featherCrownCooldown <= 0) { - for (int i = 0; i < 10; i++) + for (int i = 0; i < 6; i++) { Vector2 pos = new Vector2(target.Center.X + (float)target.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); float speedX = (target.Center.X - pos.X) / 30f; float speedY = (target.Center.Y - pos.Y) * 8; - int feather = Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), 15, 3, projectile.owner, 0f, (float)Main.rand.Next(15)); + int dmg = (int)(15 + (projectile.damage * 0.05f)); + int feather = Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), dmg, 3, projectile.owner, 0f, (float)Main.rand.Next(15)); Main.projectile[feather].Calamity().forceRogue = true; playerC.Calamity().featherCrownCooldown = 15; } @@ -1463,16 +1464,30 @@ namespace CalamityMod.Projectiles if (playerC.Calamity().moonCrown && stealthStrike && playerC.Calamity().moonCrownCooldown <= 0) { - for (int i = 0; i < 20; i++) + for (int i = 0; i < 6; i++) { Vector2 pos = new Vector2(target.Center.X + (float)target.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (target.Center - pos) / 10f; float AI1 = (float)Main.rand.Next(3); - int flare = Projectile.NewProjectile(pos, velocity, ProjectileID.LunarFlare, 50, 3, projectile.owner, 0f, AI1); + int dmg = (int)(150 + (projectile.damage * 0.05f)); + int flare = Projectile.NewProjectile(pos, velocity, ProjectileID.LunarFlare, dmg, 3, projectile.owner, 0f, AI1); Main.projectile[flare].Calamity().forceRogue = true; playerC.Calamity().moonCrownCooldown = 15; } } + + if (playerC.Calamity().nanotech && stealthStrike && playerC.Calamity().nanoFlareCooldown <= 0) + { + for (int i = 0; i < 6; i++) + { + Vector2 pos = new Vector2(target.Center.X + (float)target.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (target.Center - pos) / 40f; + int dmg = (int)(1000 + (projectile.damage * 0.05f)); + int flare = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(),dmg, 3f, projectile.owner, 0f, 0f); + Main.projectile[flare].Calamity().rogue = true; + playerC.Calamity().nanoFlareCooldown = 15; + } + } } else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) { diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index add87f1edc..ac7ce7e1b9 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -22,12 +22,14 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 10; projectile.height = 10; projectile.friendly = true; - projectile.penetrate = 8; + projectile.penetrate = -1; projectile.alpha = 255; projectile.magic = true; projectile.aiStyle = 93; aiType = 514; projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/Crescent.cs b/Projectiles/Magic/Crescent.cs new file mode 100644 index 0000000000..a70b1b3ca5 --- /dev/null +++ b/Projectiles/Magic/Crescent.cs @@ -0,0 +1,55 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Projectiles.Magic +{ + public class Crescent : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crescent Cutter"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.timeLeft = 200; + projectile.aiStyle = 0; + projectile.width = 20; + projectile.height = 20; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.knockBack = 0; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(230, 230, 255, projectile.alpha); + } + + public override void AI() + { + Projectile parent = Main.projectile[(int)projectile.ai[0]]; + if (!parent.active) projectile.Kill(); + + projectile.rotation += 0.7f; + + projectile.ai[1]++; + + if (projectile.ai[1] > 20) + { + projectile.velocity += projectile.DirectionTo(parent.Center) * 2.5f; + if (projectile.Distance(parent.Center) < 75f) projectile.active = false; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/Crescent.png b/Projectiles/Magic/Crescent.png new file mode 100644 index 0000000000..38aef93175 Binary files /dev/null and b/Projectiles/Magic/Crescent.png differ diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs new file mode 100644 index 0000000000..b5c0dab6a1 --- /dev/null +++ b/Projectiles/Magic/LightningArc.cs @@ -0,0 +1,160 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class LightningArc : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lightning Arc"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.alpha = 255; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.timeLeft = 20; + projectile.penetrate = 6; + projectile.tileCollide = true; + } + + + HashSet shockedbefore = new HashSet(); + int prevX = 0; + public override void AI() + { + //projectile.alpha exists + if (projectile.localAI[0] == 0f) + { + AdjustMagnitude(ref projectile.velocity); + projectile.localAI[0] = 1f; + } + Vector2 move = Vector2.Zero; + float distance = 160f; + bool target = false; + NPC npc = null; + bool pastNPC = false; + if (projectile.timeLeft < 18) { + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && !Main.npc[k].dontTakeDamage && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5 && !shockedbefore.Contains(Main.npc[k])) + { + Vector2 newMove = Main.npc[k].Center - (projectile.velocity + projectile.Center); + float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y); + if (distanceTo < distance) + { + move = newMove; + distance = distanceTo; + target = true; + npc = Main.npc[k]; + + } + } + } + } + //if not found, lokk thru npcs that have been shocked before + if (!target) { + foreach (NPC pastnpc in shockedbefore) { + Vector2 newMove = pastnpc.Center -(projectile.velocity + projectile.Center); + float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y); + if (distanceTo < distance) + { + move = newMove; + distance = distanceTo; + target = true; + npc = pastnpc; + pastNPC = true; + } + } + } + + + // Main.dust[dust].velocity /= 2f; + Vector2 current = projectile.Center; + if (target) + { + shockedbefore.Add(npc); + npc.HitEffect(0, projectile.damage); + //AdjustMagnitude(ref move); + //AdjustMagnitude(ref projectile.velocity); + //projectile.velocity = (10 * projectile.velocity + move) / 11f; + + move+= new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10))*distance/30; + if (pastNPC) { + prevX++; + move += new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)) * prevX; + } + + + } + else { + move = (projectile.velocity+ new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)))*5; + } + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(current, projectile.width, projectile.height, 20, 0, 0); + Main.dust[dust].velocity = new Vector2(0); + current += move / 20f; + } + projectile.position = current; + /*int tx = (int)(projectile.position.X / 16f); + int ty = (int)(projectile.position.Y / 16f); + + if (tx < 0) + { + tx = 0; + } + if (tx > Main.maxTilesX) + { + tx = Main.maxTilesX; + } + if (ty < 0) + { + ty = 0; + } + if (ty > Main.maxTilesY) + { + ty = Main.maxTilesY; + } + + if (Main.tile[tx, ty] != null && Main.tileSolid[(int)Main.tile[tx,ty].type] && Main.tile[tx, ty].wall == 0) + { + projectile.timeLeft -= 12; + }*/ + + + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.velocity = oldVelocity; + projectile.timeLeft -= 12; + return false; + } + private void AdjustMagnitude(ref Vector2 vector) + { + float magnitude = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); + if (magnitude > 6f) + { + vector *= 6f / magnitude; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(3)) + { + target.AddBuff(BuffID.Electrified, 300); + } + } + } +} diff --git a/Projectiles/Magic/LightningArc.png b/Projectiles/Magic/LightningArc.png new file mode 100644 index 0000000000..62237c6022 Binary files /dev/null and b/Projectiles/Magic/LightningArc.png differ diff --git a/Projectiles/Magic/StratusSphereProj.cs b/Projectiles/Magic/StratusSphereProj.cs new file mode 100644 index 0000000000..b724c9af6e --- /dev/null +++ b/Projectiles/Magic/StratusSphereProj.cs @@ -0,0 +1,135 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Projectiles.Magic +{ + public class StratusSphereProj : ModProjectile + { + int roundsGone = 0; + int dust_nut = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stratus Sphere"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.hostile = false; + projectile.friendly = true; + projectile.aiStyle = -1; + projectile.width = 314; + projectile.height = 198; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.knockBack = 0; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(230, 230, 255, projectile.alpha); + } + + public override void AI() + { + projectile.ai[0]++; + + if (projectile.ai[0] < 200) + { + if (projectile.ai[0] > 100) + { + projectile.velocity.X = projectile.velocity.X * 40 / 41; + projectile.velocity.Y = projectile.velocity.Y * 45 / 46 - 0.005f; + } + } + else + { + projectile.velocity.X = projectile.velocity.X * 10 / 11; + projectile.velocity.Y = projectile.velocity.Y * 10 / 11; + if (roundsGone <= 4) projectile.ai[1]++; + int rand = Main.rand.Next(-50, 51); + int rand2 = Main.rand.Next(-50, 51); + Vector2 targetDir = projectile.Center + new Vector2(rand, rand2); + if (projectile.ai[1] > 40) + { + Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(targetDir) * 12f, ModContent.ProjectileType(), projectile.damage / 2, 0.4f, projectile.owner, projectile.whoAmI); + } + if (projectile.ai[1] > 46) + { + projectile.ai[1] = 0; + roundsGone++; + } + if (roundsGone > 4 && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] == 0) projectile.Kill(); + } + + projectile.frameCounter++; + if (projectile.frameCounter >= 4) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + } + + if (Main.rand.NextFloat() < 1f) + { + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.Center; + dust = Main.dust[Terraria.Dust.NewDust(position, 0, 0, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.7236842f)]; + } + + dust_nut++; + + if (dust_nut > 22) + { + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; + Vector2 vector = spinningpoint - projectile.Center; + int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 226, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 0.7236842f); + Main.dust[num21].noGravity = true; + Main.dust[num21].noLight = true; + Main.dust[num21].velocity = Vector2.Normalize(vector) * 3f; + } + dust_nut = 0; + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 25; i++) + { + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.Center - new Vector2(34, 34); + dust = Main.dust[Terraria.Dust.NewDust(position, 68, 68, 226, 0f, 0f, 0, new Color(255, 255, 255), 0.7236842f)]; + } + + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; + Vector2 vector = spinningpoint - projectile.Center; + int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 226, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 0.7236842f); + Main.dust[num21].noGravity = true; + Main.dust[num21].noLight = true; + Main.dust[num21].velocity = Vector2.Normalize(vector) * 3f; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/StratusSphereProj.png b/Projectiles/Magic/StratusSphereProj.png new file mode 100644 index 0000000000..2fefcab6c8 Binary files /dev/null and b/Projectiles/Magic/StratusSphereProj.png differ diff --git a/Projectiles/Melee/CrescentMoonFlail.cs b/Projectiles/Melee/CrescentMoonFlail.cs new file mode 100644 index 0000000000..4543a0719c --- /dev/null +++ b/Projectiles/Melee/CrescentMoonFlail.cs @@ -0,0 +1,242 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CrescentMoonFlail : ModProjectile + { + public int moonCounter = 6; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crescent Moon"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.hide = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 1.57079637f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.localAI[1] > 0f) + { + projectile.localAI[1] -= 1f; + } + projectile.alpha -= 42; + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = projectile.velocity.ToRotation(); + } + float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); + if (projectile.ai[1] <= 0f) + { + num32 *= -1f; + } + Vector2 vector17 = (num32 * (projectile.ai[0] / 30f * 6.28318548f - 1.57079637f)).ToRotationVector2(); + vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); + if (projectile.ai[1] <= 0f) + { + vector17.Y *= -1f; + } + vector17 = vector17.RotatedBy((double)projectile.localAI[0], default); + projectile.ai[0] += 1f; + if (projectile.ai[0] < 30f) + { + projectile.velocity += 48f * vector17; + } + else + { + projectile.Kill(); + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + { + vector24.X = (float)player.bodyFrame.Width - vector24.X; + } + if (player.gravDir != 1f) + { + vector24.Y = (float)player.bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; + projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; + if (projectile.alpha == 0) + { + for (int num51 = 0; num51 < 2; num51++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 176, 0f, 0f, 100, default, 2f)]; + dust.noGravity = true; + dust.velocity *= 2f; + dust.velocity += projectile.localAI[0].ToRotationVector2(); + dust.fadeIn = 1.5f; + } + float num52 = 18f; + int num53 = 0; + while ((float)num53 < num52) + { + if (Main.rand.NextBool(4)) + { + Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); + Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 20, 0f, 0f, 100, default, 1f)]; + dust2.noGravity = true; + dust2.fadeIn = 0.5f; + dust2.velocity += projectile.localAI[0].ToRotationVector2(); + dust2.noLight = true; + } + num53++; + } + } + if (moonCounter > 0) + moonCounter--; + if (moonCounter <= 0 && projectile.owner == Main.myPlayer) + { + Vector2 vectorBruh = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + { + vectorBruh.X = (float)player.bodyFrame.Width - vectorBruh.X; + } + if (player.gravDir != 1f) + { + vectorBruh.Y = (float)player.bodyFrame.Height - vectorBruh.Y; + } + vectorBruh -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; + Vector2 newCenter = player.RotatedRelativePoint(Main.player[projectile.owner].position + vectorBruh, true) + projectile.velocity; + int moon = Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); + moonCounter = 6; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; + Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) + { + color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); + } + Vector2 projPos = projectile.position; + projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //fuck it + Texture2D texture2D22 = Main.projectileTexture[projectile.type]; + Color alpha3 = projectile.GetAlpha(color25); + if (projectile.velocity == Vector2.Zero) + { + return false; + } + float num230 = projectile.velocity.Length() + 16f; + bool flag24 = num230 < 100f; + Vector2 value28 = Vector2.Normalize(projectile.velocity); + Rectangle rectangle8 = new Rectangle(0, 0, texture2D22.Width, 54); //2 and 40 + Vector2 value29 = new Vector2(0f, Main.player[projectile.owner].gfxOffY); + float rotation24 = projectile.rotation + 3.14159274f; + Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f); + num230 -= 40f * projectile.scale; + Vector2 vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Rectangle(0, 84, texture2D22.Width, 18); //68 and 18 + if (num230 > 0f) + { + float num231 = 0f; + while (num231 + 1f < num230) + { + if (num230 - num231 < (float)rectangle8.Height) + { + rectangle8.Height = (int)(num230 - num231); + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num231 += (float)rectangle8.Height * projectile.scale; + vector31 += value28 * (float)rectangle8.Height * projectile.scale; + } + } + Vector2 value30 = vector31; + vector31 = projectile.Center.Floor(); + vector31 += value28 * projectile.scale * 24f; + rectangle8 = new Rectangle(0, 62, texture2D22.Width, 20); //46 and 18 + int num232 = 18; + if (flag24) + { + num232 = 9; + } + float num233 = num230; + if (num230 > 0f) + { + float num234 = 0f; + float num235 = num233 / (float)num232; + num234 += num235 * 0.25f; + vector31 += value28 * num235 * 0.25f; + for (int num236 = 0; num236 < num232; num236++) + { + float num237 = num235; + if (num236 == 0) + { + num237 *= 0.75f; + } + Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num234 += num237; + vector31 += value28 * num237; + } + } + rectangle8 = new Rectangle(0, 104, texture2D22.Width, 50); //90 and 48 + Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num8 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 16f * projectile.scale, ref num8)) + { + return true; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + projectile.localAI[1] = 4f; + } + } +} diff --git a/Projectiles/Melee/CrescentMoonFlail.png b/Projectiles/Melee/CrescentMoonFlail.png new file mode 100644 index 0000000000..f657e8b5ec Binary files /dev/null and b/Projectiles/Melee/CrescentMoonFlail.png differ diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs new file mode 100644 index 0000000000..353bd00760 --- /dev/null +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -0,0 +1,95 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Buffs.DamageOverTime; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CrescentMoonProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crescent Moon"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 5; + projectile.timeLeft = 180; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.extraUpdates = 1; + projectile.aiStyle = 18; + aiType = 274; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0f, 0.6f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 30 + Main.rand.Next(50); + if (Main.rand.NextBool(10)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 460f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false)) + { + 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 = 15f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override 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(ModContent.BuffType(), 180); + } + } +} diff --git a/Projectiles/Melee/CrescentMoonProj.png b/Projectiles/Melee/CrescentMoonProj.png new file mode 100644 index 0000000000..38aef93175 Binary files /dev/null and b/Projectiles/Melee/CrescentMoonProj.png differ diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index ee211c95a5..a08543c626 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.ai[1] % 4 == 0) { int type = ModContent.ProjectileType(); - int damage = DragonPow.BaseDamage / 8; + int damage = projectile.damage / 8; float kb = 3f; float speed = DragonPow.SparkSpeed; Vector2 vel = new Vector2(speed, 0f).RotatedByRandom(MathHelper.TwoPi); @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee int type = ProjectileID.FlowerPetal; int numPetals = 12; - int petalDamage = DragonPow.BaseDamage / 8; + int petalDamage = projectile.damage / 8; float petalKB = 0f; Player owner = Main.player[projectile.owner]; for (int i = 0; i < numPetals; ++i) @@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee { int type = ModContent.ProjectileType(); int numWaterfalls = 12; - int waterfallDamage = DragonPow.BaseDamage / 6; + int waterfallDamage = projectile.damage / 6; float waterfallKB = 0f; Player owner = Main.player[projectile.owner]; for (int i = 0; i < numWaterfalls; ++i) diff --git a/Projectiles/Melee/GalileosMoon.cs b/Projectiles/Melee/GalileosMoon.cs new file mode 100644 index 0000000000..c5c69d8832 --- /dev/null +++ b/Projectiles/Melee/GalileosMoon.cs @@ -0,0 +1,95 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Buffs.DamageOverTime; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GalileosMoon : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crescent Moon"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.alpha = 100; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = 10; + projectile.timeLeft = 300; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.extraUpdates = 1; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0f, 0.6f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.rotation += (float) projectile.direction * 0.05f; + projectile.rotation += (float) ((double) projectile.direction * 0.5); + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 460f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false)) + { + 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 = 25f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override 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(ModContent.BuffType(), 180); + } + } +} diff --git a/Projectiles/Melee/GalileosMoon.png b/Projectiles/Melee/GalileosMoon.png new file mode 100644 index 0000000000..38aef93175 Binary files /dev/null and b/Projectiles/Melee/GalileosMoon.png differ diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs new file mode 100644 index 0000000000..ea67a3b486 --- /dev/null +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -0,0 +1,187 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Melee +{ + public class GalileosPlanet : ModProjectile + { + private int radius = 47; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Planet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 42; + projectile.height = 42; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.extraUpdates = 1; + projectile.penetrate = 1; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + for (float i = -5; i <= 0; i++) + { + if (Main.rand.NextFloat(1f) < 0.4f) + { + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 pos = projectile.position + new Vector2((projectile.width / 2) - 8, projectile.height + 16); + Dust dust1 = Dust.NewDustPerfect(pos + new Vector2(-20 + i, -2), 180, new Vector2(i * 0.7f, -1.1f)); + dust1.noGravity = true; + } + } + for (float i = 0; i <= 5; i++) + { + if (Main.rand.NextFloat(1f) < 0.4f) + { + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 pos = projectile.position + new Vector2((projectile.width / 2) - 8, projectile.height + 16); + Dust dust1 = Dust.NewDustPerfect(pos + new Vector2(20 + i, -2), 180, new Vector2(i * 0.7f, -1.1f)); + dust1.noGravity = true; + } + } + + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 pos2 = projectile.Center - new Vector2(20, 20); + dust = Main.dust[Dust.NewDust(pos2, 40, 40, 180, 0f, 0f, 0, new Color(255, 255, 255), 1f)]; + + Lighting.AddLight(projectile.Center, 0.3f, 0.3f, 0.7f); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 32; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + radius = 100; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; + projectile.Damage(); + for (int i = 0; i < 72; i++) + { + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.Center - new Vector2(30, 30); + dust = Main.dust[Terraria.Dust.NewDust(position, 60, 60, 187, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(0, 167, 255), 5f)]; + dust.noGravity = true; + dust.shader = GameShaders.Armor.GetSecondaryShader(47, Main.LocalPlayer); + } + + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 43); + + for (int i = 0; i < 155; i++) + { + Dust dust; + // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. + Vector2 position = projectile.position; + dust = Main.dust[Dust.NewDust(position, 94, 94, 180, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 0, new Color(255, 255, 255), Main.rand.NextFloat(1.2f, 2.2f))]; + dust.noGravity = true; + } + + for (int x = 1; x <= 3; x++) + { + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; + Vector2 vector = spinningpoint - projectile.Center; + int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); + Main.dust[num21].noGravity = true; + Main.dust[num21].velocity = Vector2.Normalize(vector) * x; + } + } + + for (int x = 1; x <= 3; x++) + { + int num20 = 36; + for (int i = 0; i < num20; i++) + { + Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f * 0.5f; + spinningpoint = spinningpoint.RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default(Vector2)) + projectile.Center; + Vector2 vector = spinningpoint - projectile.Center; + int num21 = Dust.NewDust(spinningpoint + vector, 0, 0, 180, vector.X * 2f, vector.Y * 2f, 0, new Color(255, 255, 255), 1f); + Main.dust[num21].noGravity = true; + Main.dust[num21].velocity = Vector2.Normalize(vector) * x; + Main.dust[num21].velocity *= 2; + } + } + for (int num625 = 0; num625 < 3; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[num626]; + gore.velocity *= scaleFactor10; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= radius; + } + } +} diff --git a/Projectiles/Melee/GalileosPlanet.png b/Projectiles/Melee/GalileosPlanet.png new file mode 100644 index 0000000000..d1eb525387 Binary files /dev/null and b/Projectiles/Melee/GalileosPlanet.png differ diff --git a/Projectiles/Melee/MicrowaveAura.cs b/Projectiles/Melee/MicrowaveAura.cs index 6bb218c4e0..d2d503c163 100644 --- a/Projectiles/Melee/MicrowaveAura.cs +++ b/Projectiles/Melee/MicrowaveAura.cs @@ -1,7 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - DisplayName.SetDefault("Microwave"); + DisplayName.SetDefault("Microwave Radiation"); } public override void SetDefaults() diff --git a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs similarity index 86% rename from Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs rename to Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs index 059825ec6b..8737a94b04 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs @@ -7,25 +7,29 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class AirSpinnerProjectile : ModProjectile + public class AirSpinnerYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Air Spinner"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 6f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 300f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Valor); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.05f; projectile.height = 16; - projectile.penetrate = 7; - projectile.extraUpdates = 1; + projectile.scale = 1.05f; + projectile.friendly = true; projectile.melee = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - aiType = ProjectileID.Valor; + projectile.penetrate = -1; + projectile.extraUpdates = 1; } public override void AI() @@ -79,8 +83,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.png b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/AirSpinnerProjectile.png rename to Projectiles/Melee/Yoyos/AirSpinnerYoyo.png diff --git a/Projectiles/Melee/Yoyos/AortaProjectile.cs b/Projectiles/Melee/Yoyos/AortaYoyo.cs similarity index 58% rename from Projectiles/Melee/Yoyos/AortaProjectile.cs rename to Projectiles/Melee/Yoyos/AortaYoyo.cs index 153dd4415e..4bf24f9c3d 100644 --- a/Projectiles/Melee/Yoyos/AortaProjectile.cs +++ b/Projectiles/Melee/Yoyos/AortaYoyo.cs @@ -1,35 +1,38 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class AortaProjectile : ModProjectile + public class AortaYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Aorta"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 11f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 220f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Valor); + projectile.aiStyle = 99; projectile.width = 16; projectile.height = 16; - projectile.penetrate = 7; - projectile.extraUpdates = 1; + projectile.scale = 1f; + projectile.friendly = true; projectile.melee = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - aiType = ProjectileID.Valor; + projectile.penetrate = -1; + projectile.extraUpdates = 1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AortaProjectile.png b/Projectiles/Melee/Yoyos/AortaYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/AortaProjectile.png rename to Projectiles/Melee/Yoyos/AortaYoyo.png diff --git a/Projectiles/Melee/Yoyos/AzathothProjectile.cs b/Projectiles/Melee/Yoyos/AzathothYoyo.cs similarity index 67% rename from Projectiles/Melee/Yoyos/AzathothProjectile.cs rename to Projectiles/Melee/Yoyos/AzathothYoyo.cs index 4d25b6eb53..7b0a2a1832 100644 --- a/Projectiles/Melee/Yoyos/AzathothProjectile.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -6,23 +6,30 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class AzathothProjectile : ModProjectile + public class AzathothYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Azathoth"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 700f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Kraken); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.2f; projectile.height = 16; + projectile.scale = 1.2f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 554; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; } @@ -38,8 +45,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AzathothProjectile.png b/Projectiles/Melee/Yoyos/AzathothYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/AzathothProjectile.png rename to Projectiles/Melee/Yoyos/AzathothYoyo.png diff --git a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs similarity index 68% rename from Projectiles/Melee/Yoyos/ChaotrixProjectile.cs rename to Projectiles/Melee/Yoyos/ChaotrixYoyo.cs index 4dd99b40eb..f325c18d2f 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs @@ -7,22 +7,29 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class ChaotrixProjectile : ModProjectile + public class ChaotrixYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Chaotrix"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 14f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 290f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Yelets); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.15f; projectile.height = 16; - projectile.penetrate = 10; + projectile.scale = 1.15f; + projectile.friendly = true; projectile.melee = true; - aiType = 549; + projectile.penetrate = -1; + projectile.extraUpdates = 1; } public override void AI() @@ -43,8 +50,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/ChaotrixProjectile.png b/Projectiles/Melee/Yoyos/ChaotrixYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/ChaotrixProjectile.png rename to Projectiles/Melee/Yoyos/ChaotrixYoyo.png diff --git a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs similarity index 90% rename from Projectiles/Melee/Yoyos/CnidarianProjectile.cs rename to Projectiles/Melee/Yoyos/CnidarianYoyo.cs index 9458bfe748..05bfcdb62a 100644 --- a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs +++ b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs @@ -8,22 +8,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class CnidarianProjectile : ModProjectile + public class CnidarianYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Cnidarian"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 7f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 190f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 11f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.CorruptYoyo); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.15f; projectile.height = 16; - projectile.penetrate = 6; + projectile.scale = 1.15f; + projectile.friendly = true; projectile.melee = true; - aiType = 542; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/CnidarianProjectile.png b/Projectiles/Melee/Yoyos/CnidarianYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/CnidarianProjectile.png rename to Projectiles/Melee/Yoyos/CnidarianYoyo.png diff --git a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs similarity index 89% rename from Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs rename to Projectiles/Melee/Yoyos/GodsGambitYoyo.cs index 9cdddea9f7..a83ad987a3 100644 --- a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs +++ b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs @@ -7,22 +7,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class TheGodsGambitProjectile : ModProjectile + public class GodsGambitYoyo : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("God's Gambit"); + DisplayName.SetDefault("The God's Gambit"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 320f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Kraken); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.15f; projectile.height = 16; - projectile.penetrate = 6; + projectile.scale = 1.15f; + projectile.friendly = true; projectile.melee = true; - aiType = 554; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.png b/Projectiles/Melee/Yoyos/GodsGambitYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/TheGodsGambitProjectile.png rename to Projectiles/Melee/Yoyos/GodsGambitYoyo.png diff --git a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs similarity index 66% rename from Projectiles/Melee/Yoyos/LaceratorProjectile.cs rename to Projectiles/Melee/Yoyos/LaceratorYoyo.cs index 4471859f1e..eba6606216 100644 --- a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -6,23 +6,30 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class LaceratorProjectile : ModProjectile + public class LaceratorYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Lacerator"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 560f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.1f; projectile.height = 16; + projectile.scale = 1.1f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; } @@ -41,8 +48,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/LaceratorProjectile.png b/Projectiles/Melee/Yoyos/LaceratorYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/LaceratorProjectile.png rename to Projectiles/Melee/Yoyos/LaceratorYoyo.png diff --git a/Projectiles/Melee/Yoyos/TheMicrowaveProj.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs similarity index 64% rename from Projectiles/Melee/Yoyos/TheMicrowaveProj.cs rename to Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index 928523cf26..f6e40f8778 100644 --- a/Projectiles/Melee/Yoyos/TheMicrowaveProj.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -1,34 +1,39 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Melee; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class TheMicrowaveProj : ModProjectile + public class MicrowaveYoyo : ModProjectile { - private int radius = 100; + private const float Radius = 100f; public override void SetStaticDefaults() { - //DisplayName.SetDefault("Bootleg Lacerator"); - DisplayName.SetDefault("Microwave"); + DisplayName.SetDefault("The Microwave"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 320f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; projectile.height = 16; + projectile.scale = 1f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; } @@ -40,9 +45,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); //dust circle - int numDust = (int)(0.2f * MathHelper.TwoPi * radius); + int numDust = (int)(0.2f * MathHelper.TwoPi * Radius); float angleIncrement = MathHelper.TwoPi / (float)numDust; - Vector2 dustOffset = new Vector2(radius, 0f); + Vector2 dustOffset = new Vector2(Radius, 0f); dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); for (int i = 0; i < numDust; i++) { @@ -61,10 +66,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Rectangle frame = new Rectangle(0, 0, 20, 16); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/TheMicrowaveProjGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/MicrowaveYoyoGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Yoyos/TheMicrowaveProj.png b/Projectiles/Melee/Yoyos/MicrowaveYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/TheMicrowaveProj.png rename to Projectiles/Melee/Yoyos/MicrowaveYoyo.png diff --git a/Projectiles/Melee/Yoyos/TheMicrowaveProjGlow.png b/Projectiles/Melee/Yoyos/MicrowaveYoyoGlow.png similarity index 100% rename from Projectiles/Melee/Yoyos/TheMicrowaveProjGlow.png rename to Projectiles/Melee/Yoyos/MicrowaveYoyoGlow.png diff --git a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs b/Projectiles/Melee/Yoyos/OblivionYoyo.cs similarity index 84% rename from Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs rename to Projectiles/Melee/Yoyos/OblivionYoyo.cs index 986d975020..dfb702921c 100644 --- a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs +++ b/Projectiles/Melee/Yoyos/OblivionYoyo.cs @@ -7,22 +7,28 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class TheEyeofCalamitasProjectile : ModProjectile + public class OblivionYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Oblivion"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 360f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16.5f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.1f; projectile.height = 16; - projectile.penetrate = -1; + projectile.scale = 1.1f; + projectile.friendly = true; projectile.melee = true; - aiType = 555; + projectile.penetrate = -1; } public override void AI() @@ -81,8 +87,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.png b/Projectiles/Melee/Yoyos/OblivionYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.png rename to Projectiles/Melee/Yoyos/OblivionYoyo.png diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index ab37dbeae1..1c6c578cda 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,23 +20,29 @@ namespace CalamityMod.Projectiles.Melee.Yoyos private static float MaxAuraRadius = 100f; private static float MinDischargeRate = 0.05f; private static float MaxDischargeRate = 0.53f; - private static float ChargePerHit = 6f; + private static float ChargePerHit = 2.2f; private static int AuraBaseDamage = 160; - private static int HitsPerOrbVolley = 6; + private static int HitsPerOrbVolley = 10; public override void SetStaticDefaults() { DisplayName.SetDefault("The Oracle"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 800f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 24f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Terrarian); - aiType = 554; + projectile.aiStyle = 99; projectile.width = 20; projectile.height = 20; projectile.scale = 1.2f; + projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; @@ -46,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void AI() { - // Produces golden dust constantly while in flight. This lights the yoyo. + // Produces golden dust constantly while in flight. This helps light the yoyo. if (Main.rand.NextBool()) { int dustType = Main.rand.NextBool(3) ? 244 : 246; @@ -57,6 +64,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Main.dust[idx].scale = scale; } + // The yoyo makes its own faint yellow light (unnoticeable once the lightning aura gets going) + Lighting.AddLight(projectile.Center, 0.6f, 0.42f, 0.1f); + // The aura discharges over time based on its current charge. float discharge = MinDischargeRate + 0.003f * projectile.localAI[1]; if (discharge > MaxDischargeRate) @@ -91,6 +101,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.netUpdate = true; } + 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) { // The yoyo does nothing versus normal dummies @@ -190,12 +206,13 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (dist <= radius) { - int finalDamage = (int)(baseDamage * owner.meleeDamage * Main.rand.NextFloat(0.85f, 1.15f)); - bool crit = Main.rand.Next(100) <= owner.meleeCrit + 4; - target.StrikeNPC(finalDamage, 0f, 0, crit, false, false); - - if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(28, -1, -1, null, i, finalDamage, 0f, 0f, crit ? 1 : 0, 0, 0); + int finalDamage = (int)(baseDamage * (owner.allDamage + owner.meleeDamage - 1f)); + if (projectile.owner == Main.myPlayer) + { + Projectile p = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), finalDamage, 0f, projectile.owner, i); + p.melee = true; + p.Calamity().forceMelee = true; + } } } } @@ -207,7 +224,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos int numOrbs = 3; int orbID = ModContent.ProjectileType(); - int orbDamage = Oracle.BaseDamage * 3; + int orbDamage = projectile.damage * 3; float orbKB = 8f; float angleVariance = MathHelper.TwoPi / numOrbs; float spinOffsetAngle = MathHelper.Pi / (2f * numOrbs); diff --git a/Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.cs b/Projectiles/Melee/Yoyos/PandemicYoyo.cs similarity index 91% rename from Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.cs rename to Projectiles/Melee/Yoyos/PandemicYoyo.cs index d6a6caa1ae..de49dd6f86 100644 --- a/Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.cs +++ b/Projectiles/Melee/Yoyos/PandemicYoyo.cs @@ -8,22 +8,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class ThePlaguebringerYoyo : ModProjectile + public class PandemicYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Pandemic"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 340f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16.5f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1f; projectile.height = 16; - projectile.penetrate = -1; + projectile.scale = 1f; + projectile.friendly = true; projectile.melee = true; - aiType = 555; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.png b/Projectiles/Melee/Yoyos/PandemicYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.png rename to Projectiles/Melee/Yoyos/PandemicYoyo.png diff --git a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs similarity index 88% rename from Projectiles/Melee/Yoyos/QuagmireProjectile.cs rename to Projectiles/Melee/Yoyos/QuagmireYoyo.cs index ce0c698100..9970374b10 100644 --- a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -6,22 +6,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class QuagmireProjectile : ModProjectile + public class QuagmireYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Quagmire"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 12f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 275f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 15f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.HelFire); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.25f; projectile.height = 16; - projectile.penetrate = 8; + projectile.scale = 1.25f; + projectile.friendly = true; projectile.melee = true; - aiType = 553; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/QuagmireProjectile.png b/Projectiles/Melee/Yoyos/QuagmireYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/QuagmireProjectile.png rename to Projectiles/Melee/Yoyos/QuagmireYoyo.png diff --git a/Projectiles/Melee/Yoyos/WhirlpoolProjectile.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs similarity index 89% rename from Projectiles/Melee/Yoyos/WhirlpoolProjectile.cs rename to Projectiles/Melee/Yoyos/RiptideYoyo.cs index c356e2527c..9ded4cc8c9 100644 --- a/Projectiles/Melee/Yoyos/WhirlpoolProjectile.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -4,25 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class WhirlpoolProjectile : ModProjectile + public class RiptideYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Riptide"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 7.5f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 180f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 12.5f; } public override void SetDefaults() { + projectile.aiStyle = 99; projectile.width = 16; projectile.height = 16; - projectile.scale = 0.75f; + projectile.scale = 1f; projectile.friendly = true; + projectile.melee = true; projectile.alpha = 150; projectile.penetrate = -1; - projectile.timeLeft = 99; - projectile.melee = true; - aiType = ProjectileID.Amarok; - projectile.CloneDefaults(ProjectileID.CorruptYoyo); } public override void AI() diff --git a/Projectiles/Melee/Yoyos/WhirlpoolProjectile.png b/Projectiles/Melee/Yoyos/RiptideYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/WhirlpoolProjectile.png rename to Projectiles/Melee/Yoyos/RiptideYoyo.png diff --git a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs similarity index 90% rename from Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs rename to Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs index 53326e7a22..9243254c22 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs @@ -7,22 +7,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class ShimmersparkProjectile : ModProjectile + public class ShimmersparkYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Shimmerspark"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 16f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 275f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Chik); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 0.9f; projectile.height = 16; - projectile.penetrate = 8; + projectile.scale = 1f; + projectile.friendly = true; projectile.melee = true; - aiType = 546; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.png b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/ShimmersparkProjectile.png rename to Projectiles/Melee/Yoyos/ShimmersparkYoyo.png diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index 691c4a2cec..cc93ba2c92 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee.Yoyos { public class SolarFlareYoyo : ModProjectile @@ -12,18 +13,25 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Solar Flare"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 560f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.15f; projectile.height = 16; + projectile.scale = 1.15f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; } @@ -46,8 +54,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/TheObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/TheObliteratorYoyo.cs index a3ed50d6ca..0793e3b162 100644 --- a/Projectiles/Melee/Yoyos/TheObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/TheObliteratorYoyo.cs @@ -1,7 +1,7 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,78 +12,102 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override void SetStaticDefaults() { - DisplayName.SetDefault("Obliterator"); + DisplayName.SetDefault("The Obliterator"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 580f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; projectile.height = 16; + projectile.scale = 1.6f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 5; } + // localAI[1] is the shot counter. Every 5 frames, The Obliterator tries to fire a laser at a nearby target. + // It has 4 "laser ports" which whirl around in circles with the yoyo. It uses each of these in order. + // localAI[1] counts up to 19 (4 x 5 - 1), then resets back to 0 for a 20-frame cycle. public override void AI() { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) + Lighting.AddLight(projectile.Center, 0.8f, 0.3f, 1f); + + projectile.localAI[1]++; + if (projectile.localAI[1] >= 20f) + projectile.localAI[1] = 0f; + + // Attempt to fire a laser every 5 frames + if(projectile.localAI[1] % 5f == 0f) { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) + List targets = new List(); + float laserRange = 300f; + for (int i = 0; i < Main.npc.Length; ++i) { - float num431 = Main.npc[num430].position.X + Main.npc[num430].width / 2; - float num432 = Main.npc[num430].position.Y + Main.npc[num430].height / 2; - float num433 = Math.Abs(projectile.position.X + projectile.width / 2 - num431) + Math.Abs(projectile.position.Y + projectile.height / 2 - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + ref NPC n = ref Main.npc[i]; + if (n is null || !n.active) + continue; + + if (n.CanBeChasedBy(projectile, false) && (n.Center - projectile.Center).Length() <= laserRange && Collision.CanHit(projectile.Center, 1, 1, n.Center, 1, 1)) { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; + targets.Add(i); + // Bosses are added 5 times instead of 1 so that they are preferentially but not exclusively targeted. + if (n.boss) + for (int j = 0; j < 4; ++j) + targets.Add(i); } } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + Main.npc[num434].width / 2; - float num436 = Main.npc[num434].position.Y + Main.npc[num434].height / 2; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 16f) + if (targets.Count == 0) + return; + + // Pick which of the four corners the laser is spawning in + Vector2 laserSpawnPosition = projectile.Center; + Vector2 offset; + if (projectile.localAI[1] < 5f) + offset = new Vector2(7, 7); + else if (projectile.localAI[1] < 10f) + offset = new Vector2(-7, 7); + else if (projectile.localAI[1] < 15f) + offset = new Vector2(-7, -7); + else + offset = new Vector2(7, -7); + laserSpawnPosition += offset.RotatedBy(projectile.rotation); + + ref NPC target = ref Main.npc[targets[Main.rand.Next(targets.Count)]]; + const float laserSpeed = 6f; + int laserDamage = (int)(projectile.damage * 0.5f); + const float laserKB = 3f; + Vector2 velocity = target.Center - projectile.Center; + velocity = velocity.SafeNormalize(Vector2.Zero) * laserSpeed; + if (projectile.owner == Main.myPlayer) { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt(num438 * num438 + num439 * num439); - num440 = num437 / num440; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } + // ai[0] = 1f for melee + int proj = Projectile.NewProjectile(laserSpawnPosition, velocity, ModContent.ProjectileType(), laserDamage, laserKB, projectile.owner, 1f, 0f); + Main.projectile[proj].Calamity().forceMelee = true; } } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(10f, 10f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/TheObliteratorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/TheObliteratorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 2f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Yoyos/VerdantProjectile.cs b/Projectiles/Melee/Yoyos/VerdantYoyo.cs similarity index 83% rename from Projectiles/Melee/Yoyos/VerdantProjectile.cs rename to Projectiles/Melee/Yoyos/VerdantYoyo.cs index 4180ea3924..8207519cdb 100644 --- a/Projectiles/Melee/Yoyos/VerdantProjectile.cs +++ b/Projectiles/Melee/Yoyos/VerdantYoyo.cs @@ -7,22 +7,31 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class VerdantProjectile : ModProjectile + public class VerdantYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Verdant"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 400; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Kraken); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.1f; projectile.height = 16; - projectile.penetrate = -1; + projectile.scale = 1.1f; + projectile.friendly = true; projectile.melee = true; - aiType = 554; + projectile.penetrate = -1; + + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 9; } public override void AI() @@ -86,8 +95,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/VerdantProjectile.png b/Projectiles/Melee/Yoyos/VerdantYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/VerdantProjectile.png rename to Projectiles/Melee/Yoyos/VerdantYoyo.png diff --git a/Projectiles/Melee/Yoyos/YinYoyo.cs b/Projectiles/Melee/Yoyos/YinYoyo.cs index be06a94692..2fc86d0959 100644 --- a/Projectiles/Melee/Yoyos/YinYoyo.cs +++ b/Projectiles/Melee/Yoyos/YinYoyo.cs @@ -11,18 +11,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override void SetStaticDefaults() { - DisplayName.SetDefault("Yinyo"); + DisplayName.SetDefault("Yin-Yo"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 14f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 275f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Chik); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 0.9f; projectile.height = 16; - projectile.penetrate = 5; + projectile.scale = 1f; + projectile.friendly = true; projectile.melee = true; - aiType = 546; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Rogue/AlphaVirusProjectile.cs b/Projectiles/Rogue/AlphaVirusProjectile.cs index d8a5a45a89..5bb0810d03 100644 --- a/Projectiles/Rogue/AlphaVirusProjectile.cs +++ b/Projectiles/Rogue/AlphaVirusProjectile.cs @@ -24,9 +24,11 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = -1; + projectile.penetrate = 8; projectile.timeLeft = lifetime; projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; } public override void AI() @@ -163,7 +165,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 6; i++) { - int damage = projectile.damage / 2; + int damage = projectile.damage; Vector2 velocity = new Vector2(0, 10); velocity = velocity.RotatedBy(MathHelper.ToRadians(60) * i); Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), damage, 5, projectile.owner, i % 2, 0); diff --git a/Projectiles/Rogue/PenumbraBomb.cs b/Projectiles/Rogue/PenumbraBomb.cs index 4b9471a454..93b0785dc0 100644 --- a/Projectiles/Rogue/PenumbraBomb.cs +++ b/Projectiles/Rogue/PenumbraBomb.cs @@ -74,12 +74,13 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { //Dark soul projectiles - int ad = projectile.Calamity().stealthStrike ? 30 : 60; + int ad = projectile.Calamity().stealthStrike ? 40 : 60; + float dmgMult = projectile.Calamity().stealthStrike ? 0.08f : 0.15f; int randrot = Main.rand.Next(-30,31); for (int i = 0; i < 360; i += ad) { Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(i + randrot)); - Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.2f), 3f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType(), (int)(projectile.damage * dmgMult), 3f, projectile.owner, 0f, 0f); } //Dust int maxDust = projectile.Calamity().stealthStrike ? 100 : 70; @@ -97,6 +98,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; projectile.Damage(); } diff --git a/Projectiles/Rogue/ShockGrenadeBolt.cs b/Projectiles/Rogue/ShockGrenadeBolt.cs new file mode 100644 index 0000000000..de530a3594 --- /dev/null +++ b/Projectiles/Rogue/ShockGrenadeBolt.cs @@ -0,0 +1,121 @@ +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ShockGrenadeBolt : ModProjectile + { + public static int frameWidth = 12; + public static int frameHeight = 26; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 3; + projectile.timeLeft = 120; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + + if (projectile.timeLeft < 55) + { + projectile.tileCollide = true; + } + + if (projectile.ai[1] == 1f) + { + float minDist = 999f; + int index = 0; + for (int i = 0; i < Main.npc.Length; i++) + { + NPC npc = Main.npc[i]; + if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < minDist) + { + minDist = dist; + index = i; + } + } + } + + Vector2 velocityNew; + if (minDist < 999f) + { + velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew.Normalize(); + velocityNew *= 2f; + projectile.velocity += velocityNew; + if (projectile.velocity.Length() > 10f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 10f; + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 180); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D sprite; + if (projectile.ai[0] == 0f) + sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt"); + else + sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt2"); + Color drawColour = Color.White; + + Vector2 origin = new Vector2(frameWidth / 2, frameHeight / 2); + spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, new Rectangle(0, frameHeight * projectile.frame, frameWidth, frameHeight), drawColour, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.25f, 0f); + + for (int i = 0; i < 5; i++) + { + int dustType = 132; + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 0.5f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/ShockGrenadeBolt.png b/Projectiles/Rogue/ShockGrenadeBolt.png new file mode 100644 index 0000000000..4852045f46 Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeBolt.png differ diff --git a/Projectiles/Rogue/ShockGrenadeBolt2.png b/Projectiles/Rogue/ShockGrenadeBolt2.png new file mode 100644 index 0000000000..a6d8e84317 Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeBolt2.png differ diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.cs b/Projectiles/Rogue/ShockGrenadeExplosion.cs new file mode 100644 index 0000000000..0727c02962 --- /dev/null +++ b/Projectiles/Rogue/ShockGrenadeExplosion.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ShockGrenadeExplosion : ModProjectile + { + private const float radius = 100f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shock Grenade Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 320; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + if (projectile.timeLeft >= 8) + { + for (int i = 0; i < 50; i++) + { + int dustType = 132; + if (Main.rand.NextBool()) + { + dustType = 264; + } + + Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + dustVelocity.Normalize(); + dustVelocity *= 8; + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 0.75f); + Main.dust[dust].noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 300); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= radius; + } + } +} diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.png b/Projectiles/Rogue/ShockGrenadeExplosion.png new file mode 100644 index 0000000000..d86a683fca Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeExplosion.png differ diff --git a/Projectiles/Rogue/ShockGrenadeProjectile.cs b/Projectiles/Rogue/ShockGrenadeProjectile.cs new file mode 100644 index 0000000000..c258d532a1 --- /dev/null +++ b/Projectiles/Rogue/ShockGrenadeProjectile.cs @@ -0,0 +1,133 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ShockGrenadeProjectile : ModProjectile + { + public static int spriteWidth = 14; + public static int spriteHeight = 30; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shock Grenade"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.velocity.Y += 0.1f; + if (projectile.velocity.Y >= 16f) + { + projectile.velocity.Y = 16f; + } + + projectile.rotation += projectile.direction * 0.2f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + + projectile.localAI[0] = 0; + projectile.localAI[1] = 0; + + if (projectile.velocity.X != oldVelocity.X) + { + if (oldVelocity.X < 0) + { + projectile.localAI[0] = 1; + } + if (oldVelocity.X > 0) + { + projectile.localAI[0] = -1; + } + } + if (projectile.velocity.Y != oldVelocity.Y) + { + if (oldVelocity.Y < 0) + { + projectile.localAI[1] = 1; + } + if (oldVelocity.Y > 0) + { + projectile.localAI[1] = -1; + } + } + projectile.Kill(); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(spriteWidth / 2, spriteHeight / 2); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ShockGrenadeProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 94, 0.75f, 0f); + + int boltCount = Main.rand.Next(5, 11); + for (int i = 0; i < boltCount; i++) + { + int boltScatter = 1; + Vector2 boltVelocity = new Vector2(Main.rand.NextFloat(-boltScatter, boltScatter), Main.rand.NextFloat(-boltScatter * 2, boltScatter * 2)); + if (projectile.localAI[0] != 0) + { + boltVelocity.X *= -1; + } + if (projectile.localAI[1] != 0) + { + boltVelocity.Y *= -1; + } + boltVelocity.X += projectile.localAI[0]; + boltVelocity.Y += projectile.localAI[1] * 2; + boltVelocity.Normalize(); + boltVelocity *= 10; + + int boltType = Main.rand.Next(0, 2); + int boltDamage = projectile.damage / 2; + + int boltAI = 0; + if (projectile.Calamity().stealthStrike) + { + boltAI = 1; + } + + Projectile.NewProjectile(projectile.Center, boltVelocity, ModContent.ProjectileType(), boltDamage, 0, projectile.owner, boltType, boltAI); + } + + if (projectile.Calamity().stealthStrike) + { + int auraDamage = projectile.damage / 4; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 1, projectile.owner, 0, 0); + + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.5f, 0f); + } + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 3, projectile.owner, 0, 0); + } + } +} diff --git a/Projectiles/Rogue/ShockGrenadeProjectile.png b/Projectiles/Rogue/ShockGrenadeProjectile.png new file mode 100644 index 0000000000..9d72d6d1f6 Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeProjectile.png differ diff --git a/Projectiles/Rogue/ShockGrenadeProjectileGlow.png b/Projectiles/Rogue/ShockGrenadeProjectileGlow.png new file mode 100644 index 0000000000..1dc546dcbe Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeProjectileGlow.png differ diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs new file mode 100644 index 0000000000..a3796bdc72 --- /dev/null +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -0,0 +1,137 @@ + +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class ShockTeslaAura : ModProjectile + { + private const float radius = 98f; + private const int lifetime = 240; + private const int framesX = 3; + private const int framesY = 6; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Electrifying Aura"); + } + + public override void SetDefaults() + { + projectile.width = 218; + projectile.height = 218; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = lifetime; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.localAI[0]++; + projectile.frameCounter = 0; + } + if (projectile.localAI[0] >= framesY) + { + projectile.localAI[0] = 0; + projectile.localAI[1]++; + } + if (projectile.localAI[1] >= framesX) + { + projectile.localAI[1] = 0; + } + + Player player = Main.player[Main.myPlayer]; + Vector2 posDiff = player.Center - projectile.Center; + if (posDiff.Length() <= radius) + { + player.statDefense += 6; + player.lifeRegen += 2; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D sprite = Main.projectileTexture[projectile.type]; + + Color drawColour = Color.White; + Rectangle sourceRect = new Rectangle(projectile.width * (int)projectile.localAI[1], projectile.height * (int)projectile.localAI[0], projectile.width, projectile.height); + Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); + + float opacity = 1f; + int sparkCount = 0; + int fadeTime = 20; + + if (projectile.timeLeft < fadeTime) + { + opacity = projectile.timeLeft * (1f / fadeTime); + sparkCount = fadeTime - projectile.timeLeft; + } + + for (int i = 0; i < sparkCount * 2; i++) + { + int dustType = 132; + if (Main.rand.NextBool()) + { + dustType = 264; + } + float rangeDiff = 2f; + + Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + dustPos.Normalize(); + dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); + + int dust = Dust.NewDust(projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); + Main.dust[dust].noGravity = true; + } + + spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (CalamityGlobalNPC.ShouldAffectNPC(target)) + { + float knockbackMultiplier = knockback - target.knockBackResist; + if (knockbackMultiplier < 0) + { + knockbackMultiplier = 0; + } + Vector2 trueKnockback = target.Center - projectile.Center; + trueKnockback.Normalize(); + target.velocity = trueKnockback * knockbackMultiplier; + } + + target.AddBuff(BuffID.Electrified, 300); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= radius; + } + } +} diff --git a/Projectiles/Rogue/ShockTeslaAura.png b/Projectiles/Rogue/ShockTeslaAura.png new file mode 100644 index 0000000000..d8e87ce805 Binary files /dev/null and b/Projectiles/Rogue/ShockTeslaAura.png differ diff --git a/Projectiles/Rogue/SludgeSplotchProj1.cs b/Projectiles/Rogue/SludgeSplotchProj1.cs index ae9a2e64be..eec4f79aa1 100644 --- a/Projectiles/Rogue/SludgeSplotchProj1.cs +++ b/Projectiles/Rogue/SludgeSplotchProj1.cs @@ -96,6 +96,12 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 9, 2, 0); } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Slow, 240); + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 9, 2, 0); + } + public override void Kill(int timeLeft) { if (projectile.Calamity().stealthStrike) diff --git a/Projectiles/Rogue/SludgeSplotchProj2.cs b/Projectiles/Rogue/SludgeSplotchProj2.cs index d7685afeb0..aa1eef6a54 100644 --- a/Projectiles/Rogue/SludgeSplotchProj2.cs +++ b/Projectiles/Rogue/SludgeSplotchProj2.cs @@ -64,6 +64,11 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Slow, 120); } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Slow, 120); + } + public override void Kill(int timeLeft) { int numDust = 10; diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs new file mode 100644 index 0000000000..64c5bdbcbb --- /dev/null +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -0,0 +1,238 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class WulfrumDroid : ModProjectile + { + public float dust = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Droid"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + //projectile.aiStyle = 62; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (dust == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.minionDamage; + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 61, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + dust += 1f; + } + if (player.minionDamage != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.minionDamage); + projectile.damage = damage2; + } + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 3) + { + projectile.frame = 0; + } + bool flag64 = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.wDroid = false; + } + if (modPlayer.wDroid) + { + projectile.timeLeft = 2; + } + } + float num6 = 0.05f; + float width = (float) projectile.width; + for (int index = 0; index < 1000; ++index) + { + if (index != projectile.whoAmI && Main.projectile[index].active && (Main.projectile[index].owner == projectile.owner && Main.projectile[index].type == projectile.type) && (double) Math.Abs(projectile.position.X - Main.projectile[index].position.X) + (double) Math.Abs(projectile.position.Y - Main.projectile[index].position.Y) < (double) width) + { + if ((double) projectile.position.X < (double) Main.projectile[index].position.X) + projectile.velocity.X -= num6; + else + projectile.velocity.X += num6; + if ((double) projectile.position.Y < (double) Main.projectile[index].position.Y) + projectile.velocity.Y -= num6; + else + projectile.velocity.Y += num6; + } + } + Vector2 vector2_3 = projectile.position; + float num7 = 400f; + bool flag = false; + int num8 = -1; + NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC; + if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this, false)) + { + float num1 = Vector2.Distance(minionAttackTargetNpc.Center, projectile.Center); + if (((double) Vector2.Distance(projectile.Center, vector2_3) > (double) num1 && (double) num1 < (double) num7 || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height)) + { + num7 = num1; + vector2_3 = minionAttackTargetNpc.Center; + flag = true; + num8 = minionAttackTargetNpc.whoAmI; + } + } + if (!flag) + { + for (int index2 = 0; index2 < 200; ++index2) + { + NPC npc = Main.npc[index2]; + if (npc.CanBeChasedBy((object) this, false)) + { + float num1 = Vector2.Distance(npc.Center, projectile.Center); + if (((double) Vector2.Distance(projectile.Center, vector2_3) > (double) num1 && (double) num1 < (double) num7 || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num7 = num1; + vector2_3 = npc.Center; + flag = true; + num8 = index2; + } + } + } + } + int num9 = 500; + if (flag) + num9 = 1000; + if ((double) Vector2.Distance(player.Center, projectile.Center) > (double) num9) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if ((double) projectile.ai[0] == 1.0) + projectile.tileCollide = false; + if (flag && (double) projectile.ai[0] == 0.0) + { + Vector2 vector2_1 = vector2_3 - projectile.Center; + float num1 = vector2_1.Length(); + vector2_1.Normalize(); + if ((double) num1 > 200.0) + { + float num2 = 6f; + Vector2 vector2_2 = vector2_1 * num2; + projectile.velocity.X = (float) (((double) projectile.velocity.X * 40.0 + (double) vector2_2.X) / 41.0); + projectile.velocity.Y = (float) (((double) projectile.velocity.Y * 40.0 + (double) vector2_2.Y) / 41.0); + } + else if ((double) projectile.velocity.Y > -1.0) + projectile.velocity.Y -= 0.1f; + } + else + { + if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) + projectile.ai[0] = 1f; + float num1 = 6f; + if ((double) projectile.ai[0] == 1.0) + num1 = 15f; + Vector2 center = projectile.Center; + Vector2 vector2_1 = player.Center - center + new Vector2(0.0f, -60f); + float num3 = vector2_1.Length(); + if ((double) num3 > 200.0 && (double) num1 < 9.0) + num1 = 9f; + if ((double) num3 < 100.0 && (double) projectile.ai[0] == 1.0 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0.0f; + projectile.netUpdate = true; + } + if ((double) num3 > 2000.0) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float) (projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float) (projectile.width / 2); + } + else if ((double) num3 > 70.0) + { + vector2_1.Normalize(); + projectile.velocity = (projectile.velocity * 20f + vector2_1 * num1) / 21f; + } + else + { + if ((double) projectile.velocity.X == 0.0 && (double) projectile.velocity.Y == 0.0) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + projectile.velocity = projectile.velocity * 1.01f; + } + } + projectile.rotation = projectile.velocity.X * 0.05f; + if ((double) projectile.velocity.X > 0.0) + projectile.spriteDirection = projectile.direction = -1; + else if ((double) projectile.velocity.X < 0.0) + projectile.spriteDirection = projectile.direction = 1; + if ((double) projectile.ai[1] > 0.0) + projectile.ai[1] += (float) Main.rand.Next(1, 4); + if ((double) projectile.ai[1] > 90.0) + { + projectile.ai[1] = 0.0f; + projectile.netUpdate = true; + } + if ((double) projectile.ai[1] != 0.0) + return; + ++projectile.ai[1]; + if (Main.myPlayer != projectile.owner) + return; + if (!flag) + return; + Vector2 vec = vector2_3 - projectile.Center; + vec.Normalize(); + Vector2 vec2 = vec * 10f; + int bolt = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vec2.X, vec2.Y, ModContent.ProjectileType(), projectile.damage, 0.0f, Main.myPlayer, 0.0f, 0.0f); + Main.projectile[bolt].Calamity().forceMinion = true; + Main.projectile[bolt].netUpdate = true; + Main.projectile[bolt].penetrate = 1; + Main.projectile[bolt].extraUpdates = 1; + projectile.netUpdate = true; + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/WulfrumDroid.png b/Projectiles/Summon/WulfrumDroid.png new file mode 100644 index 0000000000..c227fdff07 Binary files /dev/null and b/Projectiles/Summon/WulfrumDroid.png differ diff --git a/Projectiles/Typeless/DirectStrike.cs b/Projectiles/Typeless/DirectStrike.cs new file mode 100644 index 0000000000..f39fc3bbd9 --- /dev/null +++ b/Projectiles/Typeless/DirectStrike.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class DirectStrike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nondescript Damaging Entity"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.penetrate = 1; + projectile.extraUpdates = 0; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.timeLeft = 2; + } + + // Can only strike the given NPC slot (assuming it's a valid identifier) + public override bool? CanHitNPC(NPC target) + { + if (projectile.ai[0] < 0f || projectile.ai[0] > 199f) + return null; + return projectile.ai[0] == target.whoAmI; + } + } +} diff --git a/Projectiles/Typeless/DirectStrike.png b/Projectiles/Typeless/DirectStrike.png new file mode 100644 index 0000000000..50986e43ef Binary files /dev/null and b/Projectiles/Typeless/DirectStrike.png differ diff --git a/Projectiles/Typeless/NanoFlare.cs b/Projectiles/Typeless/NanoFlare.cs new file mode 100644 index 0000000000..6b2e5521ca --- /dev/null +++ b/Projectiles/Typeless/NanoFlare.cs @@ -0,0 +1,94 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Projectiles.Typeless +{ + public class NanoFlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nano Flare"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.extraUpdates = 10; + projectile.timeLeft = 60; + } + + public override void AI() + { + //Dust + for (int i = 0; i< 3; i++) + { + int dint = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 0, default, 0.75f); + Dust dust = Main.dust[dint]; + dust.velocity = projectile.velocity * Main.rand.NextFloat(-0.3f,0.3f); + dust.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); + dust.color = Color.Lerp(dust.color, Color.White, 0.3f); + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 20; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-6f, 6f)); + int dint = Dust.NewDust(projectile.Center, 1, 1, 107, dspeed.X, dspeed.Y, 0, default, 0.7f); + Dust dust = Main.dust[dint]; + dust.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); + dust.color = Color.Lerp(dust.color, Color.White, 0.3f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y,14); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.width = 60; + projectile.height = 60; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + + Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); + float smokeScale = 0.66f; + for (int i = 0; i < 2; i++) + { + switch (Main.rand.Next(1, 5)) + { + case 1: int idx1 = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + Main.gore[idx1].velocity *= smokeScale; + Main.gore[idx1].velocity.X += 1f; + Main.gore[idx1].velocity.Y += 1f; + break; + + case 2: int idx2 = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + Main.gore[idx2].velocity *= smokeScale; + Main.gore[idx2].velocity.X -= 1f; + Main.gore[idx2].velocity.Y += 1f; + break; + + case 3: int idx3 = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + Main.gore[idx3].velocity *= smokeScale; + Main.gore[idx3].velocity.X += 1f; + Main.gore[idx3].velocity.Y -= 1f; + break; + + case 4: int idx4 = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); + Main.gore[idx4].velocity *= smokeScale; + Main.gore[idx4].velocity.X -= 1f; + Main.gore[idx4].velocity.Y -= 1f; + break; + default: break; + } + } + } + } +} diff --git a/Projectiles/Typeless/NanoFlare.png b/Projectiles/Typeless/NanoFlare.png new file mode 100644 index 0000000000..983260eb07 Binary files /dev/null and b/Projectiles/Typeless/NanoFlare.png differ diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index 0dfe3ca83c..9d1dfc61d6 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -44,12 +44,19 @@ namespace CalamityMod.Tiles.AstralDesert public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - if (j < Main.maxTilesY && !Main.tile[i, j + 1].active()) + if (Main.tile[i, j] is null) + return true; + + if (j < Main.maxTilesY) { - Main.tile[i, j].active(false); - Projectile.NewProjectile(new Vector2(i * 16f + 8f, j * 16f + 8f), Vector2.Zero, ModContent.ProjectileType(), 15, 0f); - WorldGen.SquareTileFrame(i, j); - return false; + // tile[i, j+1] can still be null if it's on the edge of a chunk + if (Main.tile[i, j + 1] != null && !Main.tile[i, j + 1].active()) + { + Main.tile[i, j].active(false); + Projectile.NewProjectile(new Vector2(i * 16f + 8f, j * 16f + 8f), Vector2.Zero, ModContent.ProjectileType(), 15, 0f); + WorldGen.SquareTileFrame(i, j); + return false; + } } // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index a36f95ea47..55c2475b29 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -98,7 +98,7 @@ namespace CalamityMod internal static void Unload() { PlantCheckAgainst = null; - VineToGrass.Clear(); + VineToGrass?.Clear(); VineToGrass = null; tileMergeTypes = null; } @@ -126,6 +126,10 @@ namespace CalamityMod #region Specific Framing Code internal static void PlantFrame(int x, int y) { + if (x < 0 || x >= Main.maxTilesX) + return; + if (y < 0 || y >= Main.maxTilesY) + return; Tile tile = Main.tile[x, y]; if (tile is null) return; @@ -220,6 +224,10 @@ namespace CalamityMod internal static void VineFrame(int x, int y) { + if (x < 0 || x >= Main.maxTilesX) + return; + if (y < 0 || y >= Main.maxTilesY) + return; Tile tile = Main.tile[x, y]; if (tile is null) return; @@ -271,6 +279,10 @@ namespace CalamityMod internal static bool BetterGemsparkFraming(int x, int y, bool resetFrame) { + if (x < 0 || x >= Main.maxTilesX) + return false; + if (y < 0 || y >= Main.maxTilesY) + return false; Tile tile = Main.tile[x, y]; if (tile is null) return false; @@ -549,6 +561,10 @@ namespace CalamityMod internal static bool BrimstoneFraming(int x, int y, bool resetFrame) { + if (x < 0 || x >= Main.maxTilesX) + return false; + if (y < 0 || y >= Main.maxTilesY) + return false; Tile tile = Main.tile[x, y]; if (tile is null) return false; @@ -831,7 +847,7 @@ namespace CalamityMod out bool mergedLeft, out bool mergedRight, out bool mergedDown, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) { - if (Main.tile[x, y] is null) + if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY || Main.tile[x, y] is null) { mergedUp = mergedLeft = mergedRight = mergedDown = false; return; @@ -1381,6 +1397,10 @@ namespace CalamityMod internal static void CustomMergeFrame(int x, int y, int myType, int mergeType) { + if (x < 0 || x >= Main.maxTilesX) + return; + if (y < 0 || y >= Main.maxTilesY) + return; Tile tile = Main.tile[x, y]; if (tile is null) return;