sealing my singularity
This commit is contained in:
1 parent
8702a8da5f
commit
4e3367f028
8 files changed
+386
-91
No files matched your search
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
Item.width = 32;
|
||||
Item.height = 32;
|
||||
Item.damage = 75;
|
||||
Item.damage = 10;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
Item.autoReuse = true;
|
||||
Item.noMelee = true;
|
||||
@@ -31,24 +31,16 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.shootSpeed = 13f;
|
||||
Item.shoot = ModContent.ProjectileType<LemonNadeHoldout>();
|
||||
}
|
||||
public override float StealthVelocityMultiplier => 1f;
|
||||
|
||||
public override float StealthDamageMultiplier => 1f;
|
||||
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4;
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
if (player.ownedProjectileCounts[Item.shoot] <= 0)
|
||||
player.Calamity().rogueStealth = 0;
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<Supernova>().
|
||||
AddIngredient(ItemID.Grenade).
|
||||
AddIngredient(ItemID.Lemon).
|
||||
Register();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee.Spears;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
@@ -13,38 +13,30 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = Item.height = 34;
|
||||
Item.damage = 260;
|
||||
Item.knockBack = 5f;
|
||||
Item.useAnimation = Item.useTime = 25;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.width = 32;
|
||||
Item.height = 32;
|
||||
Item.damage = 600;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<SealedSingularityProj>();
|
||||
Item.shootSpeed = 14f;
|
||||
|
||||
Item.noMelee = Item.noUseGraphic = true;
|
||||
Item.UseSound = SoundID.Item106;
|
||||
|
||||
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
|
||||
Item.rare = ModContent.RarityType<Turquoise>();
|
||||
Item.Calamity().donorItem = true;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useTime = 30;
|
||||
Item.useAnimation = 30;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.knockBack = 3;
|
||||
Item.value = CalamityGlobalItem.RarityLightRedBuyPrice;
|
||||
Item.rare = ItemRarityID.LightRed;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.channel = true;
|
||||
Item.shootSpeed = 13f;
|
||||
Item.shoot = ModContent.ProjectileType<SealedSingularityHoldout>();
|
||||
}
|
||||
|
||||
public override float StealthDamageMultiplier => 0.75f;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
if (player.Calamity().StealthStrikeAvailable())
|
||||
{
|
||||
int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
if (stealth.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[stealth].Calamity().stealthStrike = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
if (player.ownedProjectileCounts[Item.shoot] <= 0)
|
||||
player.Calamity().rogueStealth = 0;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -995,8 +995,11 @@ SealedSingularity: {
|
||||
DisplayName: Sealed Singularity
|
||||
Tooltip:
|
||||
'''
|
||||
Shatters on impact, summoning a black hole that sucks in nearby enemies
|
||||
Stealth strikes summon a black hole that lasts longer and sucks enemies with stronger force
|
||||
Disables normal stealth generation
|
||||
Throws a contained singularity bomb that slows down and creates a damaging field after a short fuse
|
||||
Hold <left> to generate stealth, but burn through the bomb's fuse
|
||||
After the field collapses, the singularity seeks out the strongest target that it hit and explodes
|
||||
Stealth strikes increase the size and duration of the damaging field
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,8 @@ SeafoamBombProj.DisplayName: Seafoam Bomb
|
||||
SeafoamBubble.DisplayName: Seafoam Bubble
|
||||
SealedSingularityBlackhole.DisplayName: Sealed Blackhole
|
||||
SealedSingularityGore.DisplayName: Sealed Singularity Fragment
|
||||
SealedSingularityProj.DisplayName: Sealed Singularity
|
||||
SealedSingularityHoldout.DisplayName: Sealed Singularity
|
||||
SealedSingularityProjectile.DisplayName: Sealed Singularity
|
||||
SeraphimAngelicLight.DisplayName: Light Orb
|
||||
SeraphimAngelicLight2.DisplayName: Light Orb
|
||||
SeraphimBeamLarge.DisplayName: Holy Beam
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
var cplayer = player.Calamity();
|
||||
if (Projectile.Opacity > 0)
|
||||
{
|
||||
cplayer.temporaryStealthMax = 10;
|
||||
cplayer.temporaryStealthMax = 0.1f;
|
||||
cplayer.temporaryStealthTimer = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,8 @@
|
||||
using System;
|
||||
using System.Reflection.Metadata;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Packets.Entities;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -43,9 +33,13 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
ref float ExplodeTimer => ref Projectile.ai[0];
|
||||
ref float ExplodeTimeMax => ref Projectile.ai[1];
|
||||
ref float AIState => ref Projectile.ai[2];
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.ai[2] == 1)
|
||||
if (AIState == 1)
|
||||
{
|
||||
Projectile.idStaticNPCHitCooldown = 2;
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
@@ -54,12 +48,12 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
Projectile.rotation += 0.175f * Projectile.direction;
|
||||
|
||||
if (Projectile.timeLeft < 280 && Projectile.ai[2] != 1)
|
||||
if (Projectile.timeLeft < 280 && AIState != 1)
|
||||
Projectile.velocity.Y += 0.22f;
|
||||
|
||||
Projectile.ai[0]++;
|
||||
ExplodeTimer++;
|
||||
//Copied from violence/chalice
|
||||
if (Main.rand.NextFloat() < Projectile.ai[0] / Projectile.ai[1] && Projectile.FinalExtraUpdate())
|
||||
if (Main.rand.NextFloat() < ExplodeTimer / ExplodeTimeMax && Projectile.FinalExtraUpdate())
|
||||
{
|
||||
int bloodLifetime = Main.rand.Next(5, 15);
|
||||
float bloodScale = Main.rand.NextFloat(0.6f, 0.8f);
|
||||
@@ -67,30 +61,30 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f));
|
||||
|
||||
float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f);
|
||||
Vector2 bloodVelocity = Main.rand.NextVector2Unit() * randomSpeedMultiplier;
|
||||
Vector2 bloodVelocity = Main.rand.NextVector2Unit() * randomSpeedMultiplier;
|
||||
bloodVelocity.Y -= 5f;
|
||||
BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity.RotatedBy(Projectile.rotation + MathHelper.PiOver4 * Projectile.spriteDirection), bloodLifetime, bloodScale, bloodColor);
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
}
|
||||
|
||||
if (Projectile.ai[0] > Projectile.ai[1] || Projectile.timeLeft == 2)
|
||||
if (ExplodeTimer > ExplodeTimeMax || Projectile.timeLeft == 2)
|
||||
{
|
||||
if (Projectile.ai[2] == 1)
|
||||
if (AIState == 1)
|
||||
Projectile.damage = Projectile.originalDamage;
|
||||
if (Projectile.Calamity().stealthStrike)
|
||||
{
|
||||
var frags = 6f;
|
||||
for (var i = 0; i < frags; i++)
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitY.RotatedBy(i/frags * MathHelper.TwoPi) * -10, ModContent.ProjectileType<LemonNadeProjectile>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 20,1);
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitY.RotatedBy(i / frags * MathHelper.TwoPi) * -10, ModContent.ProjectileType<LemonNadeProjectile>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 20, 1);
|
||||
}
|
||||
Projectile.Resize(360, 360);
|
||||
Projectile.ResetLocalNPCHitImmunity();
|
||||
Projectile.damage *= 10;
|
||||
Projectile.damage *= 5;
|
||||
Projectile.Damage();
|
||||
|
||||
for (var i = 0; i < 40; i++)
|
||||
{
|
||||
var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LemonNadeExplodeDust>(),Main.rand.NextVector2CircularEdge(15,15) * Main.rand.NextFloat(0.25f,1f),Scale:Main.rand.NextFloat(0.75f,1.25f));
|
||||
var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LemonNadeExplodeDust>(), Main.rand.NextVector2CircularEdge(15, 15) * Main.rand.NextFloat(0.25f, 1f), Scale: Main.rand.NextFloat(0.75f, 1.25f));
|
||||
}
|
||||
var exactBloodCount = 10;
|
||||
// Code copied from Violence/chalice.
|
||||
@@ -109,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item62 with {pitch = 1f },Projectile.Center);
|
||||
SoundEngine.PlaySound(SoundID.Item62 with { pitch = 1f }, Projectile.Center);
|
||||
SoundEngine.PlaySound(SoundID.Item111 with { pitch = 0.5f }, Projectile.Center);
|
||||
Projectile.Kill();
|
||||
|
||||
@@ -118,11 +112,11 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (Projectile.ai[2] == 1)
|
||||
if (AIState == 1)
|
||||
{
|
||||
Main.instance.LoadItem(ItemID.PumpkinSeed);
|
||||
var tex = TextureAssets.Item[ItemID.PumpkinSeed];
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.velocity.ToRotation() - MathHelper.PiOver2, tex.Size() * 0.5f, Projectile.scale,0);
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.velocity.ToRotation() - MathHelper.PiOver2, tex.Size() * 0.5f, Projectile.scale, 0);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -136,8 +130,8 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
Projectile.velocity.X *= -0.65f;
|
||||
Projectile.velocity.Y = -3f;
|
||||
if (Projectile.ai[1] - Projectile.ai[0] < 30)
|
||||
Projectile.ai[0] += 15;
|
||||
if (ExplodeTimeMax - ExplodeTimer < 30)
|
||||
ExplodeTimer += 15;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public class SealedSingularityHoldout : BaseSwordHoldoutProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity";
|
||||
public override bool useMeleeSpeed => false;
|
||||
public override bool useMeleeSize => false;
|
||||
public override int swingWidth => 180;
|
||||
public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType<SealedSingularity>()).Item;
|
||||
public override int AfterImageLength => 0;
|
||||
|
||||
public override int StartupTime { get; set; }
|
||||
public override int CooldownTime { get; set; }
|
||||
|
||||
bool isChannelable = false;
|
||||
|
||||
int explodeTimer = 0;
|
||||
|
||||
public override void Defaults()
|
||||
{
|
||||
Projectile.width = 22; Projectile.height = 28;
|
||||
Projectile.MaxUpdates = 4;
|
||||
Projectile.noEnchantmentVisuals = true;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.ContinuouslyUpdateDamageStats = true;
|
||||
}
|
||||
public override void Spawn()
|
||||
{
|
||||
var player = Main.player[Projectile.owner];
|
||||
var modplayer = player.GetModPlayer<BaseSwordHoldoutPlayer>();
|
||||
StartupTime = 10;
|
||||
CooldownTime = 10;
|
||||
swingTime -= StartupTime + CooldownTime;
|
||||
OffsetDistance = 24;
|
||||
modplayer.swingNum = 0;
|
||||
RotateInStartup = 1;
|
||||
}
|
||||
|
||||
public override void AdditionalAI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, new Vector3(1, 1, 1));
|
||||
var player = Main.player[Projectile.owner];
|
||||
var cplayer = player.Calamity();
|
||||
if (Projectile.Opacity > 0)
|
||||
{
|
||||
cplayer.temporaryStealthMax = 0.1f;
|
||||
cplayer.temporaryStealthTimer = 2;
|
||||
}
|
||||
|
||||
//MOVE SECONDS TO LemonNade.cs ITEM
|
||||
var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill;
|
||||
var explodeTimeGoal = CalamityUtils.SecondsToFrames(2) / avgStealth + 30;
|
||||
var stealthTime = explodeTimeGoal - 30;
|
||||
|
||||
if (Projectile.FinalExtraUpdate() && inStartup)
|
||||
if (explodeTimer < explodeTimeGoal)
|
||||
explodeTimer++;
|
||||
else
|
||||
{
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -10, ModContent.ProjectileType<SealedSingularityProjectile>(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal, 1).hostile = true;
|
||||
Projectile.Opacity = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f);
|
||||
|
||||
//When channeling, the internal timer will not progress
|
||||
if (player.channel && inStartup)
|
||||
{
|
||||
if (timer >= StartupTime - 1)
|
||||
{
|
||||
timer--;
|
||||
Projectile.timeLeft++;
|
||||
}
|
||||
}
|
||||
if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate())
|
||||
{
|
||||
timer--;
|
||||
Projectile.timeLeft++;
|
||||
}
|
||||
|
||||
if (inSwing)
|
||||
{
|
||||
if (swingTimer == (int)(swingTime * 0.75f))
|
||||
{
|
||||
if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0)
|
||||
{
|
||||
var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -15, ModContent.ProjectileType<SealedSingularityProjectile>(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer - 30, explodeTimeGoal);
|
||||
if (player.Calamity().StealthStrikeAvailable())
|
||||
{
|
||||
p.Calamity().stealthStrike = true;
|
||||
}
|
||||
}
|
||||
Projectile.Opacity = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override float SwingFunction()
|
||||
{
|
||||
if (inStartup)
|
||||
{
|
||||
return swingWidth * -0.5f + (MathF.Sin(Main.GlobalTimeWrappedHourly * 30) * 0.2f);
|
||||
}
|
||||
if (inCooldown)
|
||||
return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f)));
|
||||
return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion));
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +1,246 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public class SealedSingularityProj : ModProjectile, ILocalizedModType
|
||||
public class SealedSingularityProjectile : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 3;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 34;
|
||||
Projectile.height = 34;
|
||||
Projectile.width = 32;
|
||||
Projectile.height = 32;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.MaxUpdates = 2;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 180;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
int targetID = -1;
|
||||
|
||||
NPC target => Main.npc[targetID];
|
||||
ref float Timer => ref Projectile.ai[0];
|
||||
ref float TimerMax => ref Projectile.ai[1];
|
||||
ref float AIState => ref Projectile.ai[2];
|
||||
|
||||
bool Stealth => Projectile.Calamity().stealthStrike;
|
||||
|
||||
int bounceCooldown = 0;
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.ai[0] += 1f;
|
||||
Lighting.AddLight(Projectile.Center, new Vector3(1, 1, 1));
|
||||
Timer++;
|
||||
bounceCooldown--;
|
||||
|
||||
if (Projectile.ai[0] >= 70f)
|
||||
if (AIState == 0)
|
||||
{
|
||||
Projectile.velocity *= 0.96f;
|
||||
Projectile.rotation += 0.175f * Projectile.direction;
|
||||
if (Projectile.timeLeft < 280)
|
||||
Projectile.velocity.Y += 0.22f;
|
||||
|
||||
if (TimerMax - Timer < 30)
|
||||
Projectile.velocity *= 0.925f;
|
||||
}
|
||||
else
|
||||
if (AIState == 1)
|
||||
{
|
||||
Projectile.rotation += 0.3f * (float)Projectile.direction;
|
||||
Projectile.timeLeft++;
|
||||
Projectile.velocity = new Vector2(
|
||||
MathF.Sin(Timer),
|
||||
MathF.Sin(Timer * 0.7f)
|
||||
);
|
||||
if (Stealth)
|
||||
{
|
||||
Projectile.velocity *= 1 + Math.Clamp(Timer / TimerMax, 0f, 1f) * 2f;
|
||||
}
|
||||
}
|
||||
|
||||
if (AIState == 2)
|
||||
{
|
||||
if (targetID == -1 || !target.active || !target.CanBeChasedBy())
|
||||
{
|
||||
Timer = TimerMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.velocity = Projectile.DirectionTo(target.Center) * MathHelper.Clamp(Timer / 4f, 0f, 16f);
|
||||
}
|
||||
}
|
||||
|
||||
if (Timer > TimerMax && AIState == 0)
|
||||
{
|
||||
var sizee = Stealth ? 900 : 600;
|
||||
Projectile.localNPCHitCooldown = 60;
|
||||
Projectile.ResetLocalNPCHitImmunity();
|
||||
Projectile.tileCollide = false;
|
||||
Timer = 0;
|
||||
TimerMax = Stealth ? 600 : 300;
|
||||
Projectile.timeLeft += 180;
|
||||
AIState = 1;
|
||||
}
|
||||
if (Timer > TimerMax && AIState == 1)
|
||||
{
|
||||
AIState = 2;
|
||||
Timer = 0;
|
||||
TimerMax = 300;
|
||||
Projectile.ResetLocalNPCHitImmunity();
|
||||
}
|
||||
|
||||
if (Timer >= TimerMax && AIState == 2)
|
||||
{
|
||||
Projectile.ResetLocalNPCHitImmunity();
|
||||
Projectile.Damage();
|
||||
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LemonNadeExplodeDust>(), Main.rand.NextVector2CircularEdge(15, 15) * Main.rand.NextFloat(0.25f, 1f), Scale: Main.rand.NextFloat(0.5f, 1f));
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item62 with { pitch = 1f }, Projectile.Center);
|
||||
SoundEngine.PlaySound(SoundID.Item111 with { pitch = 0.5f }, Projectile.Center);
|
||||
for (int index = 0; index < 3; ++index)
|
||||
{
|
||||
float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
|
||||
float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType<SealedSingularityGore>(), 20, 0f, Projectile.owner, index, 0f);
|
||||
}
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (AIState == 1)
|
||||
PixelationManager.AddPixelatedDrawer((matrix) => DrawAuraOutside(this, matrix), Enums.GeneralDrawLayer.AfterEverything);
|
||||
Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0);
|
||||
return false;
|
||||
}
|
||||
private static void DrawAuraOutside(SealedSingularityProjectile mproj, Matrix matrix)
|
||||
{
|
||||
if (Projectile.owner != Main.myPlayer)
|
||||
return;
|
||||
|
||||
//glass-pot break sound
|
||||
SoundEngine.PlaySound(SoundID.Shatter, Projectile.position);
|
||||
Vector2 drawPosition = mproj.Projectile.Center - Main.screenPosition;
|
||||
|
||||
int blackhole = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<SealedSingularityBlackhole>(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.Calamity().stealthStrike ? -180f : 0f, 0f);
|
||||
if (blackhole.WithinBounds(Main.maxProjectiles))
|
||||
//Draw the outer particles
|
||||
Main.spriteBatch.EnterShaderRegion(matrix: matrix);
|
||||
GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseOpacity((mproj.Stealth ? 4 : 2) * (mproj.Timer / mproj.TimerMax));
|
||||
GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].UseSaturation(0.1f);
|
||||
GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons"), 1);
|
||||
GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].Apply();
|
||||
Texture2D telegraphBase = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing").Value;
|
||||
Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.White * mproj.Projectile.Opacity * 0.75f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0);
|
||||
Main.EntitySpriteDraw(telegraphBase, drawPosition, null, new Color(36, 0, 66) * mproj.Projectile.Opacity * 0.75f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0);
|
||||
Main.spriteBatch.ExitShaderRegion(matrix: matrix);
|
||||
}
|
||||
|
||||
public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers)
|
||||
{
|
||||
modifiers.SourceDamage *= 0.002f;
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
|
||||
switch (AIState)
|
||||
{
|
||||
Main.projectile[blackhole].Center = Projectile.Center;
|
||||
Main.projectile[blackhole].Calamity().stealthStrike = Projectile.Calamity().stealthStrike;
|
||||
case 0:
|
||||
{
|
||||
if (bounceCooldown <= 0)
|
||||
{
|
||||
Projectile.velocity *= -1f;
|
||||
bounceCooldown = 5;
|
||||
}
|
||||
if (TimerMax - Timer > 30)
|
||||
Timer = TimerMax - 30;
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (target.Calamity().IsArmored())
|
||||
return;
|
||||
if (targetID == -1 || !this.target.active || !this.target.CanBeChasedBy())
|
||||
{
|
||||
targetID = target.whoAmI;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.target.life < target.life)
|
||||
{
|
||||
targetID = target.whoAmI;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (targetID == target.whoAmI)
|
||||
Timer = TimerMax;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
switch (AIState)
|
||||
{
|
||||
case 1:
|
||||
modifiers.SourceDamage /= 6;
|
||||
return;
|
||||
case 2:
|
||||
modifiers.SourceDamage *= 2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
if (AIState == 1)
|
||||
{
|
||||
return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), (Stealth ? 900 : 600) * 0.4f, targetHitbox);
|
||||
}
|
||||
return base.Colliding(projHitbox, targetHitbox);
|
||||
}
|
||||
|
||||
// Make it bounce on tiles.
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
if (Projectile.width < 100)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Dig, Projectile.Center);
|
||||
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
|
||||
}
|
||||
|
||||
for (int index = 0; index < 3; ++index)
|
||||
if (Projectile.velocity.X != oldVelocity.X)
|
||||
{
|
||||
float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
|
||||
float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType<SealedSingularityGore>(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, index, 0f);
|
||||
Projectile.velocity.X = -oldVelocity.X;
|
||||
}
|
||||
if (Projectile.velocity.Y != oldVelocity.Y)
|
||||
{
|
||||
Projectile.velocity.Y = -oldVelocity.Y;
|
||||
}
|
||||
Projectile.velocity *= 0.75f;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user