Merge: Shield of the Ocean

This commit is contained in:
Cameron Ewell authored and GitHub committed 2025-03-11 16:24:15 -04:00
commit 6d0bc62820
11 files changed
+203 -40

No files matched your search

+12 -3
View File
@@ -915,6 +915,9 @@ namespace CalamityMod.CalPlayer
public bool auricSArtifact = false;
public bool pSoulArtifact = false;
public bool giantPearl = false;
public bool shieldOfTheOcean = false;
public int shieldOfTheOceanParry = 0;
public bool shieldOfTheOceanEmpoweredParry = false;
public bool normalityRelocator = false;
public bool flameLickedShell = false;
public int flameLickedShellParry = 0;
@@ -2215,9 +2218,6 @@ namespace CalamityMod.CalPlayer
darkSunRing = false;
crawCarapace = false;
baroclaw = false;
gShell = false;
lAmbergris = false;
tortShell = false;
voidOfCalamity = false;
voidOfExtinction = false;
eArtifact = false;
@@ -2225,6 +2225,7 @@ namespace CalamityMod.CalPlayer
auricSArtifact = false;
pSoulArtifact = false;
giantPearl = false;
shieldOfTheOcean = false;
normalityRelocator = false;
flameLickedShell = false;
Pauldron = false;
@@ -3143,6 +3144,8 @@ namespace CalamityMod.CalPlayer
tracersDust = false;
elysianWingsDust = false;
GemTechState.OnDeathEffects();
shieldOfTheOceanParry = 0;
shieldOfTheOceanEmpoweredParry = false;
blazingCoreParry = 0;
blazingCoreEmpoweredParry = false;
blazingCoreSuccessfulParry = 0;
@@ -3454,6 +3457,12 @@ namespace CalamityMod.CalPlayer
flameLickedShellParry = FlameLickedShell.flameLickedParry;
}
}
else if (shieldOfTheOcean && shieldOfTheOceanParry == 0)
{
GeneralScreenShakePower = 2f;
SoundEngine.PlaySound(ShieldoftheOcean.TriggerSound, Player.Center);
shieldOfTheOceanParry = ShieldoftheOcean.ParryTime;
}
}
// Trigger for pressing the God Slayer dash key
+17
View File
@@ -1878,6 +1878,23 @@ namespace CalamityMod.CalPlayer
FlameLickedShell.handleParry(Player);
}
}
else if (shieldOfTheOceanParry >= 12)
{
if (!Player.HasCooldown(ParryCooldown.ID))
{
// Shield of the Ocean is a parry. It uses vanilla parry iframes and benefits from Cross Necklace.
int shieldParryIFrames = Player.ComputeParryIFrames();
Player.GiveUniversalIFrames(shieldParryIFrames, true);
shieldOfTheOceanEmpoweredParry = true;
modifiers.FinalDamage *= 0.4f; // 60% DR
modifiers.DisableSound();
}
SoundEngine.PlaySound(Main.zenithWorld ? ShieldoftheOcean.ParrySoundGFB : ShieldoftheOcean.ParrySound, Player.Center);
Player.AddCooldown(ParryCooldown.ID, 1200, false, "shieldoftheocean");
ShieldoftheOcean.ActivateParry(Player);
}
}
private void ModifyHurtInfo_Calamity(ref Player.HurtInfo info)
+7
View File
@@ -2026,6 +2026,13 @@ namespace CalamityMod.CalPlayer
{
FlameLickedShell.HandleParryCountdown(Player);
}
if (shieldOfTheOceanParry > 0)
{
if (shieldOfTheOcean)
ShieldoftheOcean.HandleParryCountdown(Player);
else
shieldOfTheOceanParry--;
}
if (!flameLickedShell && flameLickedShellParry > 0)
flameLickedShellParry--;
+12 -4
View File
@@ -12,11 +12,12 @@ namespace CalamityMod.CalPlayer.DrawLayers
public enum EncasementType
{
BlazingCore,
FlameLickedShell
FlameLickedShell,
ShieldoftheOcean
}
public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.FrontAccFront); //me when the player layer is called front acc front :skull:
public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.blazingCore ? EncasementType.BlazingCore : EncasementType.FlameLickedShell;
public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.blazingCore ? EncasementType.BlazingCore : modPlayer.flameLickedShell ? EncasementType.FlameLickedShell : EncasementType.ShieldoftheOcean;
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo)
{
@@ -28,6 +29,7 @@ namespace CalamityMod.CalPlayer.DrawLayers
{
EncasementType.BlazingCore => visible && modPlayer.blazingCoreParry > 0,
EncasementType.FlameLickedShell => visible && modPlayer.flameLickedShellParry > 0,
EncasementType.ShieldoftheOcean => visible && modPlayer.shieldOfTheOceanParry > 0,
_ => false
};
return visible;
@@ -56,6 +58,12 @@ namespace CalamityMod.CalPlayer.DrawLayers
defaultOpacity = 0.875f;
scale = 1.2f;
break;
case EncasementType.ShieldoftheOcean:
tex += "OceanShieldBubble";
currentParry = calPlayer.shieldOfTheOceanParry;
defaultOpacity = 0.7f;
scale = 1.3f;
break;
default: //should never be this option
tex += "BlazingCoreCrystal";
currentParry = 0;
@@ -70,8 +78,8 @@ namespace CalamityMod.CalPlayer.DrawLayers
drawPos.X += 15f;
int maxParry = 30; //all parries use thirty seconds as a max at this point in time, if this changes, this too should change
float colorIntensity = currentParry >= 18 ? defaultOpacity : 1f - Utils.GetLerpValue(maxParry, 0f, currentParry, true);
int maxParry = 30; // All parries currently last 30 frames. If this changes, this too should change.
float colorIntensity = currentParry >= 12 ? defaultOpacity : 1f - Utils.GetLerpValue(maxParry, 0f, currentParry, true);
SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
drawInfo.DrawDataCache.Add(new DrawData(texture, drawPos, null, Color.White * colorIntensity, 0f, texture.Size() * 0.75f, scale, spriteEffects, 0));
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+7
View File
@@ -38,6 +38,13 @@ namespace CalamityMod.Cooldowns
cooldownColorStart = Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - (instance?.Completion ?? 0));
cooldownColorEnd = Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - (instance?.Completion ?? 0));
break;*/
case "shieldoftheocean":
// skinTexture = "ShieldOfTheOceanParry";
skinTexture = "ParryCooldown";
outlineColor = Color.White;
cooldownColorStart = new Color(233, 111, 165);
cooldownColorEnd = new Color(105, 139, 148);
break;
default:
skinTexture = "ParryCooldown";
outlineColor = Color.White;
+101 -22
View File
@@ -1,6 +1,10 @@
using CalamityMod.Items.Armor.Victide;
using CalamityMod.Items.Materials;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
@@ -9,40 +13,115 @@ namespace CalamityMod.Items.Accessories
public class ShieldoftheOcean : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static readonly SoundStyle TriggerSound = new("CalamityMod/Sounds/Custom/MossMine");
public static readonly SoundStyle ParrySound = new("CalamityMod/Sounds/Custom/BubbleCracklePop");
public static readonly SoundStyle ParrySoundGFB = new("CalamityMod/Sounds/Custom/GFB/OceanShieldParryGFB");
public const int ParryTime = 30;
// These damage values scale in Expert and Master.
public const int ShoveFallBaseDamage = 80;
public const int ImmuneToShoveBaseDamage = 200;
public override void SetDefaults()
{
Item.width = 24;
Item.height = 28;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.rare = ItemRarityID.Green;
Item.defense = 2;
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
Item.rare = ItemRarityID.Orange;
Item.accessory = true;
}
public override void ModifyTooltips(List<TooltipLine> list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey);
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir))
player.Calamity().shieldOfTheOcean = true;
}
public static void HandleParryCountdown(Player player)
{
player.Calamity().shieldOfTheOceanParry--;
if (player.Calamity().shieldOfTheOceanParry > 0)
{
player.statDefense += 5;
}
// Accessory update comes before set bonus for some reason, so this has to be done
if ((player.armor[0].type == ModContent.ItemType<VictideHeadMagic>() || player.armor[0].type == ModContent.ItemType<VictideHeadSummon>() ||
player.armor[0].type == ModContent.ItemType<VictideHeadMelee>() || player.armor[0].type == ModContent.ItemType<VictideHeadRanged>() ||
player.armor[0].type == ModContent.ItemType<VictideHeadRogue>()) &&
player.armor[1].type == ModContent.ItemType<VictideBreastplate>() && player.armor[2].type == ModContent.ItemType<VictideGreaves>())
{
player.moveSpeed += 0.1f;
player.lifeRegen += 2;
player.controlJump = false;
player.controlDown = false;
player.controlLeft = false;
player.controlRight = false;
player.controlUp = false;
player.controlUseItem = false;
player.controlUseTile = false;
player.controlThrow = false;
player.gravDir = 1f;
player.velocity = Vector2.Zero;
player.velocity.Y = -0.1f; // Ensure Y velocity is not 0, otherwise the flight meter gets reset.
player.RemoveAllGrapplingHooks();
}
}
public override void AddRecipes()
// GFB changes:
// Different sound when parrying.
// Larger radius for pushing away enemies.
// Enemies are pushed much faster.
// Damage is multiplied by 10.
public static void ActivateParry(Player player)
{
CreateRecipe().
AddIngredient<SeaRemains>(5).
AddIngredient(ItemID.Starfish, 5).
AddTile(TileID.Anvils).
Register();
bool empowered = player.Calamity().shieldOfTheOceanEmpoweredParry;
// Search for every NPC within a certain radius of the player.
foreach (NPC npc in Main.ActiveNPCs)
{
if (Vector2.Distance(player.Center, npc.Center) > (Main.zenithWorld ? 720f : 240f))
continue;
// Inflict Riptide on empowered parries.
if (empowered)
npc.AddBuff(ModContent.BuffType<RiptideDebuff>(), 300);
// If the NPC can be moved, violently shove them away. Make them susceptible to fall damage on empowered parries.
// Otherwise, simply deal a large amount of damage to them if empowered.
if (npc.CanBeMoved(true))
{
// The NPC has to actually have its velocity changed, because TileCollisionHarmNPC only changes its position. Not confusing at all!
Vector2 shoveVelocity = Utils.DirectionTo(player.Center, npc.Center) * (Main.zenithWorld ? 35f : 12.5f) - Vector2.UnitY * 6f;
npc.MoveNPC(Vector2.Normalize(shoveVelocity), shoveVelocity.Length(), true);
int scaledFallDamage = ShoveFallBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1);
if (empowered)
npc.FlungNPC().ApplyCollisionDamage(npc, player, scaledFallDamage, shoveVelocity * 0.5f, 5f, true);
else
npc.FlungNPC().ApplyForcedVelocity(npc, player, shoveVelocity * 0.5f, true);
for (int i = -1; i <= 1; i++)
{
Vector2 particleVel = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.Pi / 6f * i) * 7.5f;
WaterFlavoredParticle pushHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue);
GeneralParticleHandler.SpawnParticle(pushHit);
}
}
else
{
if (empowered)
{
int scaledImmuneDamage = ImmuneToShoveBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1);
Projectile.NewProjectile(player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), scaledImmuneDamage, 0f, player.whoAmI, npc.whoAmI);
}
float randOffset = Main.rand.NextFloat(MathHelper.TwoPi);
for (int i = 0; i < 6; i++)
{
Vector2 particleVel = Vector2.UnitX.RotatedBy(MathHelper.Pi / 3f * i + randOffset) * 7.5f;
WaterFlavoredParticle bigHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue);
GeneralParticleHandler.SpawnParticle(bigHit);
}
}
}
player.Calamity().shieldOfTheOceanEmpoweredParry = false;
for (int b = 0; b < 20; b++)
{
Vector2 waterVel = Vector2.UnitX.RotatedBy(MathHelper.TwoPi / 15f * b) * Main.rand.NextFloat(12f, 24f);
WaterFoamParticle sorryToBurstYourBubble = new(player.Center, waterVel, 15, 0.6f, Color.Blue);
GeneralParticleHandler.SpawnParticle(sorryToBurstYourBubble);
}
}
}
}
@@ -1560,8 +1560,12 @@ ShieldoftheOcean: {
DisplayName: Shield of the Ocean
Tooltip:
'''
Increased defense by 5 when submerged in liquid
10% increased movement speed and +1 HP/s life regen while wearing Victide armor
Pressing [KEY] will activate a parry, encasing you in a bubble
Being hit shortly after encasement will pop the bubble, granting 60% DR for that hit
Upon popping, nearby enemies are violently launched away from you, and will be damaged if they collide with tiles
Enemies which cannot be launched instead directly take large damage
After popping, the damage reducing effect goes on a 20 second cooldown
Damage parried whilst on cooldown will not be reduced, and will not deal collision damage to launched enemies
'''
}
+41 -9
View File
@@ -25,6 +25,10 @@ namespace CalamityMod.NPCs
private float terminalVelocityForFullFallDamage = 0;
private bool CheckTiles = false;
private Vector2 ForcedVel = Vector2.Zero;
/// <summary>
/// Set to true if you only want the npc to receive forced velocity and not receive damage.
/// </summary>
private bool ForceVelocityOnly = false;
private bool hitVoid = false;
private Player attacker;
private int packetTimer = 0;
@@ -43,7 +47,7 @@ namespace CalamityMod.NPCs
}
}
public bool FallDamageSusceptible => PotentialEnergyDamage > 0;
public bool FallDamageSusceptible => PotentialEnergyDamage > 0 || ForceVelocityOnly;
public override bool InstancePerEntity => true;
@@ -67,7 +71,7 @@ namespace CalamityMod.NPCs
}
/// <summary>
/// Sets up a NPC to recieve fall damage when they hit the ground.
/// Sets up a NPC to recieve forced velocity in a direction and receive fall damage when they hit the ground.
/// </summary>
/// <param name="npc">The npc to apply fall damage to</param>
/// <param name="player">The player applying fall damage to the npc</param>
@@ -89,6 +93,27 @@ namespace CalamityMod.NPCs
attacker = player;
}
/// <summary>
/// Sets up a NPC to recieve forced velocity in a direction.
/// </summary>
/// <param name="npc">The npc to apply velocity to</param>
/// <param name="player">The player applying velocity to the npc</param>
/// <param name="forcedVel">The velocity being applied to the npc</param>
/// <param name="checkTiles">Will check for tiles in the collision instead of velocity</param>
public void ApplyForcedVelocity(NPC npc, Player player, Vector2 forcedVel, bool checkTiles = false)
{
// NPCs that don't collide with tiles simply don't get velocity, lol.
if (npc.noTileCollide)
return;
OldVelocity = npc.velocity;
OlderVelocity = npc.velocity;
CheckTiles = checkTiles;
ForcedVel = forcedVel;
attacker = player;
ForceVelocityOnly = true;
}
public override void PostAI(NPC npc)
{
if (FallDamageSusceptible)
@@ -99,15 +124,18 @@ namespace CalamityMod.NPCs
if (Collision.SolidCollision(npc.Center, (int)(npc.width * 0.5f), (int)(npc.height * 0.5f)) || !WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40))
{
int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f));
Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI);
wallImpact.DamageType = DamageClass.Melee;
if (!ForceVelocityOnly)
{
int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f));
Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI);
wallImpact.DamageType = DamageClass.Melee;
}
PotentialEnergyDamage = 0;
ForceVelocityOnly = false;
hitVoid = false;
}
oldVelocity = npc.velocity.Length();
npc.Center += ForcedVel;
ForcedVel *= 0.995f;
if (packetTimer % 30 == 0)
@@ -138,11 +166,15 @@ namespace CalamityMod.NPCs
//If the npc hit a tile/Came to a stop after falling
if (newVerticalVelocity == 0 && oldVerticalVelocity > 0) //Collision.SolidCollision(npc.Center, npc.width, npc.height))
{
int impactDamage = (int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f));
Projectile impact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), impactDamage, 0f, attacker.whoAmI, npc.whoAmI);
impact.DamageType = DamageClass.Melee;
if (!ForceVelocityOnly)
{
int impactDamage = (int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f));
Projectile impact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), impactDamage, 0f, attacker.whoAmI, npc.whoAmI);
impact.DamageType = DamageClass.Melee;
}
PotentialEnergyDamage = 0;
ForceVelocityOnly = false;
}
OlderVelocity = OldVelocity;
Binary file not shown.
Binary file not shown.