1 - Fixed hitbox alignment for all bullets.
2 - Improved Terra Bullet dust.
This commit is contained in:
1 parent
f82dfe34ec
commit
361f31f7f5
13 files changed
+104
-113
No files matched your search
@@ -10,13 +10,14 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Acceleration Bullet");
|
||||
DisplayName.SetDefault("Acceleration Round");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
// Intentionally large bullet hitbox because this thing speeds up significantly
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.aiStyle = 1;
|
||||
@@ -49,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, null, false);
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,15 +11,15 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Acid Bullet");
|
||||
DisplayName.SetDefault("Acid Round");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.width = 4;
|
||||
projectile.height = 4;
|
||||
projectile.aiStyle = 1;
|
||||
projectile.friendly = true;
|
||||
projectile.ranged = true;
|
||||
@@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Nano Round");
|
||||
DisplayName.SetDefault("Enhanced Nano Round");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.width = 4;
|
||||
projectile.height = 4;
|
||||
projectile.aiStyle = 1;
|
||||
projectile.friendly = true;
|
||||
projectile.ranged = true;
|
||||
@@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Bullet");
|
||||
DisplayName.SetDefault("Flash Round");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.width = 4;
|
||||
projectile.height = 4;
|
||||
projectile.aiStyle = 1;
|
||||
projectile.friendly = true;
|
||||
projectile.ranged = true;
|
||||
@@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.width = 4;
|
||||
projectile.height = 4;
|
||||
projectile.aiStyle = 1;
|
||||
projectile.friendly = true;
|
||||
projectile.ranged = true;
|
||||
@@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,9 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 12;
|
||||
projectile.height = 12;
|
||||
// Intentionally large bullet hitbox
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.friendly = true;
|
||||
projectile.ranged = true;
|
||||
projectile.extraUpdates = 4;
|
||||
@@ -54,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.width = 4;
|
||||
projectile.height = 4;
|
||||
projectile.aiStyle = 1;
|
||||
projectile.friendly = true;
|
||||
projectile.ranged = true;
|
||||
@@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
// Intentionally large bullet hitbox to make Hyperius swarm more forgiving with hits
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.aiStyle = 1;
|
||||
@@ -51,9 +52,9 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
if (projectile.timeLeft == 360)
|
||||
return false;
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
if (projectile.timeLeft == 360)
|
||||
return false;
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class IcyBulletProj : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults() => DisplayName.SetDefault("Icy Bullet");
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 4;
|
||||
@@ -22,12 +24,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
projectile.extraUpdates = 1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 20;
|
||||
projectile.coldDamage = true;
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Icy Bullet");
|
||||
projectile.coldDamage = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
|
||||
@@ -10,13 +10,14 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Bullet");
|
||||
DisplayName.SetDefault("Superball Bullet");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
// Intentionally large bullet hitbox because this thing speeds up significantly
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.aiStyle = 1;
|
||||
@@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,60 +11,51 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Bullet");
|
||||
DisplayName.SetDefault("Terra Bullet");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 2;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.width = 4;
|
||||
projectile.height = 4;
|
||||
projectile.aiStyle = 1;
|
||||
aiType = ProjectileID.Bullet;
|
||||
projectile.friendly = true;
|
||||
projectile.ranged = true;
|
||||
projectile.penetrate = 1;
|
||||
projectile.timeLeft = 600;
|
||||
projectile.alpha = 255;
|
||||
projectile.extraUpdates = 1;
|
||||
aiType = ProjectileID.Bullet;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
|
||||
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f);
|
||||
Lighting.AddLight(projectile.Center, 0f, 0.4f, 0f);
|
||||
|
||||
// localAI is used as an invisibility counter. The bullet fades into existence after 15 startup frames.
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] >= 6f)
|
||||
{
|
||||
// After 15 frames, the alpha will be exactly 0
|
||||
if (projectile.alpha > 0)
|
||||
{
|
||||
projectile.alpha -= 17;
|
||||
}
|
||||
for (int num136 = 0; num136 < 2; num136++)
|
||||
{
|
||||
float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136;
|
||||
float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136;
|
||||
int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 74, 0f, 0f, 0, default, 0.8f);
|
||||
Main.dust[num137].alpha = projectile.alpha;
|
||||
Main.dust[num137].position.X = x2;
|
||||
Main.dust[num137].position.Y = y2;
|
||||
Main.dust[num137].velocity *= 0f;
|
||||
Main.dust[num137].noGravity = true;
|
||||
}
|
||||
|
||||
// Dust type 74, scale 0.8, no gravity, no light, no velocity
|
||||
Vector2 pos = projectile.Center - projectile.velocity * 0.1f;
|
||||
Dust d = Dust.NewDustDirect(pos, 0, 0, 74, Scale: 0.8f);
|
||||
d.position = pos;
|
||||
d.velocity = Vector2.Zero;
|
||||
d.noGravity = true;
|
||||
d.noLight = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f);
|
||||
for (int k = 0; k < projectile.oldPos.Length; k++)
|
||||
{
|
||||
Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY);
|
||||
Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length);
|
||||
spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
return true;
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
@@ -73,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
for (int b = 0; b < 2; b++)
|
||||
{
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
|
||||
Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType<TerraBulletSplit>(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,54 +1,53 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class VeriumBulletProj : ModProjectile
|
||||
{
|
||||
public class VeriumBulletProj : ModProjectile
|
||||
{
|
||||
private float speed = 0f;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Bullet");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Verium Bullet");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.aiStyle = 1;
|
||||
projectile.friendly = true;
|
||||
projectile.ranged = true;
|
||||
projectile.penetrate = 2;
|
||||
projectile.timeLeft = 600;
|
||||
projectile.extraUpdates = 1;
|
||||
aiType = ProjectileID.Bullet;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 8;
|
||||
projectile.height = 8;
|
||||
projectile.aiStyle = 1;
|
||||
projectile.friendly = true;
|
||||
projectile.ranged = true;
|
||||
projectile.penetrate = 2;
|
||||
projectile.timeLeft = 600;
|
||||
projectile.extraUpdates = 1;
|
||||
aiType = ProjectileID.Bullet;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
return false;
|
||||
}
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreAI()
|
||||
{
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f);
|
||||
projectile.spriteDirection = projectile.direction;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f);
|
||||
Main.dust[purple].alpha = projectile.alpha;
|
||||
Main.dust[purple].velocity *= 0f;
|
||||
Main.dust[purple].noGravity = true;
|
||||
}
|
||||
public override bool PreAI()
|
||||
{
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f);
|
||||
projectile.spriteDirection = projectile.direction;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f);
|
||||
Main.dust[purple].alpha = projectile.alpha;
|
||||
Main.dust[purple].velocity *= 0f;
|
||||
Main.dust[purple].noGravity = true;
|
||||
}
|
||||
|
||||
if (projectile.ai[0] > 0f)
|
||||
projectile.ai[0]--;
|
||||
@@ -114,24 +113,24 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target) => projectile.ai[0] <= 0f;
|
||||
|
||||
public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f;
|
||||
public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f;
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
projectile.ai[0] = 10f;
|
||||
projectile.damage /= 2;
|
||||
projectile.damage /= 2;
|
||||
if (target.life > 0)
|
||||
projectile.ai[1] = target.whoAmI;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
projectile.ai[0] = 10f;
|
||||
projectile.damage /= 2;
|
||||
}
|
||||
}
|
||||
projectile.damage /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user