Rebalanced Acid Gun

This commit is contained in:
ben-tk committed 2022-10-07 14:59:51 -04:00
1 parent e5196f3be9
commit 3ac45002e9
2 files changed
+52 -10

No files matched your search

+24 -4
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override void SetDefaults()
{
Item.damage = 17;
Item.damage = 26;
Item.DamageType = DamageClass.Magic;
Item.mana = 9;
Item.width = 42;
@@ -41,10 +41,30 @@ namespace CalamityMod.Items.Weapons.Magic
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
for (int i = 0; i < 3; i++)
float angle = MathHelper.Lerp(-0.145f, 0.145f, 1f / 3f);
int acid1 = Projectile.NewProjectile(source, position, velocity.RotatedBy(angle), type, damage, knockback, player.whoAmI);
angle = MathHelper.Lerp(-0.145f, 0.145f, 2f / 3f);
int acid2 = Projectile.NewProjectile(source, position, velocity.RotatedBy(angle), type, damage, knockback, player.whoAmI);
angle = MathHelper.Lerp(-0.145f, 0.145f, 1f);
int acid3 = Projectile.NewProjectile(source, position, velocity.RotatedBy(angle), type, damage, knockback, player.whoAmI);
// Keep track of the other 2 acid streams
if (Main.projectile.IndexInRange(acid1))
{
float angle = MathHelper.Lerp(-0.145f, 0.145f, i / 3f);
Projectile.NewProjectile(source, position, velocity.RotatedBy(angle), type, damage, knockback, player.whoAmI);
Main.projectile[acid1].ai[0] = acid2;
Main.projectile[acid1].ai[1] = acid3;
}
if (Main.projectile.IndexInRange(acid2))
{
Main.projectile[acid2].ai[0] = acid1;
Main.projectile[acid2].ai[1] = acid3;
}
if (Main.projectile.IndexInRange(acid3))
{
Main.projectile[acid3].ai[0] = acid1;
Main.projectile[acid3].ai[1] = acid2;
}
return false;
}
+28 -6
View File
@@ -20,15 +20,15 @@ namespace CalamityMod.Projectiles.Magic
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.ignoreWater = true;
Projectile.penetrate = 2;
Projectile.penetrate = 3;
Projectile.extraUpdates = 2;
Projectile.tileCollide = false;
}
public override void AI()
{
Projectile.ai[1]++;
if (Projectile.ai[1] >= 4f)
Projectile.localAI[1]++;
if (Projectile.localAI[1] >= 4f)
{
Projectile.tileCollide = true;
}
@@ -37,12 +37,12 @@ namespace CalamityMod.Projectiles.Magic
{
Projectile.Kill();
}
if (Projectile.ai[0] <= 3f)
if (Projectile.localAI[0] <= 3f)
{
Projectile.ai[0] += 1f;
Projectile.localAI[0] += 1f;
return;
}
Projectile.velocity.Y = Projectile.velocity.Y + 0.075f;
Projectile.velocity.Y += 0.075f;
for (int i = 0; i < 3; i++)
{
Vector2 positionDelta = Projectile.velocity / 3f * i;
@@ -62,5 +62,27 @@ namespace CalamityMod.Projectiles.Magic
Main.dust[dustIdx].velocity += Projectile.velocity * 0.5f;
}
}
// If any of the streams are destroyed, kill the accompanying acid streams
public override void Kill(int timeLeft)
{
if (Projectile.penetrate > 1)
return;
if (Main.projectile.IndexInRange((int)Projectile.ai[0]))
{
Projectile proj = Main.projectile[(int)Projectile.ai[0]];
proj.ai[0] = -1f;
proj.ai[1] = -1f;
proj.Kill();
}
if (Main.projectile.IndexInRange((int)Projectile.ai[1]))
{
Projectile proj = Main.projectile[(int)Projectile.ai[1]];
proj.ai[0] = -1f;
proj.ai[1] = -1f;
proj.Kill();
}
}
}
}