archerfish line tweaks again
This commit is contained in:
1 parent
f99da838a8
commit
700d00f23f
8 files changed
+111
-166
No files matched your search
@@ -1,7 +1,8 @@
|
||||
using Terraria.DataStructures;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Item.knockBack = 2f;
|
||||
Item.value = CalamityGlobalItem.Rarity3BuyPrice;
|
||||
Item.rare = ItemRarityID.Orange;
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.UseSound = SoundID.Item85;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<ArcherfishShot>();
|
||||
Item.shootSpeed = 11f;
|
||||
@@ -31,23 +32,32 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset()
|
||||
{
|
||||
return new Vector2(-10, -5);
|
||||
}
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-10, -5);
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
// Reposition to the gun's tip
|
||||
Vector2 newPos = position + new Vector2(60f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation());
|
||||
|
||||
// Fires a spread of harmless bubbles
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Gore bubble = Gore.NewGorePerfect(source, newPos, velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * 0.5f, 411);
|
||||
bubble.timeLeft = 6 + Main.rand.Next(4);
|
||||
bubble.scale = Main.rand.NextFloat(0.6f, 0.8f);
|
||||
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
|
||||
}
|
||||
|
||||
// Replaces standard bullets with water jets.
|
||||
if (type == ProjectileID.Bullet)
|
||||
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<ArcherfishShot>(), damage, knockback, player.whoAmI);
|
||||
Projectile.NewProjectile(source, newPos, velocity, Item.shoot, damage, knockback, player.whoAmI);
|
||||
else
|
||||
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
Projectile.NewProjectile(source, newPos, velocity, type, damage, knockback, player.whoAmI);
|
||||
|
||||
// Always fires a close range water blast.
|
||||
int waterRingDamage = (int)(damage * 0.5f);
|
||||
float boostedKB = knockback + 5f;
|
||||
Projectile.NewProjectile(source, position, velocity * 0.5f, ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
|
||||
Projectile.NewProjectile(source, newPos, velocity * 0.5f, ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using Terraria.DataStructures;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -29,33 +30,29 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.shoot = ModContent.ProjectileType<ArcherfishShot>();
|
||||
Item.shootSpeed = 16f;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset()
|
||||
{
|
||||
return new Vector2(-5, 0);
|
||||
}
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
// Both bullets and water jets have very slight inaccuracy
|
||||
float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f;
|
||||
float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f;
|
||||
// Reposition to the gun's tip + add some inaccuracy
|
||||
Vector2 newPos = position + new Vector2(64f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation());
|
||||
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f));
|
||||
|
||||
// Fire either the bullet or the water jet, depending on cadence.
|
||||
int projectileToFire = fireWater ? ModContent.ProjectileType<ArcherfishShot>() : type;
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, projectileToFire, damage, knockback, player.whoAmI, 0.0f, 0.0f);
|
||||
int projectileToFire = fireWater ? Item.shoot : type;
|
||||
Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI);
|
||||
|
||||
// Always fires a close range water blast.
|
||||
// It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous.
|
||||
Vector2 waterRingVec = new Vector2(SpeedX, SpeedY) * Main.rand.NextFloat(0.5f, 0.6f);
|
||||
int waterRingDamage = (int)(damage * 0.5f);
|
||||
float boostedKB = knockback + 7f; // Stronger guaranteed KB than Archerfish for mid-late Hardmode
|
||||
Projectile.NewProjectile(source, position, waterRingVec, ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
|
||||
Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.5f, 0.6f), ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
|
||||
|
||||
// Swap between firing bullets and water jets each shot.
|
||||
fireWater = !fireWater;
|
||||
|
||||
@@ -3,6 +3,7 @@ using CalamityMod.Items.Placeables;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
@@ -34,34 +35,30 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Item.rare = ModContent.RarityType<Turquoise>();
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.shoot = ModContent.ProjectileType<ArcherfishShot>();
|
||||
Item.shootSpeed = 16f;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset()
|
||||
{
|
||||
return new Vector2(-10, 0);
|
||||
}
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
// Both bullets and water jets have very slight inaccuracy
|
||||
float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f;
|
||||
float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f;
|
||||
// Reposition to the gun's tip + add some inaccuracy
|
||||
Vector2 newPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation());
|
||||
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f));
|
||||
|
||||
// Fire either the bullet or the water jet, depending on cadence.
|
||||
bool fireWater = shotCounter % 2 == 0;
|
||||
int projectileToFire = fireWater ? ModContent.ProjectileType<ArcherfishShot>() : type;
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, projectileToFire, damage, knockback, player.whoAmI, 0.0f, 0.0f);
|
||||
int projectileToFire = fireWater ? Item.shoot : type;
|
||||
Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI);
|
||||
|
||||
// Always fires a close range water blast.
|
||||
// It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous.
|
||||
Vector2 waterRingVec = new Vector2(SpeedX, SpeedY) * Main.rand.NextFloat(0.45f, 0.65f);
|
||||
int waterRingDamage = (int)(damage * 0.5f);
|
||||
float boostedKB = knockback + 7f; // Same KB bonus as Megalodon. The muzzle blast will annihilate nearby enemies and send their gibs flying.
|
||||
Projectile.NewProjectile(source, position, waterRingVec, ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
|
||||
Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.45f, 0.65f), ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
|
||||
|
||||
// Check cadence position to determine which bonus projectile to add, if any.
|
||||
bool fireRocket = shotCounter == 9;
|
||||
@@ -70,19 +67,17 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
// Rockets have their own more chaotic spread than bullets.
|
||||
if (fireRocket)
|
||||
{
|
||||
Vector2 rocketVec = velocity.SafeNormalize(Vector2.Zero).RotatedBy(Main.rand.NextFloat(-0.25f, 0.25f)) * 25f;
|
||||
int rocketDamage = damage * 5;
|
||||
Projectile.NewProjectile(source, position, rocketVec, ModContent.ProjectileType<SeaDragonRocket>(), rocketDamage, knockback, player.whoAmI);
|
||||
Projectile.NewProjectile(source, newPos, newVel * 1.2f, ModContent.ProjectileType<SeaDragonRocket>(), rocketDamage, knockback, player.whoAmI);
|
||||
SoundEngine.PlaySound(SoundID.Item109, player.Center);
|
||||
}
|
||||
|
||||
// Muzzle blasts are always directly in line with the gun's muzzle.
|
||||
if (muzzleBlast)
|
||||
{
|
||||
Vector2 muzzleBlastVec = velocity.SafeNormalize(Vector2.Zero) * 18f;
|
||||
int muzzleBlastDamage = damage * 25; // This might be too much but it's every 18th shot...
|
||||
float muzzleBlastKB = knockback + 12f;
|
||||
Projectile.NewProjectile(source, position+player.DirectionTo(Main.MouseWorld)*48f, muzzleBlastVec, ModContent.ProjectileType<SeaDragonMuzzleBlast>(), muzzleBlastDamage, muzzleBlastKB, player.whoAmI);
|
||||
Projectile.NewProjectile(source, newPos, velocity, ModContent.ProjectileType<SeaDragonMuzzleBlast>(), muzzleBlastDamage, muzzleBlastKB, player.whoAmI);
|
||||
|
||||
// Play additional sound for muzzle blasts
|
||||
SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, position);
|
||||
|
||||
@@ -3,16 +3,17 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class ArcherfishRing : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Particles/HollowCircleHardEdge";
|
||||
|
||||
public static readonly SoundStyle PopSound = new("CalamityMod/Sounds/Custom/BubblyPop") { PitchVariance = 0.5f, Volume = 0.66f };
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = 2;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.alpha = 115;
|
||||
Projectile.alpha = 15;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.MaxUpdates = 3;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
@@ -31,44 +32,62 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size(), scale: Projectile.scale);
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
//The ring expanding slowing while increasing opacity until it disappears at max size
|
||||
|
||||
if (Projectile.ai[0] == 0)
|
||||
if (Projectile.ai[0] == 0f)
|
||||
{
|
||||
Projectile.scale = 0.2f;
|
||||
Projectile.ai[0]++;
|
||||
Projectile.scale = 0.5f;
|
||||
Projectile.ai[0]++;
|
||||
}
|
||||
|
||||
if (Projectile.scale <= 1.5f)
|
||||
{
|
||||
Projectile.scale *= 1.035f;
|
||||
}
|
||||
if (Projectile.velocity.X > -0.8f && Projectile.velocity.X < 0.8f &
|
||||
Projectile.velocity.Y > -0.8f && Projectile.velocity.Y < 0.8f)
|
||||
{
|
||||
Projectile.alpha += 10;
|
||||
}
|
||||
if (Projectile.alpha >= 255)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
Projectile.scale *= 1.015f;
|
||||
else
|
||||
{
|
||||
Projectile.velocity *= 0.95f;
|
||||
}
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
Projectile.scale = 1.5f;
|
||||
|
||||
if (Projectile.velocity.Length() < 0.08f)
|
||||
Projectile.alpha += 15;
|
||||
|
||||
if (Projectile.alpha >= 255)
|
||||
Projectile.Kill();
|
||||
else
|
||||
Projectile.velocity *= 0.95f;
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
//Audio feedback for hitting the ring
|
||||
Player user = Main.player[Projectile.owner];
|
||||
SoundEngine.PlaySound(SoundID.Item21, Projectile.position);
|
||||
SoundEngine.PlaySound(PopSound, Projectile.Center);
|
||||
|
||||
target.AddBuff(BuffID.Wet, 240);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Vector2 ringScale = Projectile.Size / tex.Size() * Projectile.scale;
|
||||
Color ringColor = Color.Lerp(Color.DodgerBlue, Color.Blue, Projectile.Opacity) * Projectile.Opacity * 1.2f;
|
||||
|
||||
Main.spriteBatch.EnterShaderRegion(BlendState.Additive);
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, ringColor, Projectile.rotation, tex.Size() / 2f, ringScale, SpriteEffects.None);
|
||||
Main.spriteBatch.ExitShaderRegion();
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
float totalDusts = 18f;
|
||||
for (float i = 0f; i < totalDusts; i++)
|
||||
{
|
||||
Vector2 ringSpeed = new Vector2((float)Math.Cos(i / totalDusts * MathHelper.TwoPi), (float)Math.Sin(i / totalDusts * MathHelper.TwoPi) * 0.5f).RotatedBy(Projectile.rotation) * 4f * Projectile.scale;
|
||||
Dust droplets = Dust.NewDustPerfect(Projectile.Center, 211, ringSpeed, 100);
|
||||
droplets.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB |
@@ -29,112 +29,36 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.localAI[0] < 5f)
|
||||
// Bubbles
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Projectile.localAI[0] += 1f;
|
||||
return;
|
||||
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411);
|
||||
bubble.timeLeft = 9 + Main.rand.Next(7);
|
||||
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
|
||||
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
|
||||
}
|
||||
int num3;
|
||||
for (int num586 = 0; num586 < 1; num586 = num3 + 1)
|
||||
|
||||
// Water trail
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
for (int num587 = 0; num587 < 6; num587 = num3 + 1)
|
||||
{
|
||||
float num588 = Projectile.velocity.X / 6f * (float)num587;
|
||||
float num589 = Projectile.velocity.Y / 6f * (float)num587;
|
||||
int num590 = 6;
|
||||
int num591 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num590, Projectile.position.Y + (float)num590), Projectile.width - num590 * 2, Projectile.height - num590 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f);
|
||||
Dust dust;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
dust = Main.dust[num591];
|
||||
dust.alpha += 25;
|
||||
}
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
dust = Main.dust[num591];
|
||||
dust.alpha += 25;
|
||||
}
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
dust = Main.dust[num591];
|
||||
dust.alpha += 25;
|
||||
}
|
||||
Main.dust[num591].noGravity = true;
|
||||
dust = Main.dust[num591];
|
||||
dust.velocity *= 0.3f;
|
||||
dust = Main.dust[num591];
|
||||
dust.velocity += Projectile.velocity * 0.5f;
|
||||
Main.dust[num591].position = Projectile.Center;
|
||||
Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591];
|
||||
var_2_18F52_cp_0_cp_0.position.X -= num588;
|
||||
Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591];
|
||||
var_2_18F74_cp_0_cp_0.position.Y -= num589;
|
||||
dust = Main.dust[num591];
|
||||
dust.velocity *= 0.2f;
|
||||
num3 = num587;
|
||||
}
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
int num592 = 6;
|
||||
int num593 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num592, Projectile.position.Y + (float)num592), Projectile.width - num592 * 2, Projectile.height - num592 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 0.65f);
|
||||
Dust dust = Main.dust[num593];
|
||||
dust.velocity *= 0.5f;
|
||||
dust = Main.dust[num593];
|
||||
dust.velocity += Projectile.velocity * 0.5f;
|
||||
}
|
||||
num3 = num586;
|
||||
Dust water = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 211, 0f, 0f, 100);
|
||||
water.noGravity = true;
|
||||
water.velocity = Projectile.velocity * 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
Projectile.velocity = Projectile.oldVelocity * 0.2f;
|
||||
int num3;
|
||||
for (int num362 = 0; num362 < 100; num362 = num3 + 1)
|
||||
// Bubbles
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int num363 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f);
|
||||
Dust dust;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
dust = Main.dust[num363];
|
||||
dust.alpha += 25;
|
||||
}
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
dust = Main.dust[num363];
|
||||
dust.alpha += 25;
|
||||
}
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
dust = Main.dust[num363];
|
||||
dust.alpha += 25;
|
||||
}
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[num363].scale = 0.6f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.dust[num363].noGravity = true;
|
||||
}
|
||||
dust = Main.dust[num363];
|
||||
dust.velocity *= 0.3f;
|
||||
dust = Main.dust[num363];
|
||||
dust.velocity += Projectile.velocity;
|
||||
dust = Main.dust[num363];
|
||||
dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f;
|
||||
Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363];
|
||||
expr_C6F7_cp_0_cp_0.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f;
|
||||
Dust expr_C726_cp_0_cp_0 = Main.dust[num363];
|
||||
expr_C726_cp_0_cp_0.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f;
|
||||
Main.dust[num363].position = Projectile.Center;
|
||||
num3 = num362;
|
||||
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(60f)) * 0.3f, 411);
|
||||
bubble.timeLeft = 9 + Main.rand.Next(7);
|
||||
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
|
||||
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Wet, 240);
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Wet, 240);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -12,17 +12,17 @@ namespace CalamityMod
|
||||
/// <param name="targetTopLeft">The top left coordinates of the target to check.</param>
|
||||
/// <param name="targetHitboxDimensions">The hitbox size of the target to check.</param>
|
||||
/// <param name="directionOverride">An optional direction override</param>
|
||||
public static bool RotatingHitboxCollision(this Entity entity, Vector2 targetTopLeft, Vector2 targetHitboxDimensions, Vector2? directionOverride = null)
|
||||
public static bool RotatingHitboxCollision(this Entity entity, Vector2 targetTopLeft, Vector2 targetHitboxDimensions, Vector2? directionOverride = null, float scale = 1f)
|
||||
{
|
||||
Vector2 lineDirection = directionOverride ?? entity.velocity;
|
||||
|
||||
// Ensure that the line direction is a unit vector.
|
||||
lineDirection = lineDirection.SafeNormalize(Vector2.UnitY);
|
||||
Vector2 start = entity.Center - lineDirection * entity.height * 0.5f;
|
||||
Vector2 end = entity.Center + lineDirection * entity.height * 0.5f;
|
||||
Vector2 start = entity.Center - lineDirection * entity.height * 0.5f * scale;
|
||||
Vector2 end = entity.Center + lineDirection * entity.height * 0.5f * scale;
|
||||
|
||||
float _ = 0f;
|
||||
return Collision.CheckAABBvLineCollision(targetTopLeft, targetHitboxDimensions, start, end, entity.width, ref _);
|
||||
return Collision.CheckAABBvLineCollision(targetTopLeft, targetHitboxDimensions, start, end, entity.width * scale, ref _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user