After thought, removed Triploon from this branch
It was outside the scope of the revised Elemental Saw plans, and I originally only added it to this branch because I was still under the impression that it was going into Elemental Saw. I have made a local branch with all of Triploon's code in case we decide we still to revive it in the future.
This commit is contained in:
1 parent
96f1be960d
commit
076181c8de
6 files changed
-296
No files matched your search
@@ -1,53 +0,0 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
public class Triploon : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 88;
|
||||
Item.height = 48;
|
||||
Item.damage = 50;
|
||||
Item.useTime = 30;
|
||||
Item.useAnimation = 30;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.channel = true;
|
||||
Item.knockBack = 1f;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.shoot = ModContent.ProjectileType<TriploonHoldout>();
|
||||
Item.shootSpeed = 14f;
|
||||
}
|
||||
|
||||
public override bool CanShoot(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.Harpoon, 3).
|
||||
AddIngredient<DepthCells>(15).
|
||||
AddIngredient<Lumenyl>(15).
|
||||
AddIngredient<PlantyMush>(5).
|
||||
AddTile(TileID.MythrilAnvil).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB |
@@ -234,7 +234,6 @@ TorrentialArrow.DisplayName: Torrential Arrow
|
||||
ToxicannonDrop.DisplayName: Toxic Acid
|
||||
ToxicannonShot.DisplayName: Toxic Shot
|
||||
ToxicArrow.DisplayName: Toxic Arrow
|
||||
TriploonSpear.DisplayName: Super Deadly Harpoon
|
||||
TyphoonArrow.DisplayName: Typhoon Arrow
|
||||
TyphoonBubble.DisplayName: Typhoon
|
||||
UltimaBolt.DisplayName: Ultima Bolt
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class TriploonHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<Triploon>();
|
||||
public override Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.38f - Vector2.UnitY.RotatedBy(Projectile.rotation) * 3f;
|
||||
public override float MaxOffsetLengthFromArm => 25f;
|
||||
public override float OffsetXUpwards => -7f;
|
||||
public override float OffsetXDownwards => 2f;
|
||||
public override float BaseOffsetY => -8f;
|
||||
public override float OffsetYUpwards => -3f;
|
||||
public override float OffsetYDownwards => 7f;
|
||||
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
base.SetDefaults();
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
if (HeldItem.type != Owner.ActiveItem().type)
|
||||
{
|
||||
Projectile.Kill();
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
Time++;
|
||||
|
||||
if (Owner.CantUseHoldout())
|
||||
{
|
||||
// Set the spears to return if the weapon is not being used
|
||||
for (int proj = 0; proj < Main.maxProjectiles; proj++)
|
||||
{
|
||||
var projectile = Main.projectile[proj];
|
||||
if (!projectile.active)
|
||||
continue;
|
||||
|
||||
// We don't wanna make ALL spears return, because multiplayer certainly does exist!
|
||||
if (projectile.type == ModContent.ProjectileType<TriploonSpear>() && projectile.owner == Main.myPlayer)
|
||||
projectile.ai[2] = 1f;
|
||||
}
|
||||
|
||||
// The holdout is only killed once all the spears return
|
||||
if (Owner.ownedProjectileCounts[ModContent.ProjectileType<TriploonSpear>()] <= 0)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
if (Time == 30f)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot, GunTipPosition);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
// This offsets the side spears so that they're not just stacked on top of each other
|
||||
float offsetMult = i * 1.5f - 1.5f;
|
||||
Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * Owner.ActiveItem().shootSpeed;
|
||||
Vector2 offset = velocity.RotatedBy(MathHelper.Pi / 10 * offsetMult);
|
||||
|
||||
// The initial ai0 value is used to offset when each spear hits
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition + offset, velocity, ModContent.ProjectileType<TriploonSpear>(), Projectile.damage, Projectile.knockBack, Main.myPlayer, i * 5f - 5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class TriploonSpear : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
|
||||
public int TimeLeft = 1200;
|
||||
public bool HasDealtRipOutDamage = false;
|
||||
public ref float Returning => ref Projectile.ai[2]; // If this equals 1f, it's returning. This is a float referencing ai2 instead of a bool because I change it in the holdout
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 44;
|
||||
Projectile.height = 14;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = TimeLeft;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 30;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Vector2 ownerDist = Main.player[Projectile.owner].Center - Projectile.Center;
|
||||
|
||||
// Set the initial hit delay offset
|
||||
if (Projectile.ai[0] > 1f)
|
||||
{
|
||||
Projectile.localNPCHitCooldown += (int)Projectile.ai[0];
|
||||
Projectile.ai[0] = 0f;
|
||||
}
|
||||
|
||||
if (Returning == 1f) // Returning
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi;
|
||||
Projectile.usesIDStaticNPCImmunity = true; // Abuse of iframe shenanigans to make sure it consistently hits when ripping out
|
||||
Projectile.idStaticNPCHitCooldown = 1;
|
||||
|
||||
float returnSpeed = 22f;
|
||||
if (ownerDist.Length() > 3000f)
|
||||
Projectile.Kill();
|
||||
|
||||
ownerDist.Normalize();
|
||||
ownerDist *= returnSpeed;
|
||||
|
||||
// Home back in on owner
|
||||
if (Projectile.velocity.X < ownerDist.X)
|
||||
Projectile.velocity.X = ownerDist.X;
|
||||
else if (Projectile.velocity.X > ownerDist.X)
|
||||
Projectile.velocity.X = ownerDist.X;
|
||||
|
||||
if (Projectile.velocity.Y < ownerDist.Y)
|
||||
Projectile.velocity.Y = ownerDist.Y;
|
||||
else if (Projectile.velocity.Y > ownerDist.Y)
|
||||
Projectile.velocity.Y = ownerDist.Y;
|
||||
|
||||
// Delete the harpoon if it touches its owner
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
if (Projectile.Hitbox.Intersects(Main.player[Projectile.owner].Hitbox))
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
else // Not returning
|
||||
{
|
||||
// Only rotates before hitting an enemy
|
||||
if (Projectile.numHits < 1)
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Projectile.StickyProjAI(360);
|
||||
|
||||
// Return if too far from owner
|
||||
if (ownerDist.Length() > 1000f)
|
||||
Returning = 1f;
|
||||
|
||||
// Gravity
|
||||
if (Projectile.numHits < 1)
|
||||
{
|
||||
if (Projectile.timeLeft < TimeLeft - 30)
|
||||
{
|
||||
Projectile.velocity.X *= 0.98f;
|
||||
Projectile.velocity.Y += 0.15f;
|
||||
if (Projectile.velocity.Y > 14f)
|
||||
Projectile.velocity.Y = 14f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The spear stops dealing damage after the rip-out damage
|
||||
public override bool? CanDamage() => Returning != 1f || !HasDealtRipOutDamage;
|
||||
|
||||
// Making sure it hits consistently when ripping out, part 2
|
||||
public override void ModifyDamageHitbox(ref Rectangle hitbox)
|
||||
{
|
||||
if (Returning == 1f)
|
||||
hitbox.Inflate(20, 20);
|
||||
}
|
||||
|
||||
// Immediately start returning if it hits a tile
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
Returning = 1f;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Laceration>(), 120);
|
||||
|
||||
if (Returning != 1f)
|
||||
{
|
||||
for (int blood = 0; blood < 6; blood++)
|
||||
{
|
||||
Vector2 bleedVelocity = Vector2.UnitX.RotatedBy(Projectile.rotation + MathHelper.Pi).RotatedByRandom(MathHelper.PiOver4);
|
||||
bleedVelocity *= Main.rand.NextFloat(15f, 19f);
|
||||
|
||||
Particle impaleBlood = new BloodParticle(Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * 22f, bleedVelocity, 15, 0.7f, Color.Maroon);
|
||||
GeneralParticleHandler.SpawnParticle(impaleBlood);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3));
|
||||
HasDealtRipOutDamage = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Projectile.ModifyHitNPCSticky(3);
|
||||
if (Returning == 1f)
|
||||
{
|
||||
modifiers.SetCrit();
|
||||
float damageMult = 1f + (Main.player[Projectile.owner].velocity.Length() / 4f); // Deals more damage on rip-out based on the player's velocity
|
||||
Main.NewText(damageMult);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
for (int bloody = 0; bloody < 2; bloody++)
|
||||
{
|
||||
Vector2 ripOutBleedVelocity = Vector2.UnitX.RotatedBy(Projectile.rotation).RotatedByRandom(MathHelper.PiOver4);
|
||||
ripOutBleedVelocity *= Main.rand.NextFloat(1.25f, 2f);
|
||||
float randomSize = Main.rand.NextFloat(0.5f, 0.7f);
|
||||
Color ripOutBloodColor = Color.Lerp(Color.Maroon, Color.Red, damageMult / 4f);
|
||||
|
||||
Particle ripOutBlood = new BloodParticle2(Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * 22f, ripOutBleedVelocity, 20, randomSize, ripOutBloodColor);
|
||||
GeneralParticleHandler.SpawnParticle(ripOutBlood);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 351 B |
Reference in new issue
Block a user