1 - Avalanche and Butcher's Chainsaw balancing

2 - Fixed Squire armor losing 5% melee damage and then never gaining it back
3 - UFO mount no longer dismounts in water
This commit is contained in:
CongratsIsTrash committed 2024-09-13 12:31:39 -04:00
1 parent 12052f9b23
commit e1a9d30f8d
8 files changed
+97 -89

No files matched your search

+3 -3
View File
@@ -171,9 +171,6 @@ namespace CalamityMod.Balancing
// 50% resist to Aftershock's rocks.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<AftershockRock>()))));
// 50% resist to Avalanche's Ice Bombs and shards.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<IceBombFriendly>(), ProjectileType<FrostShardFriendly>()))));
// 50% resist to Dormant Brimseeker.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<DormantBrimseekerBab>()))));
@@ -183,6 +180,9 @@ namespace CalamityMod.Balancing
// 30% resist to Meowthrower.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<MeowFire>()))));
// 25% resist to Avalanche's Ice Bombs and shards.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<IceBombFriendly>(), ProjectileType<FrostShardFriendly>()))));
// 25% resist to SHPC.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<SHPExplosion>()))));
+1
View File
@@ -193,6 +193,7 @@ namespace CalamityMod.ILEditing
IL_Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife;
IL_WorldGen.AttemptFossilShattering += PreventFossilShattering;
On_Player.GetPickaxeDamage += RemoveHellforgePickaxeRequirement;
IL_Player.Update += PreventUFODismountInWater;
On_Player.GetAnglerReward += ImproveAnglerRewards;
On_Player.ItemCheck_CheckCanUse += RemoveCelestialSigilUseLock;
@@ -276,6 +276,37 @@ namespace CalamityMod.ILEditing
// TODO -- Finish this
#endregion Fix Chlorophyte Crystal Attacking Where it Shouldn't
#region Prevent UFO Mount from Dismounting in Water
private static void PreventUFODismountInWater(ILContext il)
{
// Prevent the Cosmic Car Key's UFO mount from dismounting when the player is in water.
var cursor = new ILCursor(il);
// Unfortunately, the code responsible for this is 4000 lines into Player.Update, meaning that reaching it is far from simple.
// The following method was the easiest way I could find to reach it:
// Move to the third call of Mount.Dismount.
for (int i = 0; i < 3; i++)
{
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCallvirt<Mount>("Dismount")))
{
LogFailure("Prevent UFO Dismounting in Water", "Could not reach the Dismount instruction.");
return;
}
}
// Move the cursor backwards to place it right after the instruction which loads Main.myPlayer onto the stack.
if (!cursor.TryGotoPrev(MoveType.After, i => i.MatchLdsfld<Main>("myPlayer")))
{
LogFailure("Prevent UFO Dismounting in Water", "Could not locate the myPlayer check.");
return;
}
// Remove the instruction and replace it with the integer limit. The next instruction checks if this value is equal to Player.whoAmI.
// Player.whoAmI will never be the integer limit, so the check will always fail and the UFO will not dismount.
cursor.EmitPop();
cursor.Emit(OpCodes.Ldc_I4, int.MaxValue);
}
#endregion Prevent UFO Mount from Dismounting in Water
#region Color Blighted Gel
private static void ColorBlightedGel(Terraria.GameContent.ItemDropRules.On_CommonCode.orig_ModifyItemDropFromNPC orig, NPC npc, int itemIndex)
{
-1
View File
@@ -1111,7 +1111,6 @@ namespace CalamityMod.Items
break;
case ItemID.SquirePlating:
player.GetDamage<SummonDamageClass>() -= 0.05f;
player.GetDamage<MeleeDamageClass>() -= 0.05f;
break;
case ItemID.SquireGreaves:
player.GetDamage<SummonDamageClass>() -= 0.1f;
+1 -1
View File
@@ -1147,7 +1147,7 @@ namespace CalamityMod.Items
if (item.type == ItemID.SquireGreatHelm)
EditTooltipByNum(0, (line) => line.Text = "Increases your max number of sentries by 1 and grants +2 HP/s life regen");
if (item.type == ItemID.SquirePlating)
EditTooltipByNum(0, (line) => line.Text = "10% increased minion and melee damage");
EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and 15% increased melee damage");
if (item.type == ItemID.SquireGreaves)
EditTooltipByNum(0, (line) => line.Text = "5% increased minion damage and melee critical strike chance\n" +
"15% increased movement speed");
+1 -1
View File
@@ -323,7 +323,7 @@ namespace CalamityMod.Items
{ ItemID.BloodLustCluster, Do(AxePower(100), UseTimeExact(13), TileBoostExact(+0)) },
{ ItemID.BonePickaxe, Do(PickPower(55), UseTimeExact(6)) },
{ ItemID.BorealWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) },
{ ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0), DamageExact(177)) },
{ ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0), DamageExact(126)) },
{ ItemID.CactusPickaxe, Do(PickPower(34), UseTimeExact(9)) },
{ ItemID.CnadyCanePickaxe, Do(PickPower(55), UseTimeExact(9), TileBoostExact(+1)) }, // Candy Cane Pickaxe
{ ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, AxePower(120), UseTimeExact(3), TileBoostExact(+0), DamageExact(112)) },
+9 -32
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 64;
Item.height = 64;
Item.damage = 100;
Item.damage = 75;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 35;
Item.useTime = 35;
@@ -29,39 +29,16 @@ namespace CalamityMod.Items.Weapons.Melee
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
var source = player.GetSource_ItemUse(Item);
int totalProjectiles = 4;
float radians = MathHelper.TwoPi / totalProjectiles;
int type = ModContent.ProjectileType<IceBombFriendly>();
int bombDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
float velocity = 4f;
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
for (int k = 0; k < totalProjectiles; k++)
if (CalamityUtils.CountProjectiles(type) < 16)
{
Vector2 projRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, hit.Knockback * 0.5f, Main.myPlayer);
}
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
var source = player.GetSource_ItemUse(Item);
int totalProjectiles = 4;
float radians = MathHelper.TwoPi / totalProjectiles;
int type = ModContent.ProjectileType<IceBombFriendly>();
int bombDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
float velocity = 4f;
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 projRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, 0f, Main.myPlayer);
var source = player.GetSource_ItemUse(Item);
int bombDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
for (int k = 0; k < 4; k++)
{
// ai0: projectile timer. ai1: target index. ai2: rotation offset based on ice bomb number.
Projectile.NewProjectile(source, target.Center, Vector2.Zero, type, bombDamage, hit.Knockback * 0.5f, Main.myPlayer, 0f, target.whoAmI, k);
}
}
}
+51 -51
View File
@@ -2,6 +2,7 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Projectiles.Rogue;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -13,6 +14,8 @@ namespace CalamityMod.Projectiles.Melee
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/Boss/IceBomb";
public ref float Timer => ref Projectile.ai[0];
public const float FormTime = 60f;
public override void SetDefaults()
{
@@ -22,16 +25,28 @@ namespace CalamityMod.Projectiles.Melee
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 1;
Projectile.timeLeft = 180;
Projectile.timeLeft = 120;
Projectile.tileCollide = false;
}
public override bool? CanDamage() => Projectile.ai[0] >= 120f;
public override bool? CanDamage() => false;
public override void AI()
{
Projectile.velocity *= 0.98f;
NPC npc = Main.npc[(int)Projectile.ai[1]];
// Rotate around the hit enemy
if (!npc.active)
Projectile.Kill();
else
{
Vector2 centerOffset = new Vector2((npc.height < npc.width ? npc.height : npc.width) * 0.7f, 0f);
// Enforce a minimum offset so that it doesn't look weird on small enemies
centerOffset.X = MathHelper.Max(centerOffset.X, 45f);
Projectile.Center = npc.Center + centerOffset.RotatedBy((MathHelper.Pi / 30f * Timer) + (MathHelper.PiOver2 * Projectile.ai[2]));
}
// Constantly pulse in size and transparency
if (Projectile.localAI[0] == 0f)
{
Projectile.scale += 0.01f;
@@ -53,67 +68,48 @@ namespace CalamityMod.Projectiles.Melee
}
}
if (Projectile.ai[0] < 120f)
// Once out for long enough, materialize
Timer++;
if (Timer == FormTime)
{
Projectile.ai[0] += 1f;
if (Projectile.ai[0] == 120f)
for (int i = 0; i < 8; i++)
{
for (int i = 0; i < 8; i++)
Dust icyDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f);
icyDust.velocity *= 3f;
if (Main.rand.NextBool())
{
int icyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f);
Main.dust[icyDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[icyDust].scale = 0.5f;
Main.dust[icyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
icyDust.scale = 0.5f;
icyDust.fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
for (int j = 0; j < 14; j++)
{
int icyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 3f);
Main.dust[icyDust2].noGravity = true;
Main.dust[icyDust2].velocity *= 5f;
icyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f);
Main.dust[icyDust2].velocity *= 2f;
}
Projectile.scale = 1f;
Projectile.ExpandHitboxBy((int)(30f * Projectile.scale));
SoundEngine.PlaySound(SoundID.Item30, Projectile.Center);
}
for (int j = 0; j < 14; j++)
{
Dust icyDust2 = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 3f);
icyDust2.noGravity = true;
icyDust2.velocity *= 5f;
icyDust2 = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.IceRod, 0f, 0f, 100, default, 2f);
icyDust2.velocity *= 2f;
}
Projectile.scale = 1f;
Projectile.ExpandHitboxBy((int)(30f * Projectile.scale));
SoundEngine.PlaySound(SoundID.Item30, Projectile.Center);
}
}
public override Color? GetAlpha(Color lightColor)
{
return Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => Main.dayTime ? new Color(50, 50, 255, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha);
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
float spread = 90f * 0.0174f;
double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
if (Projectile.owner == Main.myPlayer)
{
for (i = 0; i < 2; i++)
for (int i = 0; i < 4; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<FrostShardFriendly>(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f);
if (projectile1.WithinBounds(Main.maxProjectiles))
{
Main.projectile[projectile1].DamageType = DamageClass.Melee;
Main.projectile[projectile1].penetrate = 2;
}
int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<FrostShardFriendly>(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f);
if (projectile2.WithinBounds(Main.maxProjectiles))
{
Main.projectile[projectile2].DamageType = DamageClass.Melee;
Main.projectile[projectile2].penetrate = 2;
}
Vector2 shardVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(2.25f, 4.5f);
int iceShard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType<FrostShardFriendly>(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f);
if (iceShard.WithinBounds(Main.maxProjectiles))
Main.projectile[iceShard].DamageType = DamageClass.Melee;
}
}
@@ -121,9 +117,13 @@ namespace CalamityMod.Projectiles.Melee
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.IceRod, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<GlacialState>(), 30);
public override bool PreDraw(ref Color lightColor)
{
target.AddBuff(ModContent.BuffType<GlacialState>(), 30);
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None);
return false;
}
}
}