diff --git a/Buffs/Cooldowns/DivineBlessCooldown.cs b/Buffs/Cooldowns/DivineBlessCooldown.cs new file mode 100644 index 0000000000..7bfeebdbdb --- /dev/null +++ b/Buffs/Cooldowns/DivineBlessCooldown.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class DivineBlessCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Divine Recharge"); + Description.SetDefault("Your divine powers are recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().divineBlessCooldown = true; + } + } +} diff --git a/Buffs/Cooldowns/DivineBlessCooldown.png b/Buffs/Cooldowns/DivineBlessCooldown.png new file mode 100644 index 0000000000..2057238c4e Binary files /dev/null and b/Buffs/Cooldowns/DivineBlessCooldown.png differ diff --git a/Buffs/DamageOverTime/BanishingFire.cs b/Buffs/DamageOverTime/BanishingFire.cs new file mode 100644 index 0000000000..50750405fe --- /dev/null +++ b/Buffs/DamageOverTime/BanishingFire.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class BanishingFire : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Banishing Fire"); + Description.SetDefault("You shall not be forgiven for your sins"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().banishingFire = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().banishingFire < npc.buffTime[buffIndex]) + npc.Calamity().banishingFire = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + } +} diff --git a/Buffs/DamageOverTime/BanishingFire.png b/Buffs/DamageOverTime/BanishingFire.png new file mode 100644 index 0000000000..32abe939dd Binary files /dev/null and b/Buffs/DamageOverTime/BanishingFire.png differ diff --git a/Buffs/StatBuffs/DivineBless.cs b/Buffs/StatBuffs/DivineBless.cs new file mode 100644 index 0000000000..1f61ad062d --- /dev/null +++ b/Buffs/StatBuffs/DivineBless.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class DivineBless : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Divine Bless"); + Description.SetDefault("+5% damage, increased health regen, attacks inflict Banishing Fire"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().divineBless = true; + } + } +} diff --git a/Buffs/StatBuffs/DivineBless.png b/Buffs/StatBuffs/DivineBless.png new file mode 100644 index 0000000000..3d9c73ec00 Binary files /dev/null and b/Buffs/StatBuffs/DivineBless.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index eea699f3b4..5de2d30bfd 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -12,6 +12,7 @@ using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor; using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.Dyes; +using CalamityMod.Items.LoreItems; using CalamityMod.Items.Mounts; using CalamityMod.Items.Tools; using CalamityMod.Items.TreasureBags; @@ -574,10 +575,12 @@ namespace CalamityMod.CalPlayer public bool rustyMedal = false; public bool noStupidNaturalARSpawns = false; public bool burdenBreakerYeet = false; - public bool roverDrive = false; - public int roverDriveTimer = 0; - public int roverFrameCounter = 0; - public int roverFrame = 0; + public bool roverDrive = false; + public int roverDriveTimer = 0; + public int roverFrameCounter = 0; + public int roverFrame = 0; + public bool angelicAlliance = false; + public int angelicActivate = -1; #endregion #region Armor Set @@ -742,6 +745,8 @@ namespace CalamityMod.CalPlayer public bool energyShellCooldown = false; public bool prismaticCooldown = false; public bool waterLeechBleeding = false; + public bool divineBlessCooldown = false; + public bool banishingFire = false; #endregion #region Buff @@ -835,8 +840,9 @@ namespace CalamityMod.CalPlayer public bool hallowedRegen = false; public bool hallowedPower = false; public bool kamiBoost = false; - public bool avertorBonus = false; - #endregion + public bool avertorBonus = false; + public bool divineBless = false; + #endregion #region Minion public bool wDroid = false; @@ -1603,7 +1609,8 @@ namespace CalamityMod.CalPlayer rustyMedal = false; noStupidNaturalARSpawns = false; burdenBreakerYeet = false; - roverDrive = false; + roverDrive = false; + angelicAlliance = false; daedalusReflect = false; daedalusSplit = false; @@ -1758,6 +1765,8 @@ namespace CalamityMod.CalPlayer energyShellCooldown = false; prismaticCooldown = false; waterLeechBleeding = false; + divineBlessCooldown = false; + banishingFire = false; revivify = false; trinketOfChiBuff = false; @@ -1816,7 +1825,8 @@ namespace CalamityMod.CalPlayer polarisBoostTwo = false; polarisBoostThree = false; bloodfinBoost = false; - bloodPactBoost = false; + bloodPactBoost = false; + divineBless = false; killSpikyBalls = false; @@ -2060,18 +2070,16 @@ namespace CalamityMod.CalPlayer nanoFlareCooldown = 0; fleshTotemCooldown = false; sandCloakCooldown = false; - icicleCooldown = 0; - statisTimer = 0; - hallowedRuneCooldown = 0; - phantomicBulwarkCooldown = 0; - phantomicHeartRegen = 0; - sulphurBubbleCooldown = 0; - ladHearts = 0; - prismaticLasers = 0; - roverDriveTimer = 0; - resetHeightandWidth = false; - noLifeRegen = false; - + icicleCooldown = 0; + statisTimer = 0; + hallowedRuneCooldown = 0; + sulphurBubbleCooldown = 0; + ladHearts = 0; + prismaticLasers = 0; + roverDriveTimer = 0; + angelicActivate = -1; + resetHeightandWidth = false; + noLifeRegen = false; alcoholPoisoning = false; shadowflame = false; wDeath = false; @@ -2117,6 +2125,8 @@ namespace CalamityMod.CalPlayer energyShellCooldown = false; prismaticCooldown = false; waterLeechBleeding = false; + divineBlessCooldown = false; + banishingFire = false; #endregion #region Rogue @@ -2242,10 +2252,11 @@ namespace CalamityMod.CalPlayer revivify = false; healCounter = 300; danceOfLightCharge = 0; - bloodPactBoost = false; - rangedAmmoCost = 1f; - avertorBonus = false; - #endregion + bloodPactBoost = false; + rangedAmmoCost = 1f; + avertorBonus = false; + divineBless = false; + #endregion #region Armorbonuses flamethrowerBoost = false; @@ -2723,12 +2734,39 @@ namespace CalamityMod.CalPlayer } } } + if (CalamityMod.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == player.whoAmI && !divineBless && !divineBlessCooldown) + { + int seconds = CalamityUtils.SecondsToFrames(15f); + player.AddBuff(ModContent.BuffType(), seconds, false); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AngelicAllianceActivation"), player.Center); + + // Spawn an archangel for every minion you have + float angelAmt = 0f; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + if (proj.minionSlots <= 0f || !proj.IsSummon()) + continue; + if (proj.active && proj.owner == player.whoAmI) + { + angelAmt += 1f; + } + } + for (int projIndex = 0; projIndex < angelAmt; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + float start = 360f / angelAmt; + Projectile.NewProjectile(new Vector2((int)(player.Center.X + (Math.Sin(projIndex * start) * 300)), (int)(player.Center.Y + (Math.Cos(projIndex * start) * 300))), Vector2.Zero, ModContent.ProjectileType(), proj.damage / 4, proj.knockBack / 4f, player.whoAmI, Main.rand.Next(120), projIndex * start); + player.statLife += 2; + player.HealEffect(2); + } + } if (CalamityMod.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0 && !sandCloakCooldown) { player.AddBuff(ModContent.BuffType(), 1800, false); //30 seconds rogueStealth -= rogueStealthMax * 0.25f; - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, player.whoAmI, 0, 0); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, player.whoAmI); Main.PlaySound(SoundID.Item, player.position, 45); } if (CalamityMod.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && @@ -4321,7 +4359,7 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(player.name + " was turned to ashes by the Profaned Goddess."); } - if (hFlames) + if (hFlames || banishingFire) { damageSource = PlayerDeathReason.ByCustomReason(player.name + " fell prey to their sins."); } diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 790c444a42..e62115cd7d 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -472,32 +473,7 @@ namespace CalamityMod.CalPlayer int totalMoonlightDyes = drawPlayer.dye.Count(dyeItem => dyeItem.type == ModContent.ItemType()); if (totalMoonlightDyes <= 0) return; - float auroraCount = 5 + (int)MathHelper.Clamp(totalMoonlightDyes, 0f, 4f) * 2; - float opacity = MathHelper.Clamp(totalMoonlightDyes / 3f, 0f, 1f); - - opacity *= Main.dayTime ? 0.4f : 0.25f; - - float time = Main.GlobalTime % 3f / 3f; - Texture2D auroraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AuroraTexture"); - for (int i = 0; i < auroraCount; i++) - { - float incrementOffsetAngle = MathHelper.TwoPi * i / auroraCount; - float xOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f) * 20f; - float yOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f + MathHelper.ToRadians(60f)) * 6f; - float rotation = (float)Math.Sin(incrementOffsetAngle) * MathHelper.Pi / 12f; - Color color = GetCurrentMoonlightDyeColor(incrementOffsetAngle); - Vector2 offset = new Vector2(xOffset, yOffset - 14f); - DrawData drawData = new DrawData(auroraTexture, - drawPlayer.Top + offset - Main.screenPosition, - null, - color * opacity, - rotation + MathHelper.PiOver2, - auroraTexture.Size() * 0.5f, - 0.135f, - SpriteEffects.None, - 1); - Main.playerDrawData.Add(drawData); - } + CalamityUtils.DrawAuroras(drawPlayer, 5 + (int)MathHelper.Clamp(totalMoonlightDyes, 0f, 4f) * 2, MathHelper.Clamp(totalMoonlightDyes / 3f, 0f, 1f), GetCurrentMoonlightDyeColor()); }); public static readonly PlayerLayer AuralisAuroraEffects = new PlayerLayer("CalamityMod", "AuralisAurora", PlayerLayer.Body, drawInfo => @@ -506,30 +482,16 @@ namespace CalamityMod.CalPlayer CalamityPlayer modPlayer = drawPlayer.Calamity(); if (modPlayer.auralisAuroraCounter < 300 || modPlayer.auralisAuroraCooldown > 0) return; - float auroraCount = 7; - float opacity = 0.4f; + CalamityUtils.DrawAuroras(drawPlayer, 7, 0.4f, CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 3f)); + }); - float time = Main.GlobalTime % 3f / 3f; - Texture2D auroraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AuroraTexture"); - for (int i = 0; i < auroraCount; i++) - { - float incrementOffsetAngle = MathHelper.TwoPi * i / auroraCount; - float xOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f) * 20f; - float yOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f + MathHelper.ToRadians(60f)) * 6f; - float rotation = (float)Math.Sin(incrementOffsetAngle) * MathHelper.Pi / 12f; - Color color = CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 3f); - Vector2 offset = new Vector2(xOffset, yOffset - 14f); - DrawData drawData = new DrawData(auroraTexture, - drawPlayer.Top + offset - Main.screenPosition, - null, - color * opacity, - rotation + MathHelper.PiOver2, - auroraTexture.Size() * 0.5f, - 0.135f, - SpriteEffects.None, - 1); - Main.playerDrawData.Add(drawData); - } + public static readonly PlayerLayer AngelicAllianceAurora = new PlayerLayer("CalamityMod", "AngelicAllianceAurora", PlayerLayer.Body, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (!modPlayer.divineBless) + return; + CalamityUtils.DrawAuroras(drawPlayer, 7, 0.4f, CalamityUtils.ColorSwap(new Color(255, 163, 56), new Color(242, 48, 187), 3f)); }); public static readonly PlayerLayer IbanDevRobot = new PlayerLayer("CalamityMod", "IbanDevRobot", PlayerLayer.Body, drawInfo => @@ -686,6 +648,7 @@ namespace CalamityMod.CalPlayer list.Add(StratusSphereDrawing); list.Add(ProfanedMoonlightDyeEffects); list.Add(AuralisAuroraEffects); + list.Add(AngelicAllianceAurora); list.Add(IbanDevRobot); list.Add(DyeInvisibilityFix); } @@ -1010,7 +973,7 @@ namespace CalamityMod.CalPlayer Main.playerDrawDust.Add(dust); } } - if (calamityPlayer.hFlames || calamityPlayer.hInferno) + if (calamityPlayer.hFlames || calamityPlayer.hInferno || calamityPlayer.banishingFire) { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 7bbd4d7641..eea5eafaa1 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Ranged; @@ -27,7 +28,7 @@ namespace CalamityMod.CalPlayer lifeRegenMult *= 0.8; int lifeRegenLost = 0; - // Initial Debuffs + // Initial Debuffs // Get fucked, Nebula Armor player.nebulaLevelLife = 0; @@ -208,6 +209,15 @@ namespace CalamityMod.CalPlayer lifeRegenLost += 16; } + if (modPlayer.banishingFire) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + lifeRegenLost += 60; + } + if (modPlayer.waterLeechBleeding) { if (player.lifeRegen > 0) @@ -396,6 +406,15 @@ namespace CalamityMod.CalPlayer // Buffs + if (modPlayer.divineBless) + { + if (player.whoAmI == Main.myPlayer && player.miscCounter % 15 == 0) + { + if (!modPlayer.noLifeRegen) + player.statLife += 1; + } + } + if (modPlayer.bloodfinBoost) { if (player.lifeRegen < 0) @@ -748,8 +767,8 @@ namespace CalamityMod.CalPlayer { player.lifeRegen += 7; - if (player.lifeRegenTime < 1800) - player.lifeRegenTime = 1800; + if (player.lifeRegenTime < 1800) + player.lifeRegenTime = 1800; player.lifeRegenTime += 4; } @@ -778,6 +797,41 @@ namespace CalamityMod.CalPlayer player.statLife += 1; } + if (modPlayer.divineBless) + { + player.lifeRegenTime++; + + int lifeRegenMaxBoost2 = 1; + float lifeRegenLifeRegenTimeMaxBoost2 = 4f; + + player.lifeRegen += lifeRegenMaxBoost2; + + float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > lifeRegenLifeRegenTimeMaxBoost2) + num3 = lifeRegenLifeRegenTimeMaxBoost2; + + player.lifeRegen += (int)num3; + } + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + player.lifeRegenCount++; + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + { + int regen = Dust.NewDust(player.position, player.width, player.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 200, default, 1f); + Main.dust[regen].noGravity = true; + Main.dust[regen].fadeIn = 1.3f; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); + Main.dust[regen].velocity = velocity; + velocity.Normalize(); + velocity *= 34f; + Main.dust[regen].position = player.Center - velocity; + } + } + } + // Standing still healing bonuses (all exclusive with vanilla Shiny Stone) if (!player.shinyStone) { @@ -912,26 +966,26 @@ namespace CalamityMod.CalPlayer } } - if (player.statLife < modPlayer.actualMaxLife) - { - bool noLifeRegenCap = (player.shinyStone || modPlayer.draedonsHeart || modPlayer.cFreeze || modPlayer.shadeRegen || modPlayer.photosynthesis || modPlayer.camper) && - player.StandingStill() && player.itemAnimation == 0; - - if (!noLifeRegenCap) + if (player.statLife < modPlayer.actualMaxLife) { - // Max HP = 400 - // 350 HP = 1 - 0.875 * 10 = 1.25 = 1 - // 100 HP = 1 - 0.25 * 10 = 7.5 = 7 - // 200 HP = 1 - 0.5 * 10 = 5 - int lifeRegenScale = (int)((1f - (player.statLife / modPlayer.actualMaxLife)) * 10f); // 9 to 0 (1% HP to 100%) - if (player.lifeRegen > lifeRegenScale) + bool noLifeRegenCap = (player.shinyStone || modPlayer.draedonsHeart || modPlayer.cFreeze || modPlayer.shadeRegen || modPlayer.photosynthesis || modPlayer.camper) && + player.StandingStill() && player.itemAnimation == 0; + + if (!noLifeRegenCap) { - float lifeRegenScalar = 1f + (player.statLife / modPlayer.actualMaxLife); // 1 to 2 (1% HP to 100%) - int defLifeRegen = (int)(player.lifeRegen / lifeRegenScalar); - player.lifeRegen = defLifeRegen; + // Max HP = 400 + // 350 HP = 1 - 0.875 * 10 = 1.25 = 1 + // 100 HP = 1 - 0.25 * 10 = 7.5 = 7 + // 200 HP = 1 - 0.5 * 10 = 5 + int lifeRegenScale = (int)((1f - (player.statLife / modPlayer.actualMaxLife)) * 10f); // 9 to 0 (1% HP to 100%) + if (player.lifeRegen > lifeRegenScale) + { + float lifeRegenScalar = 1f + (player.statLife / modPlayer.actualMaxLife); // 1 to 2 (1% HP to 100%) + int defLifeRegen = (int)(player.lifeRegen / lifeRegenScalar); + player.lifeRegen = defLifeRegen; + } } } - } if (player.lifeRegen > 0) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 414e06fcb0..32476dbec4 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -261,7 +261,7 @@ namespace CalamityMod.CalPlayer // If Revengeance Mode is not active, then set rippers to zero else if (player.whoAmI == Main.myPlayer) - { + { modPlayer.rage = 0; modPlayer.adrenaline = 0; } @@ -285,8 +285,8 @@ namespace CalamityMod.CalPlayer if (modPlayer.rageGainCooldown > 0) --modPlayer.rageGainCooldown; - // This is how much Rage will be changed by this frame. - float rageDiff = 0; + // This is how much Rage will be changed by this frame. + float rageDiff = 0; // If the player equips multiple rage generation accessories they get the max possible effect without stacking any of them. { @@ -395,82 +395,82 @@ namespace CalamityMod.CalPlayer bool rageFading = modPlayer.rageCombatFrames <= 0 && !modPlayer.heartOfDarkness && !modPlayer.shatteredCommunity; - // If Rage Mode is currently active, you smoothly lose all rage over the duration. - if (modPlayer.rageModeActive) + // If Rage Mode is currently active, you smoothly lose all rage over the duration. + if (modPlayer.rageModeActive) rageDiff -= modPlayer.rageMax / modPlayer.RageDuration; // If out of combat and NOT using Heart of Darkness or Shattered Community, Rage fades away. else if (!modPlayer.rageModeActive && rageFading) rageDiff -= modPlayer.rageMax / CalamityPlayer.RageFadeTime; - // Apply the rage change and cap rage in both directions. - modPlayer.rage += rageDiff; - if (modPlayer.rage < 0) - modPlayer.rage = 0; + // Apply the rage change and cap rage in both directions. + modPlayer.rage += rageDiff; + if (modPlayer.rage < 0) + modPlayer.rage = 0; - if (modPlayer.rage >= modPlayer.rageMax) - { + if (modPlayer.rage >= modPlayer.rageMax) + { // Rage IS NOT capped while active. It can go above 100%. if (!modPlayer.rageModeActive) - modPlayer.rage = modPlayer.rageMax; + modPlayer.rage = modPlayer.rageMax; - // Play a sound when the Rage Meter is full - if (modPlayer.playFullRageSound) - { - modPlayer.playFullRageSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); - } - } - else - modPlayer.playFullRageSound = true; + // Play a sound when the Rage Meter is full + if (modPlayer.playFullRageSound) + { + modPlayer.playFullRageSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); + } + } + else + modPlayer.playFullRageSound = true; - // This is how much Adrenaline will be changed by this frame. - float adrenalineDiff = 0; - bool SCalAlive = NPC.AnyNPCs(ModContent.NPCType()); - bool wofAndNotHell = Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16); + // This is how much Adrenaline will be changed by this frame. + float adrenalineDiff = 0; + bool SCalAlive = NPC.AnyNPCs(ModContent.NPCType()); + bool wofAndNotHell = Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16); - // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. - if (modPlayer.adrenalineModeActive) + // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. + if (modPlayer.adrenalineModeActive) adrenalineDiff = -modPlayer.adrenalineMax / modPlayer.AdrenalineDuration; - else - { - // If any boss is alive (or you are between DoG phases or Boss Rush is active), you gain adrenaline smoothly. - // EXCEPTION: Wall of Flesh is alive and you are not in hell. Then you don't get anything. - if ((CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive) && - !wofAndNotHell) - { + else + { + // If any boss is alive (or you are between DoG phases or Boss Rush is active), you gain adrenaline smoothly. + // EXCEPTION: Wall of Flesh is alive and you are not in hell. Then you don't get anything. + if ((CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive) && + !wofAndNotHell) + { adrenalineDiff += modPlayer.adrenalineMax / modPlayer.AdrenalineChargeTime; - } + } // If you aren't actively in a boss fight, adrenaline rapidly fades away. - else + else adrenalineDiff = -modPlayer.adrenalineMax / modPlayer.AdrenalineFadeTime; - } + } // In the SCal fight, adrenaline charges 33% slower (meaning it takes 50% longer to fully charge it). - if (SCalAlive && adrenalineDiff > 0f) - adrenalineDiff *= 0.67f; + if (SCalAlive && adrenalineDiff > 0f) + adrenalineDiff *= 0.67f; - // Apply the adrenaline change and cap adrenaline in both directions. - modPlayer.adrenaline += adrenalineDiff; - if (modPlayer.adrenaline < 0) - modPlayer.adrenaline = 0; + // Apply the adrenaline change and cap adrenaline in both directions. + modPlayer.adrenaline += adrenalineDiff; + if (modPlayer.adrenaline < 0) + modPlayer.adrenaline = 0; - if (modPlayer.adrenaline >= modPlayer.adrenalineMax) - { - modPlayer.adrenaline = modPlayer.adrenalineMax; + if (modPlayer.adrenaline >= modPlayer.adrenalineMax) + { + modPlayer.adrenaline = modPlayer.adrenalineMax; - // Play a sound when the Adrenaline Meter is full - if (modPlayer.playFullAdrenalineSound) - { - modPlayer.playFullAdrenalineSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); - } - } - else - modPlayer.playFullAdrenalineSound = true; - } + // Play a sound when the Adrenaline Meter is full + if (modPlayer.playFullAdrenalineSound) + { + modPlayer.playFullAdrenalineSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); + } + } + else + modPlayer.playFullAdrenalineSound = true; + } #endregion #region Misc Effects @@ -1787,6 +1787,13 @@ namespace CalamityMod.CalPlayer modPlayer.prismaticLasers = 1800; player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(30f), true); } + if (!modPlayer.angelicAlliance && modPlayer.divineBless) + { + modPlayer.divineBless = false; + player.ClearBuff(ModContent.BuffType()); + int seconds = CalamityUtils.SecondsToFrames(60f); + player.AddBuff(ModContent.BuffType(), seconds, false); + } } #endregion @@ -2452,7 +2459,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.irradiated) { - player.statDefense -= 10; + player.statDefense -= 10; player.moveSpeed -= 0.1f; player.allDamage += 0.05f; player.minionKB += 0.5f; @@ -2748,8 +2755,8 @@ namespace CalamityMod.CalPlayer { bool offenseBuffs = (Main.dayTime && !player.wet) || player.lavaWet; if (offenseBuffs) - flightTimeMult += 0.1; - } + flightTimeMult += 0.1; + } // Increase wing time if (player.wingTimeMax > 0) @@ -3311,15 +3318,16 @@ namespace CalamityMod.CalPlayer bool crystal = modPlayer.profanedCrystal && !modPlayer.profanedCrystalForce; bool summonSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet; + int guardianAmt = 1; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); if (crystal || player.Calamity().minionSlotStat >= 10) { player.Calamity().gDefense = true; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); } @@ -3327,7 +3335,7 @@ namespace CalamityMod.CalPlayer { player.Calamity().gOffense = true; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); } } @@ -3420,11 +3428,15 @@ namespace CalamityMod.CalPlayer ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() }; + int projAmt = 1; for (int i = 0; i < summonDeleteList.Count; i++) { - if (player.ownedProjectileCounts[summonDeleteList[i]] > 1) + if (player.ownedProjectileCounts[summonDeleteList[i]] > projAmt) { for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { @@ -3583,6 +3595,30 @@ namespace CalamityMod.CalPlayer } } + if (modPlayer.angelicAlliance && Main.myPlayer == player.whoAmI) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (hasBuff == ModContent.BuffType()) + { + modPlayer.angelicActivate = player.buffTime[l]; + } + if (hasBuff == ModContent.BuffType()) + { + if (player.buffTime[l] == 1) + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } + } + if (modPlayer.angelicActivate == 1) + { + int seconds = CalamityUtils.SecondsToFrames(60f); + player.AddBuff(ModContent.BuffType(), seconds, false); + } + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + modPlayer.angelicActivate = -1; + } + if (modPlayer.theBee) { if (player.statLife >= player.statLifeMax2) @@ -3956,7 +3992,7 @@ namespace CalamityMod.CalPlayer // 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% if (player.endurance > 0f) player.endurance = 1f - (1f / (1f + player.endurance)); - + // Do not apply reduced aggro if there are any bosses alive and it's singleplayer if (CalamityPlayer.areThereAnyDamnBosses && Main.netMode == NetmodeID.SinglePlayer) { @@ -3973,7 +4009,7 @@ namespace CalamityMod.CalPlayer player.endurance -= 0.1f; if (modPlayer.irradiated) - player.endurance -= 0.1f; + player.endurance -= 0.1f; if (modPlayer.corrEffigy) player.endurance -= 0.05f; diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 842948dacd..c23e035d76 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Armor; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles; using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Melee; @@ -729,6 +730,7 @@ namespace CalamityMod.CalPlayer public static void NPCDebuffs(Player player, Mod mod, NPC target, bool melee, bool ranged, bool magic, bool summon, bool rogue, bool proj) { CalamityPlayer modPlayer = player.Calamity(); + if (melee) //prevents Deep Sea Dumbell from snagging true melee debuff memes { if (modPlayer.eGauntlet) @@ -813,6 +815,10 @@ namespace CalamityMod.CalPlayer { target.AddBuff(Main.dayTime ? BuffType() : BuffType(), 600); } + if (modPlayer.divineBless) + { + target.AddBuff(BuffType(), 60); + } if (modPlayer.tearMinions) { diff --git a/CalamityMod.cs b/CalamityMod.cs index 265747c919..683957da5c 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -77,6 +77,7 @@ namespace CalamityMod public static ModHotKey SandCloakHotkey; public static ModHotKey SpectralVeilHotKey; public static ModHotKey PlaguePackHotKey; + public static ModHotKey AngelicAllianceHotKey; // Boss Spawners public static int ghostKillCount = 0; @@ -173,6 +174,7 @@ namespace CalamityMod SandCloakHotkey = RegisterHotKey("Sand Cloak Effect", "C"); SpectralVeilHotKey = RegisterHotKey("Spectral Veil Teleport", "Z"); PlaguePackHotKey = RegisterHotKey("Booster Dash", "Q"); + AngelicAllianceHotKey = RegisterHotKey("Angelic Alliance Blessing", "G"); if (!Main.dedServ) LoadClient(); @@ -303,6 +305,7 @@ namespace CalamityMod SandCloakHotkey = null; SpectralVeilHotKey = null; PlaguePackHotKey = null; + AngelicAllianceHotKey = null; AstralCactusTexture = null; AstralCactusGlowTexture = null; diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs new file mode 100644 index 0000000000..40d80fe731 --- /dev/null +++ b/Items/Accessories/AngelicAlliance.cs @@ -0,0 +1,79 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + //Developer item, dedicatee: Nincity + public class AngelicAlliance : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Angelic Alliance"); + Tooltip.SetDefault("Call upon the force of heaven to empower your attacks and minions\n" + + "Courage, Enlightenment, Bliss. United in Judgement\n" + + "+2 max minions, 15% increased summon damage, and 8% increased damage to all other classes\n" + + "Life regeneration is boosted while jumping\n" + + "This line is modified in the code below. If you can read this, someone probably did something wrong (It was Ben)\n" + + "While under the effects of Divine Bless, for every minion you have, an archangel shall be summoned to aid you in combat\n" + + "Each spawned angel will instantly heal you for two health\n" + + "All minion attacks inflict Banishing Fire and you are granted a flat health boost of four health per second\n" + + "This effect has a cooldown of 1 minute"); + } + + public override void SetDefaults() + { + item.width = 56; + item.height = 92; + item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + item.accessory = true; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; + } + + public override void ModifyTooltips(List list) + { + string hotkey = CalamityMod.AngelicAllianceHotKey.TooltipHotkeyString(); + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "Press " + hotkey + " to grace yourself in divinity for 15 seconds"; + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.angelicAlliance = true; + player.allDamage += 0.08f; + player.minionDamage += 0.07f; //7% + 8% = 15% + player.maxMinions += 2; + if (player.controlJump) + player.lifeRegen += 4; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddRecipeGroup("AnyHallowedHelmet"); + //recipe.AddRecipeGroup("AnyHallowedPlatemail"); + //recipe.AddRecipeGroup("AnyHallowedGreaves"); + recipe.AddIngredient(ItemID.HallowedPlateMail); + recipe.AddIngredient(ItemID.HallowedGreaves); + recipe.AddIngredient(ItemID.PaladinsShield); + recipe.AddIngredient(ItemID.TrueExcalibur); + recipe.AddIngredient(ItemID.CrossNecklace); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AngelicAlliance.png b/Items/Accessories/AngelicAlliance.png new file mode 100644 index 0000000000..ced2c42de5 Binary files /dev/null and b/Items/Accessories/AngelicAlliance.png differ diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index e356723fb4..bf5da7bdde 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -124,6 +124,15 @@ namespace CalamityMod.Items nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f); if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f); + if (item.type == ModContent.ItemType()) + { + nameLine.overrideColor = CalamityUtils.MulticolorLerp(Main.GlobalTime / 2f % 1f, new Color[] + { + new Color(255, 196, 55), + new Color(255, 231, 107), + new Color(255, 254, 243) + }); + } // TODO -- for cleanliness, ALL color math should either be a one-line color swap or inside the item's own file // The items that currently violate this are all below: diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 0a0e7b276b..2a0af9787e 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -567,7 +567,6 @@ namespace CalamityMod List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), /*ItemType(), */ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Jungle Biome"; - // TODO -- this setup code is only run once, so the despawn message can't be changed post-eclipse. Find a way around this. string despawn = CalamityUtils.ColorMessage("Yharon found you too weak to stay near your gravestone.", new Color(0xFF, 0xA5, 0x00)); string bossLogTex = "CalamityMod/NPCs/Yharon/Yharon_BossChecklist"; AddBoss(bossChecklist, calamity, "Yharon", order, type, DownedYharon, summon, loot, collection, instructions, despawn, bossLogTex); @@ -578,7 +577,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("SupremeCalamitas", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c1d1ad1221..8952cd847c 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -161,6 +161,7 @@ namespace CalamityMod.NPCs public int relicOfResilienceCooldown = 0; public int relicOfResilienceWeakness = 0; public int GaussFluxTimer = 0; + public int banishingFire = 0; // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; @@ -914,7 +915,7 @@ namespace CalamityMod.NPCs // Oiled debuff makes flame debuffs 25% more effective if (npc.oiled) { - int oiledDoT = (bFlames > 0 ? 10 : 0) + (hFlames > 0 ? 13 : 0) + (gsInferno > 0 ? 63 : 0) + (aFlames > 0 ? 32 : 0) + (dFlames > 0 ? 625 : 0); + int oiledDoT = (bFlames > 0 ? 10 : 0) + (hFlames > 0 ? 13 : 0) + (gsInferno > 0 ? 63 : 0) + (aFlames > 0 ? 32 : 0) + (dFlames > 0 ? 625 : 0) + (banishingFire > 0 ? 375 : 0); if (oiledDoT > 0) { int lifeRegenValue = oiledDoT * 4 + 12; @@ -945,6 +946,10 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(electrified, electrifiedDamage, displayedValue, ref npc.lifeRegen, ref damage); else ApplyDPSDebuff(electrified, electrifiedDamage * 4, displayedValue * 4, ref npc.lifeRegen, ref damage); + if (npc.lifeMax < 25000000) + ApplyDPSDebuff(banishingFire, 20000, 4000, ref npc.lifeRegen, ref damage); + else + ApplyDPSDebuff(banishingFire, npc.lifeMax / 2500, npc.lifeMax / 2500, ref npc.lifeRegen, ref damage); } public void ApplyDPSDebuff(int debuff, int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage) @@ -3503,6 +3508,8 @@ namespace CalamityMod.NPCs GaussFluxTimer--; if (ladHearts > 0) ladHearts--; + if (banishingFire > 0) + banishingFire--; // Queen Bee is completely immune to having her movement impaired if not in a high difficulty mode. if (npc.type == NPCID.QueenBee && !CalamityWorld.revenge && !CalamityWorld.malice && !BossRushEvent.BossRushActive) @@ -4391,7 +4398,7 @@ namespace CalamityMod.NPCs } } - if (hFlames > 0) + if (hFlames > 0 || banishingFire > 0) { if (Main.rand.Next(5) < 4) { diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index a2d9641a54..02ce465f12 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.Polterghast public override void SetDefaults() { npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 50f; + npc.npcSlots = 50f; npc.GetNPCDamage(); npc.width = 90; npc.height = 120; diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 058aa3bf79..3be7354009 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Boss; using CalamityMod.Dusts; using CalamityMod.World; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 7fe3f94eb2..f0a014c595 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Items.Accessories; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; @@ -2686,6 +2687,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Rejoice! Hybrid weapons are no more, so this list is no longer cluttered. DropHelper.DropItemFromSetCondition(npc, true, Main.expertMode, ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 8d2a25a218..1b7d98e028 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 427e6a9ec2..cc53500596 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 00d81d5169..90d13d2ebd 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.Yharon public override void SetDefaults() { npc.Calamity().canBreakPlayerDefense = true; - npc.npcSlots = 50f; + npc.npcSlots = 50f; npc.GetNPCDamage(); npc.width = 200; npc.height = 200; @@ -74,7 +74,6 @@ namespace CalamityMod.NPCs.Yharon aiType = -1; npc.value = Item.buyPrice(1, 0, 0, 0); npc.boss = true; - npc.DR_NERD(normalDR, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); @@ -603,7 +602,7 @@ namespace CalamityMod.NPCs.Yharon } else npc.localAI[1] += 1f; - } + } npc.netUpdate = true; } @@ -629,7 +628,7 @@ namespace CalamityMod.NPCs.Yharon // Fireball breath else if (npc.ai[0] == 2f) { - if (npc.ai[1] == 0f) + if (npc.ai[1] == 0f) npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); @@ -747,7 +746,7 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (npc.ai[0] == 6f && !player.dead) { - if (npc.ai[1] == 0f) + if (npc.ai[1] == 0f) npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); @@ -759,7 +758,7 @@ namespace CalamityMod.NPCs.Yharon else npc.velocity *= 0.98f; - int num1477 = Math.Sign(player.Center.X - vectorCenter.X); + int num1477 = Math.Sign(player.Center.X - vectorCenter.X); if (num1477 != 0) { if (npc.ai[2] == 0f && num1477 != npc.direction) @@ -902,7 +901,7 @@ namespace CalamityMod.NPCs.Yharon } else npc.localAI[1] += 1f; - } + } else if (aiState == 6) { npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; @@ -1102,7 +1101,7 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (npc.ai[0] == 13f && !player.dead) { - if (npc.ai[1] == 0f) + if (npc.ai[1] == 0f) npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); @@ -1114,7 +1113,7 @@ namespace CalamityMod.NPCs.Yharon else npc.velocity *= 0.98f; - int num1477 = Math.Sign(player.Center.X - vectorCenter.X); + int num1477 = Math.Sign(player.Center.X - vectorCenter.X); if (num1477 != 0) { if (npc.ai[2] == 0f && num1477 != npc.direction) @@ -1260,7 +1259,7 @@ namespace CalamityMod.NPCs.Yharon } else npc.localAI[1] += 1f; - } + } else if (aiState == 6) { npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; @@ -1705,7 +1704,7 @@ namespace CalamityMod.NPCs.Yharon } else if (npc.ai[0] == 1f) { - if (npc.ai[2] == 0f) + if (npc.ai[2] == 0f) npc.ai[2] = (vectorCenter.X < targetData.Center.X) ? 1 : -1; Vector2 destination = targetData.Center + new Vector2(-npc.ai[2], 0f); @@ -1714,7 +1713,7 @@ namespace CalamityMod.NPCs.Yharon if (!targetDead) { if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) - npc.SimpleFlyMovement(desiredVelocity, acceleration); + npc.SimpleFlyMovement(desiredVelocity, acceleration); else npc.velocity *= 0.98f; } @@ -3013,13 +3012,13 @@ namespace CalamityMod.NPCs.Yharon } if (npc.frame.Y >= frameHeight * 5) npc.frame.Y = 0; - } + } else { npc.frame.Y = frameHeight * 5; if (doTelegraphRoarAnimation) npc.frame.Y = frameHeight * 6; - } + } return; } diff --git a/Projectiles/Summon/AngelBolt.cs b/Projectiles/Summon/AngelBolt.cs new file mode 100644 index 0000000000..dce9e63033 --- /dev/null +++ b/Projectiles/Summon/AngelBolt.cs @@ -0,0 +1,50 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class AngelBolt : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 45; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + } + + public override void AI() + { + if (projectile.timeLeft % 2f == 0f) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * 0.25f; + int num448 = Dust.NewDust(vector33, 1, 1, (int)CalamityDusts.ProfanedFire, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].noGravity = true; + Main.dust[num448].noLight = true; + Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.1f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + } +} diff --git a/Projectiles/Summon/AngelOrb.cs b/Projectiles/Summon/AngelOrb.cs new file mode 100644 index 0000000000..feae94e766 --- /dev/null +++ b/Projectiles/Summon/AngelOrb.cs @@ -0,0 +1,42 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class AngelOrb : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 150f, 6f, 6f, 2, ModContent.ProjectileType(), 1D, true); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + } +} diff --git a/Projectiles/Summon/AngelRay.cs b/Projectiles/Summon/AngelRay.cs new file mode 100644 index 0000000000..a01c7fe624 --- /dev/null +++ b/Projectiles/Summon/AngelRay.cs @@ -0,0 +1,80 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class AngelRay : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.penetrate = 10; + projectile.extraUpdates = 100; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.2f, 0.01f, 0.1f); + projectile.ai[0] += 1f; + if (projectile.ai[0] % 6f == 0f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + } + + if (projectile.ai[0] > 16f && projectile.ai[0] % 2f == 0f) + { + Vector2 source = projectile.position; + int pink = Dust.NewDust(source, 1, 1, (int)CalamityDusts.ProfanedFire, 0f, 0f, 0, default, 1.25f); + Main.dust[pink].noGravity = true; + Main.dust[pink].noLight = true; + Main.dust[pink].position = source; + Main.dust[pink].scale = Main.rand.Next(70, 110) * 0.013f; + Main.dust[pink].velocity *= 0.1f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + } +} diff --git a/Projectiles/Summon/AngelicAllianceArchangel.cs b/Projectiles/Summon/AngelicAllianceArchangel.cs new file mode 100644 index 0000000000..1540e0903b --- /dev/null +++ b/Projectiles/Summon/AngelicAllianceArchangel.cs @@ -0,0 +1,168 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class AngelicAllianceArchangel : ModProjectile + { + private int lifeSpan = 900; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Archangel"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 68; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.extraUpdates = 1; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(lifeSpan); + + public override void ReceiveExtraAI(BinaryReader reader) => lifeSpan = reader.ReadInt32(); + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + if (!modPlayer.divineBless || player.dead || !player.active) + { + lifeSpan = 0; + } + + // Initialization and dust + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + for (int i = 0; i < 10; i++) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + } + projectile.localAI[0] += 1f; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } + + // Rotate around the player + double deg = projectile.ai[1]; + double rad = deg * (Math.PI / 180); + double dist = 300; + projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2; + projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2; + projectile.ai[1] += 1f; + + if (!projectile.FinalExtraUpdate()) + return; + + lifeSpan--; + if (lifeSpan <= 0) + { + projectile.alpha += 30; + if (projectile.alpha >= 255) + { + projectile.Kill(); + return; + } + } + + // Give off some light + float lightScalar = Main.rand.NextFloat(0.9f, 1.1f) * Main.essScale; + Lighting.AddLight(projectile.Center, 0.3f * lightScalar, 0.26f * lightScalar, 0.15f * lightScalar); + + // Get a target + NPC target = projectile.Center.MinionHoming(2000f, player, false, true); + + // Shoot the target + if (target != null) + { + Vector2 direction = target.Center - projectile.Center; + direction.Normalize(); + direction *= 6f; + if (direction.X >= 0.25f) + { + projectile.direction = -1; + } + else if (direction.X < -0.25f) + { + projectile.direction = 1; + } + projectile.ai[0]++; + int timerLimit = 120; + if (projectile.ai[0] > timerLimit && projectile.alpha < 50) + { + if (Main.myPlayer == projectile.owner) + { + int type = ModContent.ProjectileType(); + Projectile.NewProjectile(projectile.Center, direction, type, projectile.damage, projectile.knockBack, projectile.owner); + } + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + } + else + { + Vector2 direction = player.Center - projectile.Center; + direction.Normalize(); + direction *= 6f; + if (direction.X >= 0.25f) + { + projectile.direction = -1; + } + else if (direction.X < -0.25f) + { + projectile.direction = 1; + } + } + projectile.spriteDirection = projectile.direction; + + // Frames + projectile.frameCounter++; + if (projectile.frameCounter > 7) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int frameY = frameHeight * projectile.frame; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/AngelicAllianceArchangel.png b/Projectiles/Summon/AngelicAllianceArchangel.png new file mode 100644 index 0000000000..664d3841f7 Binary files /dev/null and b/Projectiles/Summon/AngelicAllianceArchangel.png differ diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 4a33a82d44..103622aa46 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -98,8 +99,8 @@ namespace CalamityMod.Projectiles.Summon projectile.tileCollide = false; int num17 = 100; Vector2 vector3 = projectile.Center; - float num18 = Main.player[projectile.owner].Center.X - vector3.X; - float num19 = Main.player[projectile.owner].Center.Y - vector3.Y; + float num18 = player.Center.X - vector3.X; + float num19 = player.Center.Y - vector3.Y; num19 += (float)Main.rand.Next(-10, 21); num18 += (float)Main.rand.Next(-10, 21); num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); @@ -107,8 +108,8 @@ namespace CalamityMod.Projectiles.Summon float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); float num21 = 18f; - if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && + if (num20 < (float)num17 && player.velocity.Y == 0f && + projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; @@ -119,8 +120,7 @@ namespace CalamityMod.Projectiles.Summon } if (num20 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.position = player.position; projectile.netUpdate = true; } if (num20 < 50f) @@ -148,34 +148,34 @@ namespace CalamityMod.Projectiles.Summon if (projectile.velocity.X < num18) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; if (num16 > 0.05f && projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; } } if (projectile.velocity.X > num18) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; if (num16 > 0.05f && projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; } } if (projectile.velocity.Y < num19) { - projectile.velocity.Y = projectile.velocity.Y + num16; + projectile.velocity.Y += num16; if (num16 > 0.05f && projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + projectile.velocity.Y += num16 * 2f; } } if (projectile.velocity.Y > num19) { - projectile.velocity.Y = projectile.velocity.Y - num16; + projectile.velocity.Y -= num16; if (num16 > 0.05f && projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + projectile.velocity.Y -= num16 * 2f; } } break; @@ -246,6 +246,7 @@ namespace CalamityMod.Projectiles.Summon projectile.active = false; return; } + projectile.MinionAntiClump(); float num535 = projectile.position.X; float num536 = projectile.position.Y; float num537 = 3000f; @@ -253,9 +254,9 @@ namespace CalamityMod.Projectiles.Summon NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) { - float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); - float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + float num539 = ownerMinionAttackTargetNPC2.Center.X; + float num540 = ownerMinionAttackTargetNPC2.Center.Y; + float num541 = Math.Abs(projectile.Center.X - num539) + Math.Abs(projectile.Center.Y - num540); if (num541 < num537) { num537 = num541; @@ -271,9 +272,9 @@ namespace CalamityMod.Projectiles.Summon { if (Main.npc[num542].CanBeChasedBy(projectile, false)) { - float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); - float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + float num543 = Main.npc[num542].Center.X; + float num544 = Main.npc[num542].Center.Y; + float num545 = Math.Abs(projectile.Center.X - num543) + Math.Abs(projectile.Center.Y - num544); if (num545 < num537) { num537 = num545; @@ -325,5 +326,17 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.player[projectile.owner].Calamity().angelicAlliance) + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Main.player[projectile.owner].Calamity().angelicAlliance) + target.AddBuff(ModContent.BuffType(), 300); + } } } diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index a5854c42a5..c52bf43fbb 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -96,17 +97,17 @@ namespace CalamityMod.Projectiles.Summon projectile.tileCollide = false; int num17 = 100; Vector2 vector3 = projectile.Center; - float num18 = Main.player[projectile.owner].Center.X - vector3.X; - float num19 = Main.player[projectile.owner].Center.Y - vector3.Y; + float num18 = player.Center.X - vector3.X; + float num19 = player.Center.Y - vector3.Y; num19 += (float)Main.rand.Next(-10, 21); num18 += (float)Main.rand.Next(-10, 21); - num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); + num18 += (float)(60 * -(float)player.direction); num19 -= 60f; float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); float num21 = 18f; - if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && - projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && + if (num20 < (float)num17 && player.velocity.Y == 0f && + projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; @@ -117,8 +118,7 @@ namespace CalamityMod.Projectiles.Summon } if (num20 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.position = player.position; projectile.netUpdate = true; } if (num20 < 50f) @@ -146,34 +146,34 @@ namespace CalamityMod.Projectiles.Summon if (projectile.velocity.X < num18) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; if (num16 > 0.05f && projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; } } if (projectile.velocity.X > num18) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; if (num16 > 0.05f && projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; } } if (projectile.velocity.Y < num19) { - projectile.velocity.Y = projectile.velocity.Y + num16; + projectile.velocity.Y += num16; if (num16 > 0.05f && projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + projectile.velocity.Y += num16 * 2f; } } if (projectile.velocity.Y > num19) { - projectile.velocity.Y = projectile.velocity.Y - num16; + projectile.velocity.Y -= num16; if (num16 > 0.05f && projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + projectile.velocity.Y -= num16 * 2f; } } break; @@ -244,6 +244,7 @@ namespace CalamityMod.Projectiles.Summon projectile.active = false; return; } + projectile.MinionAntiClump(); float num535 = projectile.position.X; float num536 = projectile.position.Y; float num537 = 3000f; @@ -251,9 +252,9 @@ namespace CalamityMod.Projectiles.Summon NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) { - float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); - float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + float num539 = ownerMinionAttackTargetNPC2.Center.X; + float num540 = ownerMinionAttackTargetNPC2.Center.Y; + float num541 = Math.Abs(projectile.Center.X - num539) + Math.Abs(projectile.Center.Y - num540); if (num541 < num537) { num537 = num541; @@ -269,9 +270,9 @@ namespace CalamityMod.Projectiles.Summon { if (Main.npc[num542].CanBeChasedBy(projectile, false)) { - float num543 = Main.npc[num542].position.X + (float)(Main.npc[num542].width / 2); - float num544 = Main.npc[num542].position.Y + (float)(Main.npc[num542].height / 2); - float num545 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num543) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num544); + float num543 = Main.npc[num542].Center.X; + float num544 = Main.npc[num542].Center.Y; + float num545 = Math.Abs(projectile.Center.X - num543) + Math.Abs(projectile.Center.Y - num544); if (num545 < num537) { num537 = num545; @@ -321,5 +322,17 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.player[projectile.owner].Calamity().angelicAlliance) + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Main.player[projectile.owner].Calamity().angelicAlliance) + target.AddBuff(ModContent.BuffType(), 300); + } } } diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 1ab9ca526e..35577702b1 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -57,13 +57,14 @@ namespace CalamityMod.Projectiles.Summon projectile.active = false; return; } + projectile.MinionAntiClump(); Player projOwner = Main.player[projectile.owner]; float num16 = 0.5f; projectile.tileCollide = false; int num17 = 100; - Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num18 = projOwner.position.X + (float)(projOwner.width / 2) - vector3.X; - float num19 = projOwner.position.Y + (float)(projOwner.height / 2) - vector3.Y; + Vector2 vector3 = projectile.Center; + float num18 = projOwner.Center.X - vector3.X; + float num19 = projOwner.Center.Y - vector3.Y; num19 += (float)Main.rand.Next(-10, 21); num18 += (float)Main.rand.Next(-10, 21); num18 += (float)(60 * -(float)projOwner.direction); @@ -83,8 +84,7 @@ namespace CalamityMod.Projectiles.Summon } if (num20 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.position = projOwner.position; projectile.netUpdate = true; } if (num20 < 50f) @@ -112,46 +112,46 @@ namespace CalamityMod.Projectiles.Summon if (projectile.velocity.X < num18) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; if (num16 > 0.05f && projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; } } if (projectile.velocity.X > num18) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; if (num16 > 0.05f && projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; } } if (projectile.velocity.Y < num19) { - projectile.velocity.Y = projectile.velocity.Y + num16; + projectile.velocity.Y += num16; if (num16 > 0.05f && projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + projectile.velocity.Y += num16 * 2f; } } if (projectile.velocity.Y > num19) { - projectile.velocity.Y = projectile.velocity.Y - num16; + projectile.velocity.Y -= num16; if (num16 > 0.05f && projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + projectile.velocity.Y -= num16 * 2f; } } - if ((double)projectile.velocity.X > 0.25) + if (projectile.velocity.X > 0.25f) { projectile.direction = -1; } - else if ((double)projectile.velocity.X < -0.25) + else if (projectile.velocity.X < -0.25f) { projectile.direction = 1; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } diff --git a/Projectiles/Typeless/AllianceTriangle.cs b/Projectiles/Typeless/AllianceTriangle.cs new file mode 100644 index 0000000000..15547cb5fc --- /dev/null +++ b/Projectiles/Typeless/AllianceTriangle.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class AllianceTriangle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alliance Triangle"); + } + + public override void SetDefaults() + { + projectile.width = 154; + projectile.height = 134; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.alpha = 254; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + Lighting.AddLight(projectile.Center, new Vector3(240, 185, 7) * (3f / 255)); + projectile.Center = player.Center; + + projectile.ai[0]++; + if (projectile.ai[0] <= 5f) + { + projectile.alpha -= 75; + if (projectile.alpha < 0) + projectile.alpha = 0; + } + else + { + projectile.scale *= 1.06f; + projectile.alpha += 10; + } + + if (projectile.alpha >= 255 || player is null || player.dead) + { + projectile.Kill(); + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha <= 0) + return new Color(200, 200, 200, 200); + return null; + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/AllianceTriangle.png b/Projectiles/Typeless/AllianceTriangle.png new file mode 100644 index 0000000000..66f397a1f3 Binary files /dev/null and b/Projectiles/Typeless/AllianceTriangle.png differ diff --git a/Sounds/Custom/AngelicAllianceActivation.cs b/Sounds/Custom/AngelicAllianceActivation.cs new file mode 100644 index 0000000000..2df6ffa472 --- /dev/null +++ b/Sounds/Custom/AngelicAllianceActivation.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AngelicAllianceActivation : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/AngelicAllianceActivation.ogg b/Sounds/Custom/AngelicAllianceActivation.ogg new file mode 100644 index 0000000000..db9575fa65 Binary files /dev/null and b/Sounds/Custom/AngelicAllianceActivation.ogg differ diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 56bb0a45cb..120f2af03a 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -1048,7 +1048,7 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("AnyIceBlock", group); - group = new RecipeGroup(() => "Any Snow Block", new int[] + group = new RecipeGroup(() => "Any Snow Block", new int[] { ItemID.SnowBlock, ModContent.ItemType() @@ -1063,6 +1063,33 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("SiltGroup", group); + group = new RecipeGroup(() => "Any Hallowed Helmet", new int[] + { + ItemID.HallowedHelmet, + ItemID.HallowedHeadgear, + ItemID.HallowedMask/*, + ItemID.HallowedHood, + ItemID.AncientHallowedHelmet, + ItemID.AncientHallowedHeadgear, + ItemID.AncientHallowedMask, + ItemID.AncientHallowedHood*/ + }); + RecipeGroup.RegisterGroup("AnyHallowedHelmet", group); + + /*group = new RecipeGroup(() => "Any Hallowed Platemail", new int[] + { + ItemID.HallowedPlateMail, + ItemID.AncientHallowedPlateMail + }); + RecipeGroup.RegisterGroup("AnyHallowedPlatemail", group); + + group = new RecipeGroup(() => "Any Hallowed Greaves", new int[] + { + ItemID.HallowedGreaves, + ItemID.AncientHallowedGreaves + }); + RecipeGroup.RegisterGroup("AnyHallowedGreaves", group);*/ + group = new RecipeGroup(() => "Any Hardmode Anvil", new int[] { ItemID.MythrilAnvil, @@ -1130,43 +1157,43 @@ namespace CalamityMod group = new RecipeGroup(() => "Any Wings", new int[] { - ItemID.DemonWings, - ItemID.AngelWings, - ItemID.RedsWings, - ItemID.ButterflyWings, - ItemID.FairyWings, - ItemID.HarpyWings, - ItemID.BoneWings, - ItemID.FlameWings, - ItemID.FrozenWings, - ItemID.GhostWings, - ItemID.SteampunkWings, - ItemID.LeafWings, - ItemID.BatWings, - ItemID.BeeWings, - ItemID.DTownsWings, - ItemID.WillsWings, - ItemID.CrownosWings, - ItemID.CenxsWings, - ItemID.TatteredFairyWings, - ItemID.SpookyWings, - ItemID.Hoverboard, - ItemID.FestiveWings, - ItemID.BeetleWings, - ItemID.FinWings, - ItemID.FishronWings, - ItemID.MothronWings, - ItemID.WingsSolar, - ItemID.WingsVortex, - ItemID.WingsNebula, - ItemID.WingsStardust, - ItemID.Yoraiz0rWings, - ItemID.JimsWings, - ItemID.SkiphsWings, - ItemID.LokisWings, - ItemID.BetsyWings, - ItemID.ArkhalisWings, - ItemID.LeinforsWings, + ItemID.DemonWings, + ItemID.AngelWings, + ItemID.RedsWings, + ItemID.ButterflyWings, + ItemID.FairyWings, + ItemID.HarpyWings, + ItemID.BoneWings, + ItemID.FlameWings, + ItemID.FrozenWings, + ItemID.GhostWings, + ItemID.SteampunkWings, + ItemID.LeafWings, + ItemID.BatWings, + ItemID.BeeWings, + ItemID.DTownsWings, + ItemID.WillsWings, + ItemID.CrownosWings, + ItemID.CenxsWings, + ItemID.TatteredFairyWings, + ItemID.SpookyWings, + ItemID.Hoverboard, + ItemID.FestiveWings, + ItemID.BeetleWings, + ItemID.FinWings, + ItemID.FishronWings, + ItemID.MothronWings, + ItemID.WingsSolar, + ItemID.WingsVortex, + ItemID.WingsNebula, + ItemID.WingsStardust, + ItemID.Yoraiz0rWings, + ItemID.JimsWings, + ItemID.SkiphsWings, + ItemID.LokisWings, + ItemID.BetsyWings, + ItemID.ArkhalisWings, + ItemID.LeinforsWings, ItemID.BejeweledValkyrieWing, /* ItemID.GhostarsWings, @@ -1177,14 +1204,14 @@ namespace CalamityMod ItemID.RainbowWings, ItemID.LongRainbowTrailWings, */ - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() }); RecipeGroup.RegisterGroup("WingsGroup", group); } diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index f095b873b8..697e5f7931 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -4,8 +4,10 @@ using System; using System.Reflection; using System.Text; using Terraria; +using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod { @@ -437,5 +439,29 @@ namespace CalamityMod spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } + + public static void DrawAuroras(Player player, float auroraCount, float opacity, Color color) + { + float time = Main.GlobalTime % 3f / 3f; + Texture2D auroraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AuroraTexture"); + for (int i = 0; i < auroraCount; i++) + { + float incrementOffsetAngle = MathHelper.TwoPi * i / auroraCount; + float xOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f) * 20f; + float yOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f + MathHelper.ToRadians(60f)) * 6f; + float rotation = (float)Math.Sin(incrementOffsetAngle) * MathHelper.Pi / 12f; + Vector2 offset = new Vector2(xOffset, yOffset - 14f); + DrawData drawData = new DrawData(auroraTexture, + player.Top + offset - Main.screenPosition, + null, + color * opacity, + rotation + MathHelper.PiOver2, + auroraTexture.Size() * 0.5f, + 0.135f, + SpriteEffects.None, + 1); + Main.playerDrawData.Add(drawData); + } + } } }