The Final Dawn

This commit is contained in:
DominicKarma42 committed 2020-05-13 22:14:42 -05:00
1 parent 9caad3531d
commit 66609417a8
29 files changed
+1025 -2

No files matched your search

+3 -2
View File
@@ -9344,7 +9344,8 @@ namespace CalamityMod.CalPlayer
bool isAxe = it.axe > 0;
bool isHammer = it.hammer > 0;
bool isPlaced = it.createTile != -1;
bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced;
bool isChannelable = it.channel;
bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced || isChannelable;
bool playerUsingWeapon = hasDamage && hasHitboxes && !hasNonWeaponFunction;
if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && playerUsingWeapon)
ConsumeStealthByAttacking();
@@ -9448,7 +9449,7 @@ namespace CalamityMod.CalPlayer
return rogueStealth >= rogueStealthMax * (stealthStrikeHalfCost ? 0.5f : 1f);
}
private void ConsumeStealthByAttacking()
internal void ConsumeStealthByAttacking()
{
stealthStrikeThisFrame = true;
stealthAcceleration = 1f; // Reset acceleration when you attack
+33
View File
@@ -0,0 +1,33 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class FinalFlame : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.color = default;
dust.velocity *= 0.5f;
dust.noGravity = true;
dust.noLight = true;
dust.alpha = 50;
}
public override bool Update(Dust dust)
{
dust.position += dust.velocity;
dust.scale *= 0.94f;
dust.velocity *= 0.90f;
Lighting.AddLight(dust.position, 0.255f, 0.185f, 0.094f);
if (dust.scale < 0.4f)
{
dust.active = false;
}
return false;
}
public override Color? GetAlpha(Dust dust, Color lightColor) => new Color(Color.White.R, Color.White.G, Color.White.B, dust.alpha);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

+1
View File
@@ -52,6 +52,7 @@ namespace CalamityMod.Items.TreasureBags
DropHelper.DropItemChance(player, ModContent.ItemType<PhoenixFlameBarrage>(), 3);
DropHelper.DropItemChance(player, ModContent.ItemType<AngryChickenStaff>(), 3); // Yharon Kindle Staff
DropHelper.DropItemChance(player, ModContent.ItemType<ProfanedTrident>(), 3); // Infernal Spear
DropHelper.DropItemChance(player, ModContent.ItemType<FinalDawn>(), 3);
// Equipment
DropHelper.DropItem(player, ModContent.ItemType<YharimsGift>());
+45
View File
@@ -0,0 +1,45 @@
using CalamityMod.Projectiles.Rogue;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Rogue
{
public class FinalDawn : RogueWeapon
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Final Dawn");
Tooltip.SetDefault("'We shall ride into the sunrise once more'\n" +
"Attack enemies with a giant scythe swing to replenish stealth\n" +
"Press up and attack to throw the scythe \n" +
"Stealth Strikes allow you to perform a vertical swing that leaves a lingering fire aura\n" +
"Stealth Strike performed while pressing up allow you to fling yourself at the enemy and slice through them, causing homing fireballs to emerge");
}
public override void SafeSetDefaults()
{
item.damage = 5000;
item.Calamity().rogue = true;
item.width = 78;
item.height = 66;
item.noMelee = true;
item.useTime = item.useAnimation = 15;
item.useStyle = ItemUseStyleID.SwingThrow;
item.knockBack = 4;
item.rare = 10;
item.Calamity().customRarity = CalamityRarity.Dedicated ;
item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice;
item.autoReuse = false;
item.shoot = ModContent.ProjectileType<FinalDawnProjectile>();
item.shootSpeed = 1f;
item.useTurn = false;
item.channel = true;
item.noUseGraphic = true;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] +
player.ownedProjectileCounts[ModContent.ProjectileType<FinalDawnFireSlash>()] +
player.ownedProjectileCounts[ModContent.ProjectileType<FinalDawnHorizontalSlash>()] +
player.ownedProjectileCounts[ModContent.ProjectileType<FinalDawnThrow>()] +
player.ownedProjectileCounts[ModContent.ProjectileType<FinalDawnThrow2>()] <= 0;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

+1
View File
@@ -3015,6 +3015,7 @@ namespace CalamityMod.NPCs.Yharon
DropHelper.DropItemChance(npc, ModContent.ItemType<PhoenixFlameBarrage>(), 4);
DropHelper.DropItemChance(npc, ModContent.ItemType<AngryChickenStaff>(), 4);
DropHelper.DropItemChance(npc, ModContent.ItemType<ProfanedTrident>(), 4);
DropHelper.DropItemChance(npc, ModContent.ItemType<FinalDawn>(), 4);
// Vanity
DropHelper.DropItemChance(npc, ModContent.ItemType<YharonMask>(), 7);
+131
View File
@@ -0,0 +1,131 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using CalamityMod.CalPlayer;
using CalamityMod.Buffs.DamageOverTime;
namespace CalamityMod.Projectiles.Rogue
{
public class FinalDawnFireSlash : ModProjectile
{
public bool HasRegeneratedStealth = false;
public const float StealthReturnRatio = 0.25f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("FinalDawnFireSlash");
Main.projFrames[projectile.type] = 11;
}
public override void SetDefaults()
{
projectile.width = 300;
projectile.height = 398;
projectile.friendly = false;
projectile.penetrate = -1;
projectile.tileCollide = false;
projectile.Calamity().rogue = true;
projectile.ownerHitCheck = true;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 10;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
player.direction = projectile.direction;
player.heldProj = projectile.whoAmI;
AdjustPlayerPositionValues(player);
projectile.ai[0]++;
if(projectile.ai[0] >= 4)
{
projectile.ai[1]++;
projectile.ai[0] = 0;
if (projectile.ai[1] == 5)
{
projectile.friendly = true;
Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y);
}
}
if (projectile.ai[1] >= 11)
{
projectile.Kill();
return;
}
projectile.frame = (int)projectile.ai[1];
AdjustPlayerItemFrameValues(player);
}
public void AdjustPlayerPositionValues(Player player)
{
projectile.Center = player.Center;
projectile.position.X += 60 * player.direction;
projectile.position.Y -= 30;
}
public void AdjustPlayerItemFrameValues(Player player)
{
if (projectile.ai[1] < 5)
{
player.bodyFrame.Y = player.bodyFrame.Height;
}
else if (projectile.ai[1] < 8)
{
player.bodyFrame.Y = 3 * player.bodyFrame.Height;
}
else
{
player.bodyFrame.Y = 4 * player.bodyFrame.Height;
}
projectile.spriteDirection = player.direction;
player.heldProj = projectile.whoAmI;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
CalamityPlayer calamityPlayer = Main.player[projectile.owner].Calamity();
// Restore stealth
if (!HasRegeneratedStealth)
{
calamityPlayer.rogueStealth += calamityPlayer.rogueStealthMax * StealthReturnRatio;
if (calamityPlayer.rogueStealth > calamityPlayer.rogueStealthMax)
calamityPlayer.rogueStealth = calamityPlayer.rogueStealthMax;
HasRegeneratedStealth = true;
target.AddBuff(ModContent.BuffType<HolyFlames>(), 600);
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
int width = 918 / 3;
int height = 1990 / 5;
Vector2 drawCenter = projectile.Center;
Rectangle frameRectangle = new Rectangle(projectile.frame / 5 * width, projectile.frame % 5 * height, width, height);
Texture2D scytheTexture = Main.projectileTexture[projectile.type];
Texture2D glowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnFireSlash_Glow");
Main.spriteBatch.Draw(scytheTexture,
drawCenter - Main.screenPosition,
frameRectangle,
projectile.GetAlpha(lightColor),
projectile.rotation,
frameRectangle.Size() / 2,
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
Main.spriteBatch.Draw(glowTexture,
drawCenter - Main.screenPosition,
frameRectangle,
projectile.GetAlpha(Color.White),
projectile.rotation,
frameRectangle.Size() / 2,
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

+89
View File
@@ -0,0 +1,89 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class FinalDawnFireball : ModProjectile
{
public const float DesiredSpeed = 30;
public const float InterpolationTime = 10;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Final Dawn");
Main.projFrames[projectile.type] = 4;
}
public override void SetDefaults()
{
projectile.width = 36;
projectile.height = 80;
projectile.Calamity().rogue = true;
projectile.penetrate = 1;
projectile.hostile = false;
projectile.friendly = false;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.alpha = 50;
projectile.timeLeft = 180;
}
public override void AI()
{
NPC chargeAt = Main.npc[(int)projectile.ai[1]];
if(!chargeAt.active)
projectile.Kill();
int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, ModContent.DustType<FinalFlame>(), 0f, 0f, 0, default, 1.0f);
Main.dust[idx].velocity = projectile.velocity * 0.5f;
Main.dust[idx].noGravity = true;
Main.dust[idx].noLight = true;
projectile.ai[0]++;
if(projectile.ai[0] >= 20)
{
projectile.friendly = true;
NPC npc = Main.npc[(int)projectile.ai[1]];
Vector2 desiredVelocity = projectile.DirectionTo(npc.Center) * DesiredSpeed;
projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime);
if(!npc.active)
projectile.Kill();
}
projectile.frameCounter++;
if (projectile.frameCounter >= 5)
{
projectile.frame++;
projectile.frameCounter = 0;
if (projectile.frame >= Main.projFrames[projectile.type])
projectile.frame = 0;
}
}
public override void Kill(int timeLeft)
{
if (Main.myPlayer == projectile.owner)
{
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<FinalDawnReticle>(), projectile.damage, projectile.knockBack, projectile.owner);
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D glowmask = Main.projectileTexture[projectile.type];
int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
int yStart = height * projectile.frame;
Main.spriteBatch.Draw(glowmask,
projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY),
new Rectangle?(new Rectangle(0, yStart, glowmask.Width, height)),
projectile.GetAlpha(Color.White), projectile.rotation,
new Vector2(glowmask.Width / 2f, height / 2f), projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 600);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

+152
View File
@@ -0,0 +1,152 @@
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class FinalDawnFlame : ModProjectile
{
internal struct Flame
{
public Vector2 Position;
public int FrameCounter;
public int Frame;
public float Alpha;
public float Scale;
public int Direction;
}
private Flame[] Flames;
public const int TotalFlames = 120;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Final Dawn");
Main.projFrames[projectile.type] = 8;
}
public override void SetDefaults()
{
projectile.scale = 1f;
projectile.width = 1000;
projectile.height = 100;
projectile.penetrate = -1;
projectile.hostile = false;
projectile.friendly = true;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.Calamity().rogue = true;
projectile.alpha = 255;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 30;
Flames = new Flame[TotalFlames];
for (int i = 0; i < Flames.Length; i++)
{
Vector2 flamePosition = Main.rand.NextVector2Circular(projectile.width / 2, projectile.height / 2);
Flames[i].Position = flamePosition;
Flames[i].Frame = Main.rand.Next(8);
Flames[i].FrameCounter = Main.rand.Next(5);
Flames[i].Alpha = 1f;
Flames[i].Scale = 0.8f + 0.4f * Main.rand.NextFloat();
Flames[i].Direction = Main.rand.Next(2);
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D texture = Main.projectileTexture[projectile.type];
int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
if (Flames.Length > 0)
{
for(int i = 0; i < Flames.Length; i++)
{
int frameHeight2 = frameHeight * Flames[i].Frame;
spriteBatch.Draw(texture,
projectile.Center + Flames[i].Position - Main.screenPosition,
new Rectangle?(new Rectangle(0, frameHeight2, texture.Width, frameHeight)),
projectile.GetAlpha(Color.White) * Flames[i].Alpha,
projectile.rotation,
new Vector2(texture.Width / 2f, frameHeight / 2f),
Flames[i].Scale,
Flames[i].Direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
}
}
return false;
}
public override void AI()
{
if (Flames.Length > 0)
{
for (int i = 0; i < Flames.Length; i++)
{
AdjustFlameValues(ref Flames[i]);
}
}
AlphaAdjustments();
}
// The internal is to match consistency with the Flame struct. If you want to make this class public, you must also make the struct public.
internal void AdjustFlameValues(ref Flame flame)
{
flame.FrameCounter++;
if (flame.FrameCounter >= 5)
{
flame.Frame++;
flame.FrameCounter = 0;
if (flame.Frame >= 8)
{
if (projectile.ai[0] < 570)
{
Vector2 pos = new Vector2(Main.rand.NextFloat(projectile.width / 2)).RotatedByRandom(MathHelper.TwoPi);
float widthHeightRatio = (float)projectile.height / projectile.width;
pos.Y *= widthHeightRatio;
flame.Position = pos;
flame.Scale = 0.8f + 0.4f * Main.rand.NextFloat();
flame.Direction = Main.rand.Next(2);
flame.Frame = 0;
}
else
{
flame.Alpha = 0f;
}
}
}
}
public void AlphaAdjustments()
{
projectile.ai[0]++;
if (projectile.ai[0] < 570)
{
projectile.alpha -= 10;
if (projectile.alpha < 0) projectile.alpha = 0;
}
else
{
projectile.friendly = false;
projectile.alpha += 5;
if (projectile.alpha > 255)
{
projectile.alpha = 255;
}
}
if (projectile.ai[0] >= 600 && projectile.alpha >= 255)
{
projectile.Kill();
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 600);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1,95 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using CalamityMod.Buffs.DamageOverTime;
namespace CalamityMod.Projectiles.Rogue
{
public class FinalDawnHorizontalSlash : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Final Dawn");
Main.projFrames[projectile.type] = 9;
}
public override void SetDefaults()
{
projectile.width = 600;
projectile.height = 156;
projectile.friendly = false;
projectile.penetrate = -1;
projectile.tileCollide = false;
projectile.Calamity().rogue = true;
projectile.ownerHitCheck = true;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 10;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
projectile.Center = player.Center;
player.heldProj = projectile.whoAmI;
projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt();
projectile.ai[0]++;
if (projectile.ai[0] >= 4)
{
projectile.ai[1]++;
projectile.ai[0] = 0;
if (projectile.ai[1] == 3)
{
projectile.friendly = true;
Main.PlaySound(SoundID.Item71, projectile.position);
if(projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<FinalDawnFlame>(), projectile.damage / 2, 0f, projectile.owner);
}
}
}
if (projectile.ai[1] >= 9)
{
projectile.Kill();
return;
}
projectile.frame = (int)projectile.ai[1];
if (projectile.ai[1] < 2) player.bodyFrame.Y = 1 * player.bodyFrame.Height;
else player.bodyFrame.Y = 3 * player.bodyFrame.Height;
if (projectile.ai[1] == 4 || projectile.ai[1] == 5) player.direction = -1 * projectile.spriteDirection;
else player.direction = 1 * projectile.spriteDirection;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D scytheTexture = Main.projectileTexture[projectile.type];
Texture2D scytheGlowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow");
int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
int yStart = height * projectile.frame;
Main.spriteBatch.Draw(scytheTexture,
projectile.Center - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY,
new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)),
projectile.GetAlpha(lightColor), projectile.rotation,
new Vector2((float)scytheTexture.Width / 2f, (float)height / 2f), projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
Main.spriteBatch.Draw(scytheGlowTexture,
projectile.Center - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY,
new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)),
projectile.GetAlpha(Color.White),
projectile.rotation,
new Vector2((float)scytheTexture.Width / 2f, (float)height / 2f),
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 600);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

+172
View File
@@ -0,0 +1,172 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class FinalDawnProjectile : ModProjectile
{
public const float MaxChargeTime = 20f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Final Dawn");
}
public override void SetDefaults()
{
projectile.width = 16;
projectile.height = 16;
projectile.friendly = false;
projectile.Calamity().rogue = true;
projectile.penetrate = -1;
projectile.tileCollide = false;
Main.projFrames[projectile.type] = 2;
//projectile.extraUpdates = 2;
}
public override bool ShouldUpdatePosition() => false;
public override void AI()
{
Player player = Main.player[projectile.owner];
if (Main.myPlayer == player.whoAmI)
{
projectile.velocity = Main.MouseWorld - player.Center;
projectile.velocity.Normalize();
}
player.direction = projectile.direction;
player.heldProj = projectile.whoAmI;
projectile.Center = player.Center;
projectile.position.Y -= 44;
projectile.position.X -= 46 * player.direction;
player.bodyFrame.Y = player.bodyFrame.Height;
if (projectile.ai[0] < MaxChargeTime)
{
// Charging dust
Vector2 dustCenter = new Vector2(projectile.Center.X, projectile.Center.Y - 40);
int flame = Dust.NewDust(dustCenter, projectile.width, projectile.height, ModContent.DustType<FinalFlame>(), 0, 0, 100, default, 2f);
Main.dust[flame].noGravity = true;
Main.dust[flame].fadeIn = 1.5f;
Main.dust[flame].scale = 1.4f;
Vector2 offsetVector = Utils.NextVector2CircularEdge(Main.rand, 100f, 100f);
Main.dust[flame].position = dustCenter - offsetVector;
Vector2 newVelocity = dustCenter - Main.dust[flame].position;
Main.dust[flame].velocity = newVelocity * 0.1f;
}
if (projectile.ai[0] == MaxChargeTime)
{
int dustCount = 36;
for (int i = 0; i < dustCount; i++)
{
Vector2 startingPosition = projectile.Center + new Vector2(0, -40);
Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f;
offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / dustCount);
int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType<FinalFlame>(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f);
Main.dust[dustIdx].noGravity = true;
Main.dust[dustIdx].noLight = true;
Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f;
}
projectile.frame = 1;
}
projectile.ai[0]++;
projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt();
if (Main.myPlayer == projectile.owner)
{
if (!player.channel || player.noItems || player.CCed)
{
AttemptExecuteAttacks(player);
projectile.Kill();
}
}
}
public void AttemptExecuteAttacks(Player player)
{
if (projectile.ai[0] >= MaxChargeTime && !player.noItems && !player.CCed)
{
// Far range attack
if (player.controlUp)
{
// Stealth Strike
if (player.Calamity().StealthStrikeAvailable())
{
Projectile.NewProjectile(player.Center,
player.DirectionTo(Main.MouseWorld) * 38f,
ModContent.ProjectileType<FinalDawnThrow2>(),
(int)(projectile.damage * 2.5f),
projectile.knockBack,
projectile.owner);
player.Calamity().ConsumeStealthByAttacking();
}
else
{
Projectile.NewProjectile(projectile.Center,
projectile.DirectionTo(Main.MouseWorld) * 38f,
ModContent.ProjectileType<FinalDawnThrow>(), projectile.damage,
projectile.knockBack, projectile.owner);
}
}
// Close range attack
else
{
// Stealth
if (player.Calamity().StealthStrikeAvailable())
{
Projectile.NewProjectile(projectile.Center,
projectile.velocity,
ModContent.ProjectileType<FinalDawnHorizontalSlash>(),
(int)(projectile.damage * 2.5f),
projectile.knockBack,
projectile.owner);
player.Calamity().ConsumeStealthByAttacking();
}
else
{
Projectile.NewProjectile(projectile.Center,
projectile.velocity,
ModContent.ProjectileType<FinalDawnFireSlash>(),
(int)(projectile.damage * 1.5f),
projectile.knockBack,
projectile.owner);
}
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D scytheTexture = Main.projectileTexture[projectile.type];
Texture2D glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnProjectile_Glow");
int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
int yStart = height * projectile.frame;
Main.spriteBatch.Draw(scytheTexture,
projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY,
new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)),
projectile.GetAlpha(lightColor),
projectile.rotation,
new Vector2(scytheTexture.Width / 2f, height / 2f),
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
Main.spriteBatch.Draw(glowmask,
projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY,
new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)),
projectile.GetAlpha(Color.White),
projectile.rotation,
new Vector2(scytheTexture.Width / 2f, height / 2f),
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 600);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

+81
View File
@@ -0,0 +1,81 @@
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class FinalDawnReticle : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Final Dawn");
}
public override void SetDefaults()
{
projectile.scale = 1.5f;
projectile.width = 120;
projectile.height = 120;
projectile.penetrate = -1;
projectile.hostile = false;
projectile.friendly = true;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.Calamity().rogue = true;
projectile.alpha = 0;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
if (projectile.ai[1] == 0)
projectile.ai[1] = 1;
if (projectile.ai[0] == 0)
{
int dustCount = 36;
for (int i = 0; i < dustCount; i++)
{
Vector2 startingPosition = projectile.Center + 10f * Vector2.UnitX;
Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f;
offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / 20f);
int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType<FinalFlame>(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f);
Main.dust[dustIdx].noGravity = true;
Main.dust[dustIdx].noLight = true;
Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f;
}
projectile.ai[0] = 1;
}
projectile.alpha += 8;
projectile.scale *= 0.98f;
projectile.ai[1] *= 1.01f;
if(projectile.alpha >= 255)
projectile.Kill();
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D ring = Main.projectileTexture[projectile.type];
Texture2D symbol = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnReticleSymbol");
spriteBatch.Draw(symbol,
projectile.Center - Main.screenPosition,
null,
projectile.GetAlpha(Color.White),
projectile.rotation,
new Vector2(symbol.Width / 2, symbol.Height / 2),
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
spriteBatch.Draw(ring,
projectile.Center - Main.screenPosition,
null,
projectile.GetAlpha(Color.White),
projectile.rotation,
new Vector2(ring.Width / 2, ring.Height / 2),
projectile.ai[1],
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

+95
View File
@@ -0,0 +1,95 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class FinalDawnThrow : ModProjectile
{
public const float DesiredSpeed = 38;
public const float InterpolationTime = 15;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Final Dawn");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 8;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 80;
projectile.height = 80;
projectile.friendly = true;
projectile.Calamity().rogue = true;
projectile.penetrate = -1;
projectile.light = 0.0f;
projectile.extraUpdates = 2;
projectile.tileCollide = false;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 5;
}
public override void AI()
{
if (projectile.localAI[0] == 0)
{
Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y);
projectile.localAI[0] = 1;
}
Player player = Main.player[projectile.owner];
projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt();
projectile.rotation += 0.25f * projectile.direction;
projectile.ai[0]++;
if (projectile.ai[0] >= 30)
{
Vector2 desiredVelocity = projectile.DirectionTo(player.Center) * DesiredSpeed;
projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime);
float distance = projectile.Distance(player.Center);
if (distance < 64)
projectile.Kill();
}
int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, ModContent.DustType<FinalFlame>(), 0f, 0f, 0, default, 0.5f);
Main.dust[idx].velocity *= 0.5f;
Main.dust[idx].velocity += projectile.velocity * 0.5f;
Main.dust[idx].noGravity = true;
Main.dust[idx].noLight = false;
Main.dust[idx].scale = 1.0f;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D scytheTexture = Main.projectileTexture[projectile.type];
Texture2D scytheGlowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnThrow_Glow");
int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
int yStart = height * projectile.frame;
Main.spriteBatch.Draw(scytheTexture,
projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY,
new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)),
projectile.GetAlpha(lightColor),
projectile.rotation,
new Vector2(scytheTexture.Width / 2f, height / 2f),
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
Main.spriteBatch.Draw(scytheGlowTexture,
projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY,
new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)),
projectile.GetAlpha(Color.White),
projectile.rotation,
new Vector2(scytheTexture.Width / 2f, height / 2f),
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 600);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

+127
View File
@@ -0,0 +1,127 @@
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class FinalDawnThrow2 : ModProjectile
{
bool HasHitEnemy = false;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Final Dawn");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 8;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 200;
projectile.height = 200;
projectile.friendly = true;
projectile.Calamity().rogue = true;
projectile.penetrate = -1;
projectile.light = 0.0f;
projectile.extraUpdates = 1;
projectile.tileCollide = true; // We don't want people getting stuck in walls right
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 5;
}
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough)
{
//should be self explanatory
width = 32;
height = 32;
return true;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
// Spawn homing flames that chase the HIT enemy only. This is also limited to one burst
if (Main.myPlayer == projectile.owner && !HasHitEnemy)
{
for (int i = 0; i < 6; i++)
{
Vector2 velocity = Utils.NextVector2Circular(Main.rand, 7.2f, 7.2f);
Projectile.NewProjectile(projectile.Center, velocity,
ModContent.ProjectileType<FinalDawnFireball>(),
(int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner, 0f,
target.whoAmI);
}
HasHitEnemy = true;
}
}
public override void AI()
{
if (projectile.localAI[0] == 0)
{
Main.PlaySound(SoundID.Item71, projectile.position);
projectile.localAI[0] = 1;
}
Player player = Main.player[projectile.owner];
projectile.spriteDirection = projectile.velocity.X > 0 ? 1 : -1;
projectile.rotation += 0.25f * projectile.direction;
player.Center = projectile.Center;
player.fullRotationOrigin = player.Center - player.position;
player.fullRotation = projectile.rotation;
player.direction = projectile.direction;
player.heldProj = projectile.whoAmI;
player.bodyFrame.Y = 1 * player.bodyFrame.Height;
player.immuneNoBlink = true;
player.immuneTime = 10;
// This is to make sure the player doesn't get yeeted out of the world, which crashes the game pretty much all of the time
bool worldEdge = projectile.Center.X < 1000 || projectile.Center.Y < 1000 || projectile.Center.X > Main.maxTilesX * 16 - 1000 || projectile.Center.Y > Main.maxTilesY * 16 - 1000;
projectile.ai[0]++;
if(projectile.ai[0] >= 60 || worldEdge)
{
projectile.Kill();
}
int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, mod.DustType("FinalFlame"), 0f, 0f, 0, default, 2.5f);
Main.dust[idx].velocity = projectile.velocity * -0.5f;
Main.dust[idx].noGravity = true;
Main.dust[idx].noLight = false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Player player = Main.player[projectile.owner];
float scytheRotation = player.fullRotation;
Texture2D scytheTexture = Main.projectileTexture[projectile.type];
Texture2D glowScytheTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnThrow2_Glow");
int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
int y6 = num214 * projectile.frame;
Vector2 origin = new Vector2(scytheTexture.Width / 2f + 40f * player.direction, num214 * 1.1f);
Main.spriteBatch.Draw(scytheTexture,
player.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY,
new Rectangle?(new Rectangle(0, y6, scytheTexture.Width, num214)),
projectile.GetAlpha(lightColor),
scytheRotation,
origin,
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
Main.spriteBatch.Draw(glowScytheTexture,
player.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY,
new Rectangle?(new Rectangle(0, y6, scytheTexture.Width, num214)),
projectile.GetAlpha(Color.White),
scytheRotation,
origin,
projectile.scale,
projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally,
0f);
return false;
}
public override void Kill(int timeLeft)
{
Player player = Main.player[projectile.owner];
player.fullRotation = 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB