Sulph Sea Reformation 2.0 (Also see description)

Changed IL Editing changes to not use a constant index set, fixed the mechworm UUID implementation, added a wulfrum droid summon projectile clone, and added some items/chests alongside the new worldgen changes.
This commit is contained in:
DominicKarma42 committed 2020-04-12 03:13:32 -05:00
1 parent b333d832eb
commit eabfa51179
103 files changed
+3021 -557

No files matched your search

-1
View File
@@ -3,7 +3,6 @@ using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
namespace CalamityMod.Projectiles.Ranged
+1 -1
View File
@@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.ai[1] = 0f;
projectile.netUpdate = true;
}
int chase = (int)projectile.ai[0];
int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]);
float num1064;
float scaleFactor17;
float scaleFactor18;
+1 -1
View File
@@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.ai[1] = 0f;
projectile.netUpdate = true;
}
int chase = (int)projectile.ai[0];
int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]);
float num1064;
float scaleFactor17;
float scaleFactor18;
+80
View File
@@ -0,0 +1,80 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class RustShrapnel : ModProjectile
{
public bool HitTile = false;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Shrapnel");
Main.projFrames[projectile.type] = 3;
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 12;
projectile.height = 14;
projectile.friendly = true;
projectile.penetrate = 1;
projectile.timeLeft = 180;
projectile.tileCollide = true;
projectile.minionSlots = 0f;
projectile.minion = true;
}
public override void AI()
{
projectile.ai[0] += 1f;
if (HitTile)
{
projectile.velocity.X = 0f;
projectile.rotation = MathHelper.Pi;
}
else
{
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
}
projectile.velocity.Y += 0.4f;
projectile.velocity.X *= 0.96f;
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
HitTile = true;
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 180);
projectile.Kill();
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 180);
projectile.Kill();
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 15; i++)
{
Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid);
dust.velocity = Vector2.One.RotatedBy(i / 15f * MathHelper.TwoPi) * 3f * (float)Math.Cos(i / 15f * MathHelper.TwoPi);
dust.scale = 2.5f;
dust.noGravity = true;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

+150
View File
@@ -0,0 +1,150 @@
using CalamityMod.Buffs.Summon;
using CalamityMod.Buffs.Cooldowns;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class RustyDrone : ModProjectile
{
public const float PlayerHomingInertia = 32f;
public const float PlayerHomingSpeed = 11f;
public const float NPCHomingInertia = 20f;
public const float NPCHomingSpeed = 14f;
public const float AttackRate = 110f;
public const float DistanceToCheck = 750f;
public const int ExplosionShrapnelBaseDamage = 16; // Uses player.MinionDamage
public const int ResummonCooldownTime = 60 * 3;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Rusty Drone");
Main.projFrames[projectile.type] = 12;
ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
}
public override void SetDefaults()
{
projectile.width = 36;
projectile.height = 30;
projectile.netImportant = true;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.minionSlots = 1f;
projectile.timeLeft = 18000;
projectile.penetrate = -1;
projectile.tileCollide = false;
projectile.timeLeft *= 5;
projectile.minion = true;
projectile.alpha = 255;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
if (projectile.localAI[0] == 0f)
{
int oldDamage = projectile.damage;
projectile.damage = 1; // For the initial tiny prick effect
projectile.Damage();
projectile.damage = oldDamage;
projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage();
projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage;
projectile.Center -= Vector2.UnitY * 1400f;
projectile.localAI[0] += 1f;
}
if (projectile.alpha > 0)
{
projectile.alpha = (int)MathHelper.Lerp(projectile.alpha, 0f, 0.02f);
projectile.velocity = Vector2.UnitY * 10f;
}
if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue)
{
int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue /
projectile.Calamity().spawnedPlayerMinionDamageValue *
player.MinionDamage());
projectile.damage = trueDamage;
}
projectile.frameCounter++;
if (projectile.frameCounter > 8)
{
projectile.frame++;
projectile.frameCounter = 0;
}
bool isCorrectProjectile = projectile.type == ModContent.ProjectileType<RustyDrone>();
player.AddBuff(ModContent.BuffType<RustyDroneBuff>(), 3600);
if (isCorrectProjectile)
{
if (player.dead)
{
modPlayer.rustyDrone = false;
}
if (modPlayer.rustyDrone)
{
projectile.timeLeft = 2;
}
}
NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player);
if (potentialTarget == null)
{
if (projectile.Distance(player.Center) > 120f)
{
projectile.velocity = (projectile.velocity * PlayerHomingInertia + projectile.DirectionTo(player.Top) * PlayerHomingSpeed) / (PlayerHomingInertia + 1);
}
if (projectile.frame >= 8)
{
projectile.frame = 0;
}
}
else
{
// A bit above the target, and always on the opposite side of the target's sprite direction.
Vector2 destination = potentialTarget.Top + Vector2.UnitX * -potentialTarget.spriteDirection * Main.rand.NextFloat(50f, 75f) - Vector2.UnitY * 42f;
projectile.velocity = (projectile.velocity * NPCHomingInertia + projectile.DirectionTo(destination) * NPCHomingSpeed) / (NPCHomingInertia + 1);
if (projectile.frame < 8)
{
projectile.frame = 8;
}
if (projectile.frame >= Main.projFrames[projectile.type])
{
projectile.frame = 8;
}
if (projectile.Distance(destination) < 55f)
{
if (projectile.ai[0]++ % AttackRate == AttackRate - 1)
{
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(potentialTarget.Center, Vector2.Zero, ModContent.ProjectileType<RustyDroneTargetIndicator>(), 0, 0f, projectile.owner, projectile.whoAmI, potentialTarget.whoAmI);
}
}
}
}
projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt();
projectile.rotation = projectile.velocity.X * 0.05f;
projectile.ai[1]++;
if (projectile.ai[1] >= 360f)
{
Utils.PoofOfSmoke(projectile.Center);
for (int i = 0; i < 4; i++)
{
Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType<RustShrapnel>(),
(int)(ExplosionShrapnelBaseDamage * player.MinionDamage()), 2f, projectile.owner);
}
projectile.Kill();
}
}
public override bool CanDamage() => projectile.localAI[0] == 0f; // Only do damage from the initial 1 damage prick, and never again. This is a support summon.
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,94 @@
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class RustyDroneTargetIndicator : ModProjectile
{
public float Outwardness = 45f;
public Vector2 DeltaPositionRelativetoTarget = Vector2.Zero;
public const int BuffTime = 180;
public const float TurnRate = 30f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Target Indicator");
ProjectileID.Sets.MinionShot[projectile.type] = true;
}
public override void SetDefaults()
{
projectile.width = 34;
projectile.height = 34;
projectile.tileCollide = false;
projectile.friendly = true;
projectile.minion = true;
projectile.minionSlots = 0f;
projectile.ignoreWater = true;
projectile.penetrate = 1;
projectile.timeLeft = 600;
projectile.alpha = 50;
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(Outwardness);
writer.WriteVector2(DeltaPositionRelativetoTarget);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
Outwardness = reader.ReadSingle();
DeltaPositionRelativetoTarget = reader.ReadVector2();
}
public override void AI()
{
if (projectile.ai[0] < 0 || projectile.ai[0] >= Main.projectile.Length || projectile.ai[1] < 0 || projectile.ai[1] >= Main.npc.Length)
{
projectile.Kill();
return;
}
if (Main.projectile[(int)projectile.ai[0]].type != ModContent.ProjectileType<RustyDrone>() ||
!Main.projectile[(int)projectile.ai[0]].active)
{
projectile.Kill();
}
if (!Main.npc[(int)projectile.ai[1]].active)
{
projectile.Kill();
}
projectile.Center = Vector2.Lerp(projectile.Center, Main.npc[(int)projectile.ai[1]].Center + DeltaPositionRelativetoTarget * Outwardness, 3f / TurnRate);
if (projectile.localAI[0] == 0f)
{
DeltaPositionRelativetoTarget = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi);
projectile.localAI[0] = 1f;
}
projectile.localAI[1]++;
if (projectile.localAI[1] % TurnRate == TurnRate - 1f)
{
Outwardness *= 0.6f;
DeltaPositionRelativetoTarget = DeltaPositionRelativetoTarget.RotatedByRandom(MathHelper.PiOver4);
projectile.scale = 1.5f;
projectile.netUpdate = true;
}
if (projectile.scale > 1f && Outwardness > 4f)
{
projectile.scale = MathHelper.Lerp(projectile.scale, 1f, 0.025f);
}
else if (Outwardness <= 4f)
{
Outwardness *= 0.935f;
if (projectile.timeLeft > 40)
{
projectile.timeLeft = 40;
Main.npc[(int)projectile.ai[1]].AddBuff(BuffID.Poisoned, BuffTime);
Main.npc[(int)projectile.ai[1]].AddBuff(ModContent.BuffType<Irradiated>(), BuffTime);
}
projectile.alpha = (int)MathHelper.Lerp(projectile.alpha, 255f, 1f / 40f);
projectile.scale += 0.05f;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

@@ -189,9 +189,6 @@ namespace CalamityMod.Projectiles.Summon
}
}
public override bool CanDamage()
{
return false;
}
public override bool CanDamage() => false;
}
}
+58
View File
@@ -0,0 +1,58 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class WulfrumBoltMinion : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Bolt");
ProjectileID.Sets.MinionShot[projectile.type] = true;
}
public override void SetDefaults()
{
projectile.width = 8;
projectile.height = 8;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.penetrate = 1;
projectile.extraUpdates = 1;
projectile.minionSlots = 0f;
projectile.minion = true;
}
public override void AI()
{
Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.1f / 255f, 0f);
for (int num151 = 0; num151 < 3; num151++)
{
int num154 = 14;
int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 61, 0f, 0f, 100, default, 3f);
Main.dust[num155].noGravity = true;
Main.dust[num155].noLight = true;
Main.dust[num155].velocity *= 0.1f;
Main.dust[num155].velocity += projectile.velocity * 0.5f;
}
if (Main.rand.NextBool(8))
{
int num156 = 16;
int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 61, 0f, 0f, 100, default, 2.25f);
Main.dust[num157].velocity *= 0.25f;
Main.dust[num157].noLight = true;
Main.dust[num157].velocity += projectile.velocity * 0.5f;
return;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D tex = Main.projectileTexture[projectile.type];
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

+1 -5
View File
@@ -225,12 +225,8 @@ namespace CalamityMod.Projectiles.Summon
Vector2 vec = vector2_3 - projectile.Center;
vec.Normalize();
Vector2 vec2 = vec * 10f;
int bolt = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vec2.X, vec2.Y, ModContent.ProjectileType<WulfrumBolt>(), projectile.damage, 0.0f, Main.myPlayer, 0.0f, 0.0f);
Main.projectile[bolt].Calamity().forceMinion = true;
int bolt = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vec2.X, vec2.Y, ModContent.ProjectileType<WulfrumBoltMinion>(), projectile.damage, 0.0f, Main.myPlayer, 0.0f, 0.0f);
Main.projectile[bolt].netUpdate = true;
Main.projectile[bolt].penetrate = 1;
Main.projectile[bolt].extraUpdates = 1;
ProjectileID.Sets.MinionShot[Main.projectile[bolt].type] = true;
projectile.netUpdate = true;
}
@@ -0,0 +1,45 @@
using CalamityMod.Dusts;
using CalamityMod.Items.SummonItems.Invasion;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class BrokenWaterFilterSpewer : ModProjectile
{
public const int TimeLeft = 180;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Star");
}
public override void SetDefaults()
{
projectile.width = 24;
projectile.height = 24;
projectile.friendly = true;
projectile.timeLeft = TimeLeft;
projectile.penetrate = 1;
projectile.tileCollide = false;
}
public override void AI()
{
projectile.velocity *= 0.98f;
int totalTearCount = projectile.wet ? 5 : 3;
totalTearCount++;
if (projectile.ai[0]++ >= TimeLeft / totalTearCount)
{
Item.NewItem(projectile.Center, ModContent.ItemType<CausticTear>());
projectile.ai[0] = 0;
}
projectile.rotation = projectile.rotation.AngleTowards(MathHelper.PiOver4, 0.04f);
Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid);
dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1.5f, 3f);
dust.noGravity = true;
dust.scale = 1.3f;
}
public override bool CanDamage() => false;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B