tweaks and more tweaks. urchin flail dies
This commit is contained in:
1 parent
75dee63b9b
commit
607745f393
23 files changed
+140
-359
No files matched your search
@@ -2038,8 +2038,6 @@ namespace CalamityMod
|
||||
ProjectileType<TaserHook>(),
|
||||
ProjectileType<Teslabeam>(),
|
||||
ProjectileType<TyphonsGreedStaff>(),
|
||||
ProjectileType<UrchinBall>(),
|
||||
ProjectileType<UrchinBallSpike>(),
|
||||
ProjectileType<UrchinMaceProjectile>(),
|
||||
ProjectileType<UrchinStingerProj>(),
|
||||
ProjectileType<ViolenceThrownProjectile>(),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Projectiles.Melee.MaceFlails;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -8,12 +9,15 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public class BallOFugu : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
|
||||
public static readonly SoundStyle BlowSound = new("CalamityMod/Sounds/Item/FuguBlow") { PitchVariance = 0.1f };
|
||||
|
||||
public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 30;
|
||||
Item.height = 10;
|
||||
Item.damage = 40;
|
||||
Item.damage = 28;
|
||||
Item.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Item.useTime = 20;
|
||||
Item.useAnimation = 20;
|
||||
|
||||
@@ -53,7 +53,6 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
AddIngredient(ItemID.Flairon).
|
||||
AddIngredient<BallOFugu>().
|
||||
AddIngredient<Tumbleweed>().
|
||||
AddIngredient<UrchinFlail>().
|
||||
AddIngredient<YharonSoulFragment>(4).
|
||||
AddIngredient<AuricBar>(5).
|
||||
AddTile<CosmicAnvil>().
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class UrchinFlail : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 44;
|
||||
Item.height = 36;
|
||||
Item.damage = 20;
|
||||
Item.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Item.useTime = 25;
|
||||
Item.useAnimation = 25;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.knockBack = 6f;
|
||||
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.autoReuse = true;
|
||||
Item.channel = true;
|
||||
Item.shoot = ModContent.ProjectileType<UrchinBall>();
|
||||
Item.shootSpeed = 16f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 744 B |
@@ -7,7 +7,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
[LegacyName("RedtideSword")]
|
||||
[LegacyName("RedtideSword", "UrchinFlail")]
|
||||
public class UrchinMace : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
|
||||
@@ -17,13 +17,14 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
|
||||
// Flail already does half damage. No tooltip mutliplier required.
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 42;
|
||||
Item.height = 62;
|
||||
Item.damage = 30; // Spear is 20 damage, Flail is 30 damage
|
||||
Item.damage = 30;
|
||||
Item.knockBack = 5f;
|
||||
Item.useAnimation = Item.useTime = 22;
|
||||
|
||||
@@ -75,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
float speedMult = SpearSpeed / ShootSpeed;
|
||||
if (player.altFunctionUse == 2)
|
||||
Projectile.NewProjectile(source, position, velocity * speedMult, ModContent.ProjectileType<YateveoBloomSpear>(), (int)(damage * 0.666666f), knockback, player.whoAmI);
|
||||
Projectile.NewProjectile(source, position, velocity * speedMult, ModContent.ProjectileType<YateveoBloomSpear>(), damage, knockback, player.whoAmI);
|
||||
else
|
||||
Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.5f), knockback, player.whoAmI);
|
||||
return false;
|
||||
|
||||
@@ -288,8 +288,6 @@ TruePurityProjection.DisplayName: Purity Projection
|
||||
TumbleweedRolling.DisplayName: Rolling Tumbleweed
|
||||
TyphonsGreedBubble.DisplayName: Typhon's Greed
|
||||
UltimusCleaverDust.DisplayName: Ultimus Flame
|
||||
UrchinBall.DisplayName: Urchin Ball
|
||||
UrchinBallSpike.DisplayName: Urchin Ball Spike
|
||||
UrchinMaceProjectile.DisplayName: Urchin Mace
|
||||
UrchinSpikeFugu.DisplayName: Urchin Spike
|
||||
VirulentBeeWave.DisplayName: Virulent Bee Wave
|
||||
|
||||
@@ -206,7 +206,6 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
.Add(ModContent.ItemType<SandDollar>())
|
||||
.Add(ModContent.ItemType<Waywasher>())
|
||||
.Add(ModContent.ItemType<CoralCannon>())
|
||||
.Add(ModContent.ItemType<UrchinFlail>())
|
||||
.Add(ModContent.ItemType<AmidiasTrident>())
|
||||
.Add(ModContent.ItemType<EnchantedConch>())
|
||||
.Add(ModContent.ItemType<PolypLauncher>())
|
||||
|
||||
@@ -15,8 +15,32 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
public abstract class BaseMaceFlailProjectile : ModProjectile
|
||||
{
|
||||
public abstract int AssociatedItemID { get; }
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetItemName(AssociatedItemID);
|
||||
|
||||
// The following can also be used in each individual projectile class, without the need to re-define:
|
||||
#region Utilities
|
||||
public enum FlailState
|
||||
{
|
||||
Spinning = 0,
|
||||
LaunchingForward = 1,
|
||||
Retracting = 2,
|
||||
ForcedRetracting = 4,
|
||||
Ricochet = 5,
|
||||
Dropping = 6
|
||||
}
|
||||
|
||||
public FlailState CurrentFlailState
|
||||
{
|
||||
get => (FlailState)Projectile.ai[0];
|
||||
set => Projectile.ai[0] = (float)value;
|
||||
}
|
||||
public ref float StateTimer => ref Projectile.ai[1];
|
||||
public ref float CollisionCounter => ref Projectile.localAI[0];
|
||||
// ai[2] and localAI[1] are completely open for additional gimmicks.
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
#endregion
|
||||
|
||||
// Core properties of the mace's function.
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Local immunity frames granted while dropped or retracted<br/>
|
||||
@@ -103,15 +127,15 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
|
||||
/// <summary>
|
||||
/// Max speed when retracted, affected by attack speed.<br/>
|
||||
/// Defaults to 14f.
|
||||
/// Defaults to 15f.
|
||||
/// </summary>
|
||||
public virtual float MaxRetractSpeed { get; set; } = 14f;
|
||||
public virtual float MaxRetractSpeed { get; set; } = 15f;
|
||||
|
||||
/// <summary>
|
||||
/// Acceleration when retracted, affected by attack speed.<br/>
|
||||
/// Defaults to 2f.
|
||||
/// Defaults to 2.5f.
|
||||
/// </summary>
|
||||
public virtual float RetractAcceleration { get; set; } = 2f;
|
||||
public virtual float RetractAcceleration { get; set; } = 2.5f;
|
||||
#endregion
|
||||
|
||||
// Most of these should be kept default for consistency with vanilla maces.
|
||||
@@ -149,6 +173,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
public virtual float DropKnockback => 0.5f;
|
||||
#endregion
|
||||
|
||||
// Methods for most individual behaviour steps which can be useful to override.
|
||||
#region Overridable Methods
|
||||
/// <summary>
|
||||
/// Scales every value that should be affected by melee speed.<br/>
|
||||
@@ -162,6 +187,25 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
acceleration *= meleeSpeedMultiplier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the damage and knockback multiplier based on the current behaviour.<br/>
|
||||
/// Can be overridden to include any extra stat adjustments.
|
||||
/// </summary>
|
||||
public virtual void UpdateDamageKB(out float damageMult, out float kbMult)
|
||||
{
|
||||
damageMult = 1f;
|
||||
kbMult = 1f;
|
||||
if (CurrentFlailState == FlailState.Spinning)
|
||||
{
|
||||
damageMult = SpinDamage;
|
||||
kbMult = SpinKnockback;
|
||||
}
|
||||
else if (CurrentFlailState == FlailState.LaunchingForward || CurrentFlailState == FlailState.Retracting)
|
||||
damageMult = LaunchDamage;
|
||||
else if (CurrentFlailState == FlailState.Dropping)
|
||||
kbMult = DropKnockback;
|
||||
}
|
||||
|
||||
public virtual void SpinAI(float launchSpeed)
|
||||
{
|
||||
Projectile.ownerHitCheck = true;
|
||||
@@ -318,26 +362,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
}
|
||||
#endregion
|
||||
|
||||
public enum FlailState
|
||||
{
|
||||
Spinning = 0,
|
||||
LaunchingForward = 1,
|
||||
Retracting = 2,
|
||||
ForcedRetracting = 4,
|
||||
Ricochet = 5,
|
||||
Dropping = 6
|
||||
}
|
||||
|
||||
// These properties wrap the usual ai and localAI arrays for cleaner and easier to understand code.
|
||||
public FlailState CurrentFlailState
|
||||
{
|
||||
get => (FlailState)Projectile.ai[0];
|
||||
set => Projectile.ai[0] = (float)value;
|
||||
}
|
||||
public ref float StateTimer => ref Projectile.ai[1];
|
||||
public ref float CollisionCounter => ref Projectile.localAI[0];
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
#region Hook Overrides
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetItemName(AssociatedItemID);
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -504,15 +530,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (CurrentFlailState == FlailState.Spinning)
|
||||
modifiers.SourceDamage *= SpinDamage;
|
||||
else if (CurrentFlailState == FlailState.LaunchingForward || CurrentFlailState == FlailState.Retracting)
|
||||
modifiers.SourceDamage *= LaunchDamage;
|
||||
|
||||
if (CurrentFlailState == FlailState.Spinning)
|
||||
modifiers.Knockback *= SpinKnockback;
|
||||
else if (CurrentFlailState == FlailState.Dropping)
|
||||
modifiers.Knockback *= DropKnockback;
|
||||
UpdateDamageKB(out float damageMult, out float kbMult);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
modifiers.Knockback *= kbMult;
|
||||
|
||||
modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt();
|
||||
}
|
||||
@@ -539,5 +559,6 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,13 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
public class BallOFuguProj : BaseMaceFlailProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<BallOFugu>();
|
||||
public override int LaunchLifespan => 25;
|
||||
public override float SpinHitboxRadius => 66f;
|
||||
public override float SpinVisualRadius => 36f;
|
||||
public override float LaunchSpeed => 20f;
|
||||
public override int LaunchLifespan => 20;
|
||||
public override float MaxDropRange => 640f;
|
||||
public override float MaxRetractSpeed => 24f;
|
||||
public override float RetractAcceleration => 3.6f;
|
||||
|
||||
public static float MaxSpikeTime = 180f;
|
||||
public static float SpikeRate = 10f;
|
||||
@@ -39,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
if (Projectile.owner == Main.myPlayer && SpikeTimer > MaxSpikeTime && SpikeTimer % SpikeRate == 0f)
|
||||
{
|
||||
Vector2 velocity = Projectile.DirectionFrom(Owner.MountedCenter).SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(4.5f, 6.5f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<UrchinSpikeFugu>(), (int)(Projectile.damage * SpikeDamage), Projectile.knockBack * SpikeKnockback, Projectile.owner, -10f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<UrchinSpikeFugu>(), (int)(Projectile.damage * SpikeDamage), Projectile.knockBack * SpikeKnockback, Projectile.owner);
|
||||
}
|
||||
base.SpinAI(launchSpeed);
|
||||
}
|
||||
@@ -49,9 +54,13 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
int SpikeCount = (int)(MathHelper.Clamp(SpikeTimer, 0f, MaxSpikeTime) / SpikeRate);
|
||||
for (int i = 0; i < SpikeCount; i++)
|
||||
{
|
||||
Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(3.5f, 5f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<UrchinSpikeFugu>(), (int)(Projectile.damage * SpikeDamage), Projectile.knockBack * SpikeKnockback, Projectile.owner, -10f);
|
||||
Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(6f, 7.2f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<UrchinSpikeFugu>(), (int)(Projectile.damage * SpikeDamage), Projectile.knockBack * SpikeKnockback, Projectile.owner);
|
||||
}
|
||||
|
||||
if (SpikeCount > 0)
|
||||
SoundEngine.PlaySound(BallOFugu.BlowSound, Projectile.Center);
|
||||
|
||||
SpikeTimer = 0f;
|
||||
Projectile.netUpdate = true;
|
||||
};
|
||||
|
||||
@@ -12,12 +12,15 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
public class RemsRevengeProj : BaseMaceFlailProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<RemsRevenge>();
|
||||
public override float SpinHitboxRadius => 80f;
|
||||
public override float SpinVisualRadius => 48f;
|
||||
public override float LaunchSpeed => 24f;
|
||||
public override int LaunchLifespan => 30;
|
||||
public override int SpinIFrames => 12;
|
||||
public override float SpinSpeed => 16f;
|
||||
public override float SpinHitboxRadius => 96f;
|
||||
public override float SpinVisualRadius => 64f;
|
||||
public override int AfterimageLength => 8;
|
||||
public override float LaunchSpeed => 30f;
|
||||
public override int LaunchLifespan => 24;
|
||||
public override float MaxDropRange => 960f;
|
||||
public override float MaxRetractSpeed => 27f;
|
||||
public override float MaxRetractSpeed => 36f;
|
||||
public override float RetractAcceleration => 4.5f;
|
||||
|
||||
public ref float LaunchedHitCounter => ref Projectile.ai[2];
|
||||
@@ -32,12 +35,14 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<WitherDebuff>(), 240);
|
||||
|
||||
if (CurrentFlailState != FlailState.Spinning)
|
||||
if (CurrentFlailState != FlailState.Spinning && CurrentFlailState != FlailState.Dropping)
|
||||
LaunchedHitCounter++;
|
||||
|
||||
if (LaunchedHitCounter < 6f)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType<RemsRevengeExplosion>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
if (LaunchedHitCounter > 3f)
|
||||
// While spinning, the projectile center won't always be where the target is, so it needs to be moved
|
||||
UpdateDamageKB(out float damageMult, out float kbMult);
|
||||
if (LaunchedHitCounter <= 5f)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), CurrentFlailState == FlailState.Spinning ? target.Center : Projectile.Center, Vector2.Zero, ModContent.ProjectileType<RemsRevengeExplosion>(), (int)(Projectile.damage * damageMult), Projectile.knockBack * kbMult, Projectile.owner);
|
||||
if (LaunchedHitCounter >= 4f)
|
||||
{
|
||||
CurrentFlailState = FlailState.ForcedRetracting;
|
||||
StateTimer = 0f;
|
||||
|
||||
@@ -19,14 +19,14 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<Tumbleweed>();
|
||||
public override int SpinIFrames => 10;
|
||||
public override float SpinHitboxRadius => 70f + 160f * AuraScale;
|
||||
public override float SpinHitboxRadius => MathF.Max(64f, 224f * AuraScale);
|
||||
public override float SpinVerticalFactor => 1f; // The aura is fully circular, rather than elliptical
|
||||
public override float SpinVisualRadius => 45f;
|
||||
public override float LaunchSpeed => 20f;
|
||||
public override float LaunchSpeed => 24f;
|
||||
public override int LaunchLifespan => 20;
|
||||
public override float MaxDropRange => 640f;
|
||||
public override float MaxRetractSpeed => 24f;
|
||||
public override float RetractAcceleration => 3.6f;
|
||||
public override float MaxRetractSpeed => 28f;
|
||||
public override float RetractAcceleration => 4f;
|
||||
|
||||
public static float MaxAuraTime = 60f;
|
||||
|
||||
@@ -40,6 +40,13 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
if (CurrentFlailState != FlailState.Spinning || Main.rand.NextBool())
|
||||
{
|
||||
Dust sand = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, Alpha: 100, Scale: Main.rand.NextFloat(0.6f, 1.2f));
|
||||
sand.noGravity = CurrentFlailState == FlailState.Dropping;
|
||||
sand.velocity = CurrentFlailState == FlailState.Spinning ? Main.rand.NextVector2Unit() * 1.5f : Projectile.velocity * 0.25f;
|
||||
}
|
||||
|
||||
if (CurrentFlailState == FlailState.Spinning)
|
||||
{
|
||||
Projectile.ownerHitCheck = false; // Dust aura can hit through walls
|
||||
@@ -83,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if (CurrentFlailState != FlailState.LaunchingForward && CurrentFlailState != FlailState.Dropping && CurrentFlailState != FlailState.Ricochet)
|
||||
if (CurrentFlailState == FlailState.Spinning)
|
||||
return;
|
||||
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.Center);
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/MaceFlails/TumbleweedFlail";
|
||||
|
||||
public static int Lifetime = 180;
|
||||
public static int Rolltime = 45; // How long it remains gravity-defiant if it doesn't hit tiles
|
||||
public static int Lifetime = 120;
|
||||
public static int Rolltime = 30; // How long it remains gravity-defiant if it doesn't hit tiles
|
||||
|
||||
public ref float RollState => ref Projectile.ai[0]; // 1f: falling
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Projectile.width = Projectile.height = 42;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 8;
|
||||
Projectile.penetrate = 6;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 20;
|
||||
Projectile.localNPCHitCooldown = 15;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
|
||||
@@ -1,150 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class UrchinBall : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public bool spike = false;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 34;
|
||||
Projectile.height = 34;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 3;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
Vector2 projDirection = player.Center - Projectile.Center;
|
||||
Projectile.rotation = projDirection.ToRotation() - MathHelper.PiOver2;
|
||||
if (player.dead)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
player.itemAnimation = 10;
|
||||
player.itemTime = 10;
|
||||
if (projDirection.X < 0f)
|
||||
{
|
||||
player.ChangeDir(1);
|
||||
Projectile.direction = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ChangeDir(-1);
|
||||
Projectile.direction = -1;
|
||||
}
|
||||
player.itemRotation = (projDirection * -1f * (float)Projectile.direction).ToRotation();
|
||||
Projectile.spriteDirection = (projDirection.X > 0f) ? -1 : 1;
|
||||
if (Projectile.ai[0] == 0f && projDirection.Length() > 400f)
|
||||
{
|
||||
Projectile.ai[0] = 1f;
|
||||
}
|
||||
if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f)
|
||||
{
|
||||
if (spike)
|
||||
{
|
||||
spike = false;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType<UrchinBallSpike>(), (int)((double)Projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f);
|
||||
}
|
||||
Projectile.usesLocalNPCImmunity = false;
|
||||
float projDistance = projDirection.Length();
|
||||
if (projDistance > 1500f)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
if (projDistance > 600f)
|
||||
{
|
||||
Projectile.ai[0] = 2f;
|
||||
}
|
||||
Projectile.tileCollide = false;
|
||||
float returnLength = 20f;
|
||||
if (Projectile.ai[0] == 2f)
|
||||
{
|
||||
returnLength = 40f;
|
||||
}
|
||||
Projectile.velocity = Vector2.Normalize(projDirection) * returnLength;
|
||||
if (projDirection.Length() < returnLength)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Projectile.ai[1] += 1f;
|
||||
if (Projectile.ai[1] > 5f)
|
||||
{
|
||||
Projectile.alpha = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
|
||||
Projectile.ai[0] = 1f;
|
||||
Projectile.netUpdate = true;
|
||||
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter;
|
||||
Texture2D texture2D2 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/UrchinFlailChain").Value;
|
||||
Vector2 projCenter = Projectile.Center;
|
||||
Rectangle? sourceRectangle = null;
|
||||
Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f);
|
||||
float projHeight = (float)texture2D2.Height;
|
||||
Vector2 actualCenter = mountedCenter - projCenter;
|
||||
float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2;
|
||||
bool isActive = true;
|
||||
if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y))
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y))
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
while (isActive)
|
||||
{
|
||||
if (actualCenter.Length() < projHeight + 1f)
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 centerCopy = actualCenter;
|
||||
centerCopy.Normalize();
|
||||
projCenter += centerCopy * projHeight;
|
||||
actualCenter = mountedCenter - projCenter;
|
||||
Color drawArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f));
|
||||
Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, drawArea, projRotation, origin, 1f, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
spike = true;
|
||||
Projectile.ai[0] = 1f;
|
||||
Projectile.netUpdate = true;
|
||||
target.AddBuff(BuffID.Poisoned, 180);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 589 B |
@@ -1,70 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class UrchinBallSpike : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 6;
|
||||
Projectile.height = 6;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Projectile.penetrate = -1;
|
||||
AIType = ProjectileID.BoneJavelin;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.ai[0] == 0f)
|
||||
{
|
||||
Projectile.velocity.X = Projectile.velocity.X * 0.99f;
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.15f;
|
||||
Projectile.rotation += 0.4f * (float)Projectile.direction;
|
||||
Projectile.spriteDirection = Projectile.direction;
|
||||
}
|
||||
//Sticky Behaviour
|
||||
Projectile.StickyProjAI(6);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(6);
|
||||
public override bool? CanDamage() => Projectile.ai[0] == 1f ? false : base.CanDamage();
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
if (targetHitbox.Width > 8 && targetHitbox.Height > 8)
|
||||
{
|
||||
targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
|
||||
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
|
||||
Projectile.width = 13;
|
||||
Projectile.height = 20;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
int urchin = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 0, new Color(0, 255, 255), 1f);
|
||||
Main.dust[urchin].noGravity = true;
|
||||
Main.dust[urchin].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Poisoned, 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 174 B |
Binary file not shown.
|
Before Width: | Height: | Size: 161 B |
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -9,6 +12,15 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public class UrchinSpikeFugu : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 6;
|
||||
@@ -23,50 +35,30 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Lionfish: ai[1] is 1 (unused)
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if (Projectile.ai[0] == 0f)
|
||||
{
|
||||
float maxRange = 256f;
|
||||
int npcIndex = -1;
|
||||
foreach (NPC npc in Main.ActiveNPCs)
|
||||
{
|
||||
if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height))
|
||||
{
|
||||
float targetDist = (npc.Center - Projectile.Center).Length();
|
||||
if (targetDist < maxRange)
|
||||
{
|
||||
npcIndex = npc.whoAmI;
|
||||
maxRange = targetDist;
|
||||
}
|
||||
}
|
||||
}
|
||||
Projectile.ai[0] = (float)(npcIndex + 1);
|
||||
if (Projectile.ai[0] == 0f)
|
||||
{
|
||||
Projectile.ai[0] = -15f;
|
||||
}
|
||||
if (Projectile.ai[0] > 0f)
|
||||
{
|
||||
Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(Main.npc[(int)Projectile.ai[0] - 1].Center) * 4f) / 21f;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
else if (Projectile.ai[0] > 0f)
|
||||
Projectile.velocity = (Projectile.velocity * 40f + Projectile.SafeDirectionTo(Main.npc[(int)Projectile.ai[0] - 1].Center) * 12f) / 41f;
|
||||
else
|
||||
{
|
||||
Projectile.ai[0]++;
|
||||
Projectile.alpha -= 25;
|
||||
if (Projectile.alpha < 0)
|
||||
Projectile.alpha = 0;
|
||||
Time++;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Projectile.alpha = (int)Utils.Remap(Time, 0f, 12f, 255f, 0f);
|
||||
|
||||
Projectile.velocity.Y += 0.015f;
|
||||
NPC potentialTarget = Projectile.Center.ClosestNPCAt(256f);
|
||||
if (potentialTarget != null && Time >= 12f)
|
||||
{
|
||||
Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 12f;
|
||||
Projectile.velocity = (Projectile.velocity * 20f + idealVelocity) / 21f;
|
||||
Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 120);
|
||||
|
||||
public override bool? CanDamage() => Projectile.ai[0] < 0f ? false : base.CanDamage();
|
||||
public override bool? CanDamage() => Time < 12f ? false : base.CanDamage();
|
||||
|
||||
internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 4f;
|
||||
internal Color ColorFunction(float completionRatio) => new Color(91, 62, 153) * Projectile.Opacity;
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/FabstaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 8);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 114 B |
@@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Vector2 velocity = Projectile.DirectionFrom(Main.player[Projectile.owner].Center);
|
||||
velocity *= Main.rand.NextFloat(4.5f, 6.5f);
|
||||
velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * Math.PI * 0.5, default);
|
||||
int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<UrchinSpikeFugu>(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, -10f, 1f);
|
||||
int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<UrchinSpikeFugu>(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner);
|
||||
if (spike.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[spike].DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user