revised meowthrower :3

This commit is contained in:
Altixal committed 2023-10-16 01:57:37 +07:00
1 parent 37f7bcee9b
commit 567bcfa918
7 files changed
+103 -27

No files matched your search

+17 -4
View File
@@ -11,6 +11,8 @@ namespace CalamityMod.Items.Weapons.Ranged
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public int CatCounter = 0;
public override void SetDefaults()
{
Item.damage = 37;
@@ -18,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.width = 74;
Item.height = 24;
Item.useTime = 8;
Item.useAnimation = 8;
Item.useAnimation = 32;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 1.25f;
@@ -29,17 +31,28 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.shoot = ModContent.ProjectileType<MeowFire>();
Item.shootSpeed = 8f;
Item.useAmmo = AmmoID.Gel;
Item.consumeAmmoOnFirstShotOnly = true;
}
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 85;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
// Fires a homing cat... thing
CatCounter++;
if (CatCounter >= 4)
{
CatCounter = 0;
// They prefer to avoid the smokes
Vector2 newPos = position + velocity.SafeNormalize(Vector2.UnitX) * 38f;
Vector2 newVel = velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(6f, 15f) * Main.rand.NextBool().ToDirectionInt())) * 1.5f;
Projectile.NewProjectile(source, newPos, newVel, ModContent.ProjectileType<MeowCreature>(), damage, knockback, player.whoAmI);
}
// Fires two flames, blue and pink, slightly randomly spread
for (int i = 0; i < 2; i++)
{
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(8f));
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(6f));
Projectile.NewProjectile(source, position, newVel, type, damage, knockback, player.whoAmI, i);
}
return false;
@@ -710,9 +710,9 @@ Meowthrower: {
DisplayName: Meowthrower
Tooltip:
'''
Fires blue and pink flames that emit meows on enemy hits
Purrifies your foes with pink and blue smokes
Occasionally unleashes homing feline creatures
Uses gel for ammo
85% chance to save ammo
'''
}
@@ -55,6 +55,7 @@ CorossiveFlames.DisplayName: Plagued Flames
CorrodedShell.DisplayName: Corroded Shell
CosmicFire.DisplayName: Dead Sun's Fire
DaemonsFlameArrow.DisplayName: Daemon's Arrow
DeadSunExplosion.DisplayName: Dead Sun's Explosion
DragonsBreathRound.DisplayName: Dragon's Breath Round
DrataliornusExoArrow.DisplayName: Drataliornus Arrow
DrataliornusFlame.DisplayName: Drataliornus Arrow
@@ -118,6 +119,7 @@ MagnomalyExplosion.DisplayName: Explosion
MagnomalyRocket.DisplayName: Nuke
MarksmanShot.DisplayName: Marksman Shot
MechanicalBarracuda.DisplayName: Barracuda
MeowCreature.DisplayName: the creature :3
MeowFire.DisplayName: Purr Fire
MiniatureFolly.DisplayName: Miniature Folly
MiniRocket.DisplayName: Rocket
@@ -236,4 +238,3 @@ Voidragon.DisplayName: Voidragon Blast
VoidragonTentacle.DisplayName: Voidragon Tentacle
WaterSpout.DisplayName: Spout
WulfrumScrapBullet.DisplayName: High Speed Scrap
DeadSunExplosion.DisplayName: Dead Sun Explosion
+1 -1
View File
@@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.timeLeft = 180;
}
public override void AI()
+76
View File
@@ -0,0 +1,76 @@
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Linq;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class MeowCreature : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public static int Lifetime => 180;
internal PrimitiveTrail TrailDrawer;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 24;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.MaxUpdates = 2;
Projectile.timeLeft = Lifetime;
Projectile.DamageType = DamageClass.Ranged;
}
public override void AI()
{
CalamityUtils.HomeInOnNPC(Projectile, false, 480f, 16f, 20f);
Projectile.rotation = Projectile.velocity.ToRotation();
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(Main.rand.NextBool() ? SoundID.Item58 : SoundID.Item57, Projectile.Center);
// Circular spread of clouds
for (int i = 0; i < 12; i++)
{
Vector2 smokeVel = Main.rand.NextVector2Circular(16f, 16f);
Color smokeColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f);
Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.6f, 1.6f), 220 - Main.rand.Next(60), 0.1f);
GeneralParticleHandler.SpawnParticle(smoke);
}
}
internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 10f;
internal Color ColorFunction(float completionRatio)
{
float hue = completionRatio * Projectile.timeLeft / (float)Lifetime;
Color trailColor = Main.hslToRgb(hue, 1f, 0.8f);
return trailColor * Projectile.Opacity;
}
// The creature glows
public override void PostDraw(Color lightColor)
{
if (TrailDrawer is null)
TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction);
TrailDrawer.Draw(Projectile.oldPos.Where(oldPos => oldPos != Vector2.Zero), Projectile.Size * 0.5f - Main.screenPosition, 30);
Texture2D glow = ModContent.Request<Texture2D>(Texture).Value;
Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

+5 -19
View File
@@ -42,15 +42,15 @@ namespace CalamityMod.Projectiles.Ranged
// Main smokes composing of blue or pink
float smokeRot = MathHelper.ToRadians(3f); // *Rate of rotation per frame, not a constant rotation
Color smokeColor = Color.Lerp(PinkFire ? Color.DeepPink : Color.DodgerBlue, PinkFire ? Color.Pink : Color.PowderBlue, 0.4f + 0.3f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f));
Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.8f, smokeRot, required: true);
Color smokeColor = Color.Lerp(PinkFire ? Color.DeepPink : Color.DodgerBlue, PinkFire ? Color.Pink : Color.PowderBlue, 0.5f + 0.3f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f));
Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.25f, smokeRot, true, required: true);
GeneralParticleHandler.SpawnParticle(smoke);
// Overlay the glow on top, a bit brighter
if (Main.rand.NextBool(5))
if (Main.rand.NextBool(8))
{
Color glowColor = Color.Lerp(smokeColor, Color.White, 0.4f);
Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, glowColor, 9, Projectile.scale * Main.rand.NextFloat(0.4f, 0.7f), 0.8f, smokeRot, true, 0.005f, true);
Color glowColor = Color.Lerp(smokeColor, Color.White, 0.2f);
Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, glowColor, 8, Projectile.scale * Main.rand.NextFloat(0.4f, 0.7f), 0.15f, smokeRot, true, 0.005f, true);
GeneralParticleHandler.SpawnParticle(smokeGlow);
}
@@ -59,19 +59,5 @@ namespace CalamityMod.Projectiles.Ranged
// Circular hitbox adjusted for the size of the smoke particles (which is 52 here)
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 52 * Projectile.scale * 0.5f, targetHitbox);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
SoundEngine.PlaySound(PinkFire ? SoundID.Item58 : SoundID.Item57, Projectile.Center);
// Circular spread of clouds on hit
for (int i = 0; i < 12; i++)
{
Vector2 smokeVel = Main.rand.NextVector2Circular(16f, 16f);
Color smokeColor = PinkFire ? Color.Pink : Color.PowderBlue;
Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.6f, 1.6f), 200 - Main.rand.Next(60), 0.1f);
GeneralParticleHandler.SpawnParticle(smoke);
}
}
}
}