Omnigun (flavor text is placeholder)
No files matched your search
|
After Width: | Height: | Size: 155 B |
|
After Width: | Height: | Size: 203 B |
|
After Width: | Height: | Size: 163 B |
|
After Width: | Height: | Size: 152 B |
@@ -0,0 +1,51 @@
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
public class OmniGun : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
|
||||
public static int AmmoSavedPercent = 66;
|
||||
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent);
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 118;
|
||||
Item.height = 32;
|
||||
Item.damage = 66;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useAnimation = Item.useTime = 6;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 5f;
|
||||
Item.UseSound = null;
|
||||
Item.noUseGraphic = true;
|
||||
Item.channel = true;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<OmniGunHoldout>();
|
||||
Item.shootSpeed = 16f;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
|
||||
Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice;
|
||||
Item.rare = ModContent.RarityType<PureGreen>();
|
||||
}
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent;
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<OmniGunHoldout>(), damage, knockback, player.whoAmI);
|
||||
|
||||
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
||||
// We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out.
|
||||
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 962 B |
@@ -842,6 +842,20 @@ Onyxia: {
|
||||
'''
|
||||
}
|
||||
|
||||
OmniGun: {
|
||||
DisplayName: The Omnigun
|
||||
Tooltip:
|
||||
'''
|
||||
A flexible weapon, for any occasion
|
||||
The first bullet is a sniper shot that gains damage as it travels and always critically strikes
|
||||
Then, unleashes a volley of 10 rapid rifle shots
|
||||
After which it fires a point blank shotgun spread of bullets with extreme damage
|
||||
Before reloading, the gun fires a powerful grenade that blows up everything, including you
|
||||
'What kind of gun is it?'
|
||||
'Yes'
|
||||
'''
|
||||
}
|
||||
|
||||
OpalStriker: {
|
||||
DisplayName: Opal Striker
|
||||
Tooltip:
|
||||
|
||||
@@ -268,3 +268,6 @@ WaterSpout.DisplayName: Spout
|
||||
WildfireBloomFire.DisplayName: Wildfire Fire
|
||||
WildfireBloomFlare.DisplayName: Wildfire Flare
|
||||
WulfrumScrapBullet.DisplayName: High Speed Scrap
|
||||
OmniSniperShot.DisplayName: Omni Sniper Shot
|
||||
OmniGrenade.DisplayName: Omni Grenade
|
||||
OmniShotgunShot.DisplayName: Omni Shotgun Shot
|
||||
@@ -0,0 +1,107 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class OmniGrenade : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 20;
|
||||
Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.hostile = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.timeLeft = 1800;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.velocity.Y < 25f)
|
||||
Projectile.velocity.Y += 0.3f;
|
||||
int fire = Dust.NewDust(Projectile.position, Projectile.width, (int)(Projectile.height * 0.1f), DustID.Torch, 0f, 0f, 100, default);
|
||||
Main.dust[fire].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[fire].scale = 0.3f;
|
||||
Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item62 with { Volume = 7f }, Projectile.Center);
|
||||
Projectile.ExpandHitboxBy(250);
|
||||
Projectile.Damage();
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Owner.SetScreenshake(3f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Particle center = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 11, 0.95f, Color.OrangeRed * 0.8f, new Vector2(1f, 1f), true, true, glowOpacity: 0.9f);
|
||||
GeneralParticleHandler.SpawnParticle(center);
|
||||
}
|
||||
Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.15f, 21, true);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.8f, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.07f, 21);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing2);
|
||||
Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.1f, 21, true);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing3);
|
||||
Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/RoarPulse", new Vector2(1f, 1f), 0, 0.01f, 0.4f, 15, true);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/SmallBloomRing", new Vector2(1f, 1f), 0, 0.01f, 4f, 15, true, 0.8f);
|
||||
GeneralParticleHandler.SpawnParticle(pulse2);
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * MathHelper.Lerp(10, 30, Main.rand.NextFloat());
|
||||
SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, Main.rand.Next(10, 15), Main.rand.NextFloat(1f, 1.2f), Main.rand.NextBool() ? Color.OrangeRed : Color.Red);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
for (int i = 1; i < 21; i++)
|
||||
{
|
||||
Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(9f, 14f);
|
||||
Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity);
|
||||
spark.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Gold;
|
||||
}
|
||||
for (int j = 0; j < 25; j++)
|
||||
{
|
||||
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[dust2].noGravity = true;
|
||||
Main.dust[dust2].velocity *= 5f;
|
||||
dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[dust2].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers)
|
||||
{
|
||||
modifiers.SourceDamage *= 0f;
|
||||
if (Main.masterMode) modifiers.SourceDamage.Flat += 200f;
|
||||
else if (Main.expertMode) modifiers.SourceDamage.Flat += 150f;
|
||||
else modifiers.SourceDamage.Flat += 100f;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Vector2 position = Projectile.Center - Main.screenPosition;
|
||||
Vector2 origin = texture.Size() * 0.5f;
|
||||
|
||||
Main.EntitySpriteDraw(texture, position, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 259 B |
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Sounds;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class OmniGunHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
|
||||
public static Asset<Texture2D> MuzzleFlash;
|
||||
public override int AssociatedItemID => ModContent.ItemType<OmniGun>();
|
||||
public override float MaxOffsetLengthFromArm => 24f;
|
||||
public override float OffsetXUpwards => -5f;
|
||||
public override float BaseOffsetY => -1f;
|
||||
public override float OffsetYDownwards => 5f;
|
||||
public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 51);
|
||||
|
||||
public int Time = 0;
|
||||
public int shotCounter = 0;
|
||||
public int framesBetweenShots = 0;
|
||||
private float flashVariant;
|
||||
public override void Load()
|
||||
{
|
||||
MuzzleFlash = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/M1GarandMuzzleFlash", AssetRequestMode.ImmediateLoad);
|
||||
}
|
||||
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
//If the player is dead, kill the holdout.
|
||||
if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
//Pause to give the effect of reloading
|
||||
if (Time == 20)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
SoundEngine.PlaySound(SoundID.Item149, Projectile.Center);
|
||||
}
|
||||
if (Time >= 70)
|
||||
{
|
||||
if (framesBetweenShots == 0)
|
||||
{
|
||||
//Here we detect which ammo the bullets will use
|
||||
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
|
||||
#region Sniper Shot
|
||||
if (shotCounter == 0)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
|
||||
#region Visuals and Sounds
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound with { Volume = 0.45f }, Projectile.Center);
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "OmniSniperCasing";
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 6), -Projectile.velocity * 4f, Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
|
||||
}
|
||||
// "Smoke" ring
|
||||
Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4f, Color.Gray * 0.5f, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.475f, 18);
|
||||
GeneralParticleHandler.SpawnParticle(shootPulse);
|
||||
#endregion
|
||||
OffsetLengthFromArm -= 20f;
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType<OmniSniperShot>(), (int)(Projectile.damage * 10f), Projectile.knockBack, Projectile.owner);
|
||||
shotCounter++;
|
||||
framesBetweenShots = 40;
|
||||
}
|
||||
#endregion
|
||||
#region AR Burst
|
||||
if (shotCounter >= 1 && shotCounter <= 10 && framesBetweenShots == 0)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
|
||||
#region Visuals and Sounds
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmallAlt");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = 0.1f}, Projectile.Center);
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "OmniARCasing";
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 9), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
// Direct smoke
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7f * Main.rand.NextFloat(0.4f, 1.5f), Color.Gray, Main.rand.Next(30, 50), Main.rand.NextFloat(0.22f, 0.44f), 0.35f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
|
||||
}
|
||||
#endregion
|
||||
framesBetweenShots = 8;
|
||||
OffsetLengthFromArm -= 3f;
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
shotCounter++;
|
||||
if (shotCounter > 10)
|
||||
framesBetweenShots = 30;
|
||||
}
|
||||
#endregion
|
||||
#region Shotgun Blast
|
||||
if (shotCounter == 11 && framesBetweenShots == 0)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
|
||||
#region Visuals and Sounds
|
||||
SoundStyle FireSound = new("CalamityMod/Sounds/Item/Hydra");
|
||||
SoundEngine.PlaySound(FireSound with { Volume = 0.7f }, Projectile.Center);
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "OmniShotgunShell";
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 9), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
|
||||
}
|
||||
// Direct smoke
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7f * Main.rand.NextFloat(0.4f, 1.5f), Color.Gray, Main.rand.Next(30, 50), Main.rand.NextFloat(0.22f, 0.44f), 0.35f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
// "Smoke" ring
|
||||
Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4f, Color.Gray * 0.5f, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.475f, 18);
|
||||
GeneralParticleHandler.SpawnParticle(shootPulse);
|
||||
#endregion
|
||||
framesBetweenShots = 8;
|
||||
OffsetLengthFromArm -= 20f;
|
||||
Owner.velocity += -Projectile.velocity * 7f;
|
||||
for (int i = 0; i < 8; i++)
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.5f, 1.5f), ModContent.ProjectileType<OmniShotgunShot>(), (int)(Projectile.damage * 3f), Projectile.knockBack, Projectile.owner);
|
||||
shotCounter++;
|
||||
if (shotCounter > 11)
|
||||
framesBetweenShots = 30;
|
||||
}
|
||||
#endregion
|
||||
#region Grenade
|
||||
if (shotCounter == 12 && framesBetweenShots == 0)
|
||||
{
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30;
|
||||
#region Visuals and Sounds
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/LauncherHeavyShot");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.7f, PitchVariance = 0.1f }, Projectile.Center);
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
string goreType = "OmniGrenadeShell";
|
||||
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 6), -Projectile.velocity * 4f, Mod.Find<ModGore>(goreType).Type);
|
||||
}
|
||||
for (int i = 0; i <= 13; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 0.4f), 80, default, Main.rand.NextFloat(0.4f, 1.3f));
|
||||
dust.noGravity = false;
|
||||
dust.color = Color.White;
|
||||
|
||||
Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.5f));
|
||||
dust2.noGravity = true;
|
||||
dust2.scale = Main.rand.NextFloat(0.52f, 0.72f);
|
||||
dust2.color = Color.Lerp(Color.Orange, Color.Gold, Main.rand.NextFloat(0f, 1f));
|
||||
}
|
||||
;
|
||||
#endregion
|
||||
OffsetLengthFromArm -= 24f;
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType<OmniGrenade>(), (int)(Projectile.damage * 10f), Projectile.knockBack, Projectile.owner);
|
||||
|
||||
Time = 0;
|
||||
shotCounter = 0;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
if (framesBetweenShots > 0)
|
||||
framesBetweenShots--;
|
||||
}
|
||||
Time++;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (Time < 2)
|
||||
return false;
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
|
||||
float scale = Projectile.scale * Owner.gravDir;
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
// Flash
|
||||
if (Time == 70 || shotCounter == 11 && framesBetweenShots == 0)
|
||||
{
|
||||
Texture2D flashTex = MuzzleFlash.Value;
|
||||
int flashFrameY = (int)flashVariant;
|
||||
Vector2 flashPos = GunTipPosition + Vector2.UnitX.RotatedBy(Projectile.rotation) * MuzzleFlash.Width() * 0.4f - Main.screenPosition;
|
||||
Rectangle flashFrame = flashTex.Frame(verticalFrames: 3, frameY: flashFrameY);
|
||||
Main.EntitySpriteDraw(flashTex, flashPos, flashFrame, Color.White, drawRotation, flashFrame.Size() * 0.5f, scale * 0.8f, flipSprite);
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, scale, flipSprite);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class OmniShotgunShot : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 4;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 4;
|
||||
Projectile.height = 4;
|
||||
Projectile.light = 0.5f;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.aiStyle = ProjAIStyleID.Arrow;
|
||||
AIType = ProjectileID.BulletHighVelocity;
|
||||
Projectile.extraUpdates = 3;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 15;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
||||
Projectile.ExpandHitboxBy(32);
|
||||
for (int d = 0; d < 2; d++)
|
||||
{
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f);
|
||||
}
|
||||
for (int d = 0; d < 10; d++)
|
||||
{
|
||||
int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 2.5f);
|
||||
Main.dust[idx].noGravity = true;
|
||||
Main.dust[idx].velocity *= 3f;
|
||||
idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1.5f);
|
||||
Main.dust[idx].velocity *= 2f;
|
||||
Main.dust[idx].noGravity = true;
|
||||
}
|
||||
Projectile.maxPenetrate = -1;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 140 B |
@@ -0,0 +1,110 @@
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Sounds;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class OmniSniperShot : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 4;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 0;
|
||||
}
|
||||
|
||||
public const int DoubleDamageTime = 90;
|
||||
public static int Lifetime = 600;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 20;
|
||||
Projectile.height = 6;
|
||||
Projectile.light = 0.5f;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.extraUpdates = 7;
|
||||
Projectile.scale = 1.18f;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.aiStyle = ProjAIStyleID.Arrow;
|
||||
AIType = ProjectileID.BulletHighVelocity;
|
||||
Projectile.penetrate = 5;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Projectile.damage += Projectile.originalDamage / DoubleDamageTime;
|
||||
if (Projectile.timeLeft == Lifetime - 2)
|
||||
{
|
||||
for (int i = 0; i <= 4; i++) //Dragon's Breath shot particles my beloved
|
||||
{
|
||||
Vector2 sparkVelocity = Projectile.velocity * 0.5f;
|
||||
|
||||
float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f);
|
||||
Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.4f, 0.95f);
|
||||
SparkParticle spark1 = new SparkParticle(Projectile.Center, sparkvelocity1, false, 6, sparkScale1, Main.rand.NextBool() ? Color.Goldenrod : Color.DarkGoldenrod);
|
||||
GeneralParticleHandler.SpawnParticle(spark1);
|
||||
|
||||
float sparkScale2 = Main.rand.NextFloat(0.4f, 1f);
|
||||
Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(1.1f, 3.1f);
|
||||
SparkParticle spark2 = new SparkParticle(Projectile.Center, sparkvelocity2, false, 6, sparkScale2, Main.rand.NextBool() ? Color.Goldenrod : Color.DarkGoldenrod);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
if (Projectile.timeLeft < Lifetime - 3 && Projectile.timeLeft > Lifetime - 150)
|
||||
{
|
||||
SparkParticle spark = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 9, 1.2f, Color.Coral * 0.3f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height);
|
||||
SoundEngine.PlaySound(SoundID.Dig, Projectile.Center);
|
||||
return true;
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
for (int i = 0; i <= 6; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 158 : 55, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f));
|
||||
dust.noGravity = true;
|
||||
dust.fadeIn = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
//Always critically strikes
|
||||
modifiers.SetCrit();
|
||||
for (int i = 0; i <= 2; i++)
|
||||
{
|
||||
LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Gold);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Gold);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
|
||||
for (int i = 0; i <= 3; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 158 : 55, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f));
|
||||
dust.noGravity = true;
|
||||
dust.fadeIn = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 153 B |