1 - Windy Day music IL edit that doesn't work for some fucking reason.

2 - Desert Scourge and Destroyer forward projectile spread velocities no longer scale with their velocity.
This commit is contained in:
mountaindrew10 committed 2022-06-03 23:37:43 -05:00
1 parent 405bebdb9b
commit 8b98192a7c
4 files changed
+22 -20

No files matched your search

+2
View File
@@ -102,6 +102,7 @@ namespace CalamityMod.ILEditing
// IL.Terraria.NPC.VanillaHitEffect += RemoveLavaDropsFromExpertLavaSlimes;
IL.Terraria.Player.IsTileTypeInInteractionRange += IncreasePylonInteractionRange;
IL.Terraria.Projectile.CanExplodeTile += MakeMeteoriteExplodable;
IL.Terraria.Main.UpdateWindyDayState += MakeWindyDayMusicPlayLessOften;
IL.Terraria.Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife;
IL.Terraria.WorldGen.AttemptFossilShattering += PreventFossilShattering;
IL.Terraria.Projectile.Damage += MakeTagDamageMultiplicative;
@@ -189,6 +190,7 @@ namespace CalamityMod.ILEditing
//IL.Terraria.NPC.VanillaHitEffect -= RemoveLavaDropsFromExpertLavaSlimes;
IL.Terraria.Player.IsTileTypeInInteractionRange -= IncreasePylonInteractionRange;
IL.Terraria.Projectile.CanExplodeTile -= MakeMeteoriteExplodable;
IL.Terraria.Main.UpdateWindyDayState -= MakeWindyDayMusicPlayLessOften;
IL.Terraria.Main.UpdateTime_StartNight -= BloodMoonsRequire200MaxLife;
IL.Terraria.WorldGen.AttemptFossilShattering -= PreventFossilShattering;
IL.Terraria.Projectile.Damage -= MakeTagDamageMultiplicative;
@@ -193,6 +193,21 @@ namespace CalamityMod.ILEditing
}
#endregion
#region Make Windy Day Music Play Less Often
private static void MakeWindyDayMusicPlayLessOften(ILContext il)
{
// Make windy day theme only play when the wind speed is over 0.6f instead of 0.4f.
var cursor = new ILCursor(il);
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchStsfld<Main>("_maxWind"))) // The wind speed check.
{
LogFailure("Make Windy Day Music Play Less Often", "Could not locate the _maxWind variable.");
return;
}
cursor.Remove();
cursor.Emit(OpCodes.Ldc_R4, 0.6f); // Change to 0.6f.
}
#endregion Make Windy Day Music Play Less Often
#region Change Blood Moon Max HP Requirements
private static void BloodMoonsRequire200MaxLife(ILContext il)
{
+1 -1
View File
@@ -218,7 +218,7 @@ namespace CalamityMod.NPCs.DesertScourge
if (NPC.Calamity().newAI[2] % 30f == 0f)
{
SoundEngine.PlaySound(SoundID.Item21, NPC.Center);
float velocity = NPC.velocity.Length() + 1f;
float velocity = malice ? 12f : death ? 10f : 9f;
int type = ModContent.ProjectileType<SandBlast>();
int damage = NPC.GetProjectileDamage(type);
Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * velocity;
+4 -19
View File
@@ -173,32 +173,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
{
if (calamityGlobalNPC.newAI[0] % 30f == 0f)
{
Vector2 vectorCenter = npc.Center;
float num742 = npc.velocity.Length() * 0.33f + 1f;
float num743 = player.position.X + player.width * 0.5f - vectorCenter.X;
float num744 = player.position.Y + player.height * 0.5f - vectorCenter.Y;
float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744);
num745 = num742 / num745;
num743 *= num745;
num744 *= num745;
vectorCenter.X += num743 * 5f;
vectorCenter.Y += num744 * 5f;
float velocity = malice ? 6f : death ? 5.333f : 5f;
int type = ProjectileID.DeathLaser;
int damage = npc.GetProjectileDamage(type);
Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * velocity;
int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? 7 : 4;
int spread = 54;
float rotation = MathHelper.ToRadians(spread);
float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744);
double startAngle = Math.Atan2(num743, num744) - rotation / 2;
double deltaAngle = rotation / numProj;
double offsetAngle;
for (int i = 0; i < numProj; i++)
{
offsetAngle = startAngle + deltaAngle * i;
int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 1f, 0f);
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f);
Main.projectile[proj].timeLeft = 900;
}
}