Overloaded Blaster revised

This commit is contained in:
Altixal committed 2023-10-21 16:27:18 +07:00
1 parent daa334f79c
commit d21e769979
5 files changed
+94 -61

No files matched your search

File renamed without changes.

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 300 B

+8 -16
View File
@@ -16,8 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.DamageType = DamageClass.Ranged;
Item.width = 42;
Item.height = 34;
Item.useTime = 18;
Item.useAnimation = 18;
Item.useAnimation = Item.useTime = 22;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 1.5f;
@@ -25,29 +24,22 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.rare = ItemRarityID.LightRed;
Item.UseSound = SoundID.Item9;
Item.autoReuse = true;
Item.shootSpeed = 4.5f;
Item.shootSpeed = 5f;
Item.shoot = ModContent.ProjectileType<SlimeBolt>();
Item.useAmmo = AmmoID.Gel;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-4, -5);
}
public override Vector2? HoldoutOffset() => new Vector2(-4, -5);
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 33)
return false;
return true;
}
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 25;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
for (int index = 0; index < 3; ++index)
Vector2 newPos = position + velocity * 6f;
for (int i = 0; i < 3; i++)
{
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(0.6f, 1.1f);
Projectile.NewProjectile(source, position, newVel, type, damage, knockback, player.whoAmI);
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.8f, 1.2f);
Projectile.NewProjectile(source, newPos, newVel, type, damage, knockback, player.whoAmI);
}
return false;
}
@@ -830,7 +830,7 @@ OverloadedBlaster: {
Overloaded slime doesn't pierce, but deals double damage
The slime bounces off of walls at high-velocity
Uses gel for ammo
33% chance to save ammo
25% chance to save ammo
'''
}
+1
View File
@@ -7,6 +7,7 @@ namespace CalamityMod.Projectiles.Melee
public class Orbacle : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/ExtraTextures/TinyGreyscaleCircle";
private static int Lifetime = 40;
public override void SetDefaults()
+84 -44
View File
@@ -1,6 +1,7 @@
using CalamityMod.Particles;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -10,43 +11,46 @@ namespace CalamityMod.Projectiles.Ranged
public class SlimeBolt : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override string Texture => "CalamityMod/ExtraTextures/TinyGreyscaleCircle";
public static int Lifetime => 270;
public static float Fadetime => 225f;
public static float EmpowerTime => 135f;
public static Color SlimeColor => new Color (133, 133, 224);
public ref float Time => ref Projectile.ai[0];
public bool Empowered => Projectile.ai[0] >= EmpowerTime;
public ref float BloomPower => ref Projectile.ai[1];
public bool Bounced => Projectile.ai[2] >= 1f;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public bool Empowered = false;
public int countdown = 90;
public bool postBounce = false;
public override void SetDefaults()
{
Projectile.width = 18;
Projectile.height = 18;
Projectile.width = Projectile.height = 20;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = -1;
Projectile.timeLeft = 300;
Projectile.extraUpdates = 2;
Projectile.MaxUpdates = 3;
Projectile.timeLeft = Lifetime;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates;
}
public override void AI()
{
if (countdown < 81)
{
Particle orb = new GenericBloom(Projectile.Center, Vector2.Zero, Color.SkyBlue, Empowered ? 0.22f : 0.17f, postBounce ? 2 : 5, true);
GeneralParticleHandler.SpawnParticle(orb);
}
if (countdown > -55 && Main.rand.NextBool(postBounce ? 2 : 7))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10), Main.rand.NextBool(3) ? 16 : 20);
dust.scale = Main.rand.NextFloat(0.3f, 0.7f);
dust.velocity = -Projectile.velocity * 0.7f;
}
countdown--;
if (countdown <= 0)
Projectile.velocity *= 0.97f;
Vector3 DustLight = new Vector3(0.100f, 0.150f, 0.200f);
Lighting.AddLight(Projectile.Center, DustLight * 3);
if (countdown == -55)
Time++;
if (Time == EmpowerTime)
{
Projectile.penetrate = 1;
Projectile.damage *= 2;
Projectile.velocity *= 0f;
Projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi);
float numberOfDusts = 10;
float rotFactor = 360f / numberOfDusts;
for (int i = 0; i < numberOfDusts; i++)
@@ -60,42 +64,44 @@ namespace CalamityMod.Projectiles.Ranged
dust.scale = Main.rand.NextFloat(1.2f, 1.9f);
}
}
if (countdown < -55 && Projectile.timeLeft % 10 == 0)
{
Empowered = true;
SparkParticle spark1 = new SparkParticle(Projectile.Center, new Vector2(0, 2), false, 7, 0.9f, Color.SkyBlue);
GeneralParticleHandler.SpawnParticle(spark1);
SparkParticle spark2 = new SparkParticle(Projectile.Center, new Vector2(0, -2), false, 7, 0.9f, Color.SkyBlue);
GeneralParticleHandler.SpawnParticle(spark2);
SparkParticle spark3 = new SparkParticle(Projectile.Center, new Vector2(2, 0), false, 7, 0.9f, Color.SkyBlue);
GeneralParticleHandler.SpawnParticle(spark3);
SparkParticle spark4 = new SparkParticle(Projectile.Center, new Vector2(-2, 0), false, 7, 0.9f, Color.SkyBlue);
GeneralParticleHandler.SpawnParticle(spark4);
else if (Time >= 90f)
Projectile.velocity *= 0.97f;
}
if (Empowered)
{
Projectile.penetrate = 1;
Projectile.rotation += MathHelper.ToRadians(2f);
if (Time >= Fadetime)
BloomPower = Utils.Remap(Time, Fadetime, Lifetime, 1.5f, 0f);
else
BloomPower = Utils.Remap(Time, EmpowerTime, Fadetime, 0f, 1.5f);
}
else if (Main.rand.NextBool(Bounced ? 2 : 7))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10), Main.rand.NextBool(3) ? 16 : 20);
dust.scale = Main.rand.NextFloat(0.3f, 0.7f);
dust.velocity = -Projectile.velocity * 0.7f;
}
Lighting.AddLight(Projectile.Center, 0.3f, 0.3f, 0.5f);
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
if (Projectile.velocity.X != oldVelocity.X)
{
Projectile.velocity.X = -oldVelocity.X * (postBounce ? 1f : 3f);
Projectile.velocity.X = -oldVelocity.X * (Bounced ? 1f : Utils.Remap(Time, 0f, EmpowerTime, 1.5f, 4f));
}
if (Projectile.velocity.Y != oldVelocity.Y)
{
Projectile.velocity.Y = -oldVelocity.Y * (postBounce ? 1f : 3f);
Projectile.velocity.Y = -oldVelocity.Y * (Bounced ? 1f : Utils.Remap(Time, 0f, EmpowerTime, 1.5f, 4f));
}
postBounce = true;
Projectile.ai[2]++;
return false;
}
public override void OnKill(int timeLeft)
{
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.SkyBlue, new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0f, 0.4f, 25);
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, SlimeColor, Vector2.One, 0f, 0f, 0.4f, 25);
GeneralParticleHandler.SpawnParticle(pulse);
}
@@ -104,7 +110,7 @@ namespace CalamityMod.Projectiles.Ranged
target.AddBuff(BuffID.Slimed, Empowered ? 480 : 180);
if (Empowered)
{
Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.SkyBlue, new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0f, 0.65f, 35);
Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, SlimeColor, Vector2.One, 0f, 0f, 0.65f, 35);
GeneralParticleHandler.SpawnParticle(pulse2);
float numberOfDusts = 12;
float rotFactor = 360f / numberOfDusts;
@@ -113,7 +119,7 @@ namespace CalamityMod.Projectiles.Ranged
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 offset = new Vector2(Main.rand.NextFloat(1, 3.1f), 0).RotatedBy(rot);
Vector2 velOffset = new Vector2(Main.rand.NextFloat(1, 3.1f), 0).RotatedBy(rot);
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool(3) ? 34 : 59, new Vector2(velOffset.X, velOffset.Y));
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, Main.rand.NextBool(3) ? 34 : 59, velOffset);
dust.noGravity = false;
dust.alpha = 130;
dust.velocity = velOffset;
@@ -121,5 +127,39 @@ namespace CalamityMod.Projectiles.Ranged
}
}
}
public override bool PreDraw(ref Color lightColor)
{
Main.spriteBatch.SetBlendState(BlendState.Additive);
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Main.EntitySpriteDraw(texture, drawPosition, null, SlimeColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0);
if (Empowered)
{
Texture2D shineTex = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle").Value;
Texture2D bloomTex = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
Main.EntitySpriteDraw(bloomTex, drawPosition, null, SlimeColor * 0.5f, Projectile.rotation, bloomTex.Size() * 0.5f, BloomPower * Projectile.scale * 0.3f, SpriteEffects.None);
Main.EntitySpriteDraw(shineTex, drawPosition, null, SlimeColor, Projectile.rotation, shineTex.Size() * 0.5f, BloomPower * Projectile.scale, SpriteEffects.None);
}
else
{
for (int i = 0; i < Projectile.oldPos.Length; i++)
{
float completionRatio = i / (float)Projectile.oldPos.Length;
Vector2 trailPos = Projectile.oldPos[i] + texture.Size() * 0.5f - Main.screenPosition;
// The further the smaller
Color trailColor = Color.Lerp(SlimeColor, Color.Black, completionRatio);
float trailScale = MathHelper.Lerp(0.15f, 1f, 1f - completionRatio);
Main.EntitySpriteDraw(texture, trailPos, null, trailColor, 0f, texture.Size() * 0.5f, Projectile.scale * trailScale, SpriteEffects.None, 0);
}
}
Main.spriteBatch.SetBlendState(BlendState.AlphaBlend);
return false;
}
}
}