Merge branch 'master' of https://github.com/UncleDanny/CalamityMod
This commit is contained in:
commit
cdcc5c6995
13 files changed
+640
-7
No files matched your search
+144
-2
@@ -87,6 +87,8 @@ namespace CalamityMod.CalPlayer
|
||||
public int dashTimeMod;
|
||||
public int hInfernoBoost = 0;
|
||||
public int pissWaterBoost = 0;
|
||||
public int gaelRageCooldown = 0;
|
||||
public int gaelBloodShotCooldown = 0;
|
||||
public int packetTimer = 0;
|
||||
public int bloodflareHeartTimer = 180;
|
||||
public int bloodflareManaTimer = 180;
|
||||
@@ -1186,7 +1188,7 @@ namespace CalamityMod.CalPlayer
|
||||
polarisBoostThree = false;
|
||||
bloodfinBoost = false;
|
||||
|
||||
killSpikyBalls = false;
|
||||
killSpikyBalls = false;
|
||||
|
||||
vodka = false;
|
||||
redWine = false;
|
||||
@@ -1293,6 +1295,8 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
#region Debuffs
|
||||
//distanceFromBoss = -1;
|
||||
gaelRageCooldown = 0;
|
||||
gaelBloodShotCooldown = 0;
|
||||
stress = 0;
|
||||
adrenaline = 0;
|
||||
adrenalineMaxTimer = 300;
|
||||
@@ -1306,6 +1310,7 @@ namespace CalamityMod.CalPlayer
|
||||
bossRushImmunityFrameCurseTimer = 0;
|
||||
aBulwarkRareMeleeBoostTimer = 0;
|
||||
theBeeDamage = 0;
|
||||
reforges = 0;
|
||||
polarisBoostCounter = 0;
|
||||
killSpikyBalls = false;
|
||||
|
||||
@@ -1968,6 +1973,67 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
if (CalamityMod.RageHotKey.JustPressed)
|
||||
{
|
||||
if (gaelRageCooldown == 0 && player.HeldItem.type == ModContent.ItemType<GaelsGreatsword>() &&
|
||||
stress > 0)
|
||||
{
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Dust.NewDust(player.position, 120, 120, 218, 0f, 0f, 100, default, 1.5f);
|
||||
}
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
float angle = MathHelper.TwoPi * i / 30f;
|
||||
int dustIndex = Dust.NewDust(player.position, 120, 120, 218, 0f, 0f, 0, default, 2f);
|
||||
Main.dust[dustIndex].noGravity = true;
|
||||
Main.dust[dustIndex].velocity *= 4f;
|
||||
dustIndex = Dust.NewDust(player.position, 120, 120, 218, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[dustIndex].velocity *= 2.25f;
|
||||
Main.dust[dustIndex].noGravity = true;
|
||||
Dust.NewDust(player.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1f);
|
||||
}
|
||||
gaelRageCooldown = 60 * GaelsGreatsword.SkullsplosionCooldownSeconds;
|
||||
int damage2 = 15;
|
||||
if (CalamityWorld.downedYharon)
|
||||
{
|
||||
damage2 = GaelsGreatsword.PostYharonDamage;
|
||||
}
|
||||
else if (NPC.downedMoonlord)
|
||||
{
|
||||
damage2 = GaelsGreatsword.PostMoonLordDamage;
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
damage2 = GaelsGreatsword.HardmodeDamage;
|
||||
}
|
||||
float rageRatio = (float)stress / stressMax;
|
||||
int damage = (int)((stress == stressMax ? GaelsGreatsword.MaxRageBoost : rageRatio * GaelsGreatsword.RageBoostMultiplier) * damage2);
|
||||
float skullCount = 5f;
|
||||
float skullSpeed = 5f;
|
||||
if (CalamityWorld.downedYharon)
|
||||
{
|
||||
skullCount = 20f;
|
||||
skullSpeed = 16f;
|
||||
}
|
||||
else if (NPC.downedMoonlord)
|
||||
{
|
||||
skullCount = 13f;
|
||||
skullSpeed = 13f;
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
skullCount = 9f;
|
||||
skullSpeed = 8.75f;
|
||||
}
|
||||
for (float i = 0; i < skullCount; i += 1f)
|
||||
{
|
||||
float angle = MathHelper.TwoPi * i / skullCount;
|
||||
Vector2 initialVelocity = angle.ToRotationVector2() * skullSpeed;
|
||||
int projectileIndex = Projectile.NewProjectile(player.Center + initialVelocity * 3f, initialVelocity, ModContent.ProjectileType<GaelSkull>(), damage, 2f, player.whoAmI);
|
||||
Main.projectile[projectileIndex].tileCollide = false;
|
||||
}
|
||||
stress = 0;
|
||||
}
|
||||
if (stress == stressMax && !rageMode)
|
||||
{
|
||||
Main.PlaySound(29, (int)player.position.X, (int)player.position.Y, 104);
|
||||
@@ -3212,6 +3278,10 @@ namespace CalamityMod.CalPlayer
|
||||
aBulwarkRareMeleeBoostTimer--;
|
||||
if (bossRushImmunityFrameCurseTimer > 0)
|
||||
bossRushImmunityFrameCurseTimer--;
|
||||
if (gaelBloodShotCooldown > 0)
|
||||
gaelBloodShotCooldown--;
|
||||
if (gaelRageCooldown > 0)
|
||||
gaelRageCooldown--;
|
||||
|
||||
if (silvaCountdown > 0 && hasSilvaEffect && silvaSet)
|
||||
{
|
||||
@@ -5437,6 +5507,21 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
add += damageAdd;
|
||||
}
|
||||
if (item.type == ModContent.ItemType<GaelsGreatsword>())
|
||||
{
|
||||
if (CalamityWorld.downedYharon)
|
||||
{
|
||||
add += GaelsGreatsword.PostYharonDamage / (float)GaelsGreatsword.BaseDamage - 1f;
|
||||
}
|
||||
else if (NPC.downedMoonlord)
|
||||
{
|
||||
add += GaelsGreatsword.PostMoonLordDamage / (float)GaelsGreatsword.BaseDamage - 1f;
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
add += GaelsGreatsword.HardmodeDamage / (float)GaelsGreatsword.BaseDamage - 1f;
|
||||
}
|
||||
}
|
||||
if (flamethrowerBoost && item.ranged && (item.useAmmo == 23 || item.type == ModContent.ItemType<DragoonDrizzlefish>()))
|
||||
{
|
||||
add += 0.25f;
|
||||
@@ -5481,7 +5566,6 @@ namespace CalamityMod.CalPlayer
|
||||
theBeeDamage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetWeaponKnockback(Item item, ref float knockback)
|
||||
{
|
||||
if (auricBoost)
|
||||
@@ -6986,6 +7070,33 @@ namespace CalamityMod.CalPlayer
|
||||
#region Modify Hit By NPC
|
||||
public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit)
|
||||
{
|
||||
if (player.HeldItem.type == ModContent.ItemType<GaelsGreatsword>()
|
||||
&& npc.active && npc.CanBeChasedBy() && player.altFunctionUse == 2 && Main.rand.NextBool(2))
|
||||
{
|
||||
int direction = -1;
|
||||
if (npc.Center.X < player.Center.X)
|
||||
{
|
||||
direction = 1;
|
||||
}
|
||||
int damage2 = 15;
|
||||
if (CalamityWorld.downedYharon)
|
||||
{
|
||||
damage2 = GaelsGreatsword.PostYharonDamage;
|
||||
}
|
||||
else if (NPC.downedMoonlord)
|
||||
{
|
||||
damage2 = GaelsGreatsword.PostMoonLordDamage;
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
damage2 = GaelsGreatsword.HardmodeDamage;
|
||||
}
|
||||
player.ApplyDamageToNPC(npc, damage2 * 5, 5, -direction, false);
|
||||
player.immune = true;
|
||||
player.immuneNoBlink = true;
|
||||
player.immuneTime = 4;
|
||||
damage = 0;
|
||||
}
|
||||
int bossRushDamage = (Main.expertMode ? 500 : 300) + (CalamityWorld.bossRushStage * 2);
|
||||
if (CalamityWorld.bossRushActive)
|
||||
{
|
||||
@@ -7056,6 +7167,37 @@ namespace CalamityMod.CalPlayer
|
||||
#region Modify Hit By Proj
|
||||
public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit)
|
||||
{
|
||||
if (player.HeldItem.type == ModContent.ItemType<GaelsGreatsword>()
|
||||
&& proj.active && proj.hostile && player.altFunctionUse == 2 && Main.rand.NextBool(2))
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
int dustIndex = Dust.NewDust(proj.position, proj.width, proj.height, 31, 0f, 0f, 0, default(Color), 1f);
|
||||
Main.dust[dustIndex].velocity *= 0.3f;
|
||||
}
|
||||
int damage2 = 15;
|
||||
if (CalamityWorld.downedYharon)
|
||||
{
|
||||
damage2 = GaelsGreatsword.PostYharonDamage;
|
||||
}
|
||||
else if (NPC.downedMoonlord)
|
||||
{
|
||||
damage2 = GaelsGreatsword.PostMoonLordDamage;
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
damage2 = GaelsGreatsword.HardmodeDamage;
|
||||
}
|
||||
proj.hostile = false;
|
||||
proj.friendly = true;
|
||||
proj.velocity *= -1f;
|
||||
proj.damage = damage2 * 5;
|
||||
proj.penetrate = 1;
|
||||
player.immune = true;
|
||||
player.immuneNoBlink = true;
|
||||
player.immuneTime = 4;
|
||||
damage = 0;
|
||||
}
|
||||
int bossRushDamage = (Main.expertMode ? 125 : 150) + (CalamityWorld.bossRushStage / 2);
|
||||
if (CalamityWorld.bossRushActive)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.GameInput;
|
||||
using Terraria.Graphics.Capture;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class GaelsGreatsword : ModItem
|
||||
{
|
||||
//Help, they're forcing me to slave away at Calamity until I die! - Dominic
|
||||
|
||||
public int SwingType;
|
||||
|
||||
//Weapon attribute constants
|
||||
|
||||
public static readonly int BaseDamage = 8;
|
||||
|
||||
public static readonly int HardmodeDamage = 24;
|
||||
|
||||
public static readonly int PostMoonLordDamage = 270;
|
||||
|
||||
public static readonly int PostYharonDamage = 10000;
|
||||
|
||||
public static readonly float TrueMeleeBoostPreHardmode = 1.75f;
|
||||
|
||||
public static readonly float TrueMeleeBoostHardmode = 2.5f;
|
||||
|
||||
//Weapon projectile attribute constants
|
||||
|
||||
public static readonly int BaseSearchDistance = 400;
|
||||
|
||||
public static readonly int HardmodeSearchDistance = 660;
|
||||
|
||||
public static readonly int PostMoonLordSearchDistance = 940;
|
||||
|
||||
public static readonly int PostYharonSearchDistance = 1450;
|
||||
|
||||
public static readonly int BaseImmunityFrames = 11;
|
||||
|
||||
public static readonly int HardmodeImmunityFrames = 7;
|
||||
|
||||
public static readonly int PostMoonLordImmunityFrames = 4;
|
||||
|
||||
public static readonly int PostYharonImmunityFrames = 2;
|
||||
|
||||
public static readonly int SkullsplosionCooldownSeconds = 10;
|
||||
|
||||
public static readonly int PreMoonlordPenetrate = 3; //Infinite after Moon lord is dead
|
||||
|
||||
//Skull ring attribute constants
|
||||
|
||||
public static readonly float MaxRageBoost = 2.5f;
|
||||
|
||||
public static readonly float RageBoostMultiplier = 1.5f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Gael's Greatsword");
|
||||
Tooltip.SetDefault("Raises the player's damage reduction by 10% when wielding this sword\n" +
|
||||
"There are three random attacks that can occur when the blade is swung\n" +
|
||||
"The first attack releases two blood-skulls that home in\n" +
|
||||
"The second attack releases an enormous slow-moving skull\n" +
|
||||
"This slow-moving skull becomes weaker with time and lasts for around 4 seconds seconds\n" +
|
||||
"The second attack causes a true melee strike with increased damage\n" +
|
||||
"If you're below 50% life, swings release blood droplets\n" +
|
||||
"Pressing the Rage Key while holding this weapon resets Rage to 0 and releases a circle of\n" +
|
||||
"Slow-moving blood skulls. If Rage is full, the skulls do way more damage. Otherwise, the skull's damage is\n" +
|
||||
"related to the amount of rage sacrificed\n" +
|
||||
"This effect has a " + SkullsplosionCooldownSeconds + " second cooldown.\n" +
|
||||
"The user can right click with the sword to deflect projectiles and enemy attacks 50% of the time");
|
||||
}
|
||||
//NOTE: GetWeaponDamage is in the CalamityPlayer file
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = 88;
|
||||
item.height = 84;
|
||||
item.damage = BaseDamage;
|
||||
item.melee = true;
|
||||
item.useAnimation = 16;
|
||||
item.useTime = 16;
|
||||
item.useTurn = true;
|
||||
item.knockBack = 9;
|
||||
item.UseSound = SoundID.Item1;
|
||||
item.autoReuse = true;
|
||||
item.value = Item.buyPrice(5, 0, 0, 0);
|
||||
item.rare = 10;
|
||||
item.shoot = ModContent.ProjectileType<GaelSkull>();
|
||||
item.shootSpeed = 15f;
|
||||
item.Calamity().postMoonLordRarity = 16;
|
||||
item.useStyle = ItemUseStyleID.SwingThrow;
|
||||
}
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
player.endurance += 0.1f; //10% DR boost
|
||||
}
|
||||
public override bool AltFunctionUse(Player player) => true;
|
||||
public override Vector2? HoldoutOffset() => new Vector2(12, 12);
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
item.useAnimation = 46;
|
||||
item.useTime = 46;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.useAnimation = 12;
|
||||
item.useTime = 12;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
SwingType = Main.rand.Next(3);
|
||||
|
||||
//Almost entirely Ultimus Cleaver code. Feel free to clean it up if you wish.
|
||||
if (player.whoAmI == Main.myPlayer &&
|
||||
player.statLife < player.statLifeMax * 0.5 &&
|
||||
player.Calamity().gaelBloodShotCooldown == 0)
|
||||
{
|
||||
float velocityY = 0f;
|
||||
float velocityX = 0f;
|
||||
float spawnAdditiveY = 0f;
|
||||
float spawnAdditiveX = 0f;
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.8))
|
||||
{
|
||||
velocityY = -7f;
|
||||
}
|
||||
if (player.direction == -1)
|
||||
{
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))
|
||||
{
|
||||
spawnAdditiveX -= 8f;
|
||||
}
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7))
|
||||
{
|
||||
spawnAdditiveX -= 6f;
|
||||
}
|
||||
}
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7))
|
||||
{
|
||||
spawnAdditiveX = 26f;
|
||||
}
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.6))
|
||||
{
|
||||
velocityY = -6f;
|
||||
velocityX = 2f;
|
||||
}
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.4))
|
||||
{
|
||||
velocityY = -4f;
|
||||
velocityX = 4f;
|
||||
}
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3))
|
||||
{
|
||||
spawnAdditiveX -= 4f;
|
||||
spawnAdditiveY -= 20f;
|
||||
}
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.2))
|
||||
{
|
||||
velocityY = -2f;
|
||||
velocityX = 6f;
|
||||
}
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1))
|
||||
{
|
||||
velocityX = 7f;
|
||||
}
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1))
|
||||
{
|
||||
spawnAdditiveY += 6f;
|
||||
}
|
||||
velocityY *= 1.35f;
|
||||
velocityX *= 1.35f;
|
||||
spawnAdditiveX *= (float)player.direction * Main.rand.NextFloat(0.9f, 1.1f);
|
||||
spawnAdditiveY *= player.gravDir;
|
||||
Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + spawnAdditiveX, (float)(hitbox.Y + hitbox.Height / 2) + spawnAdditiveY,
|
||||
(float)player.direction * velocityX, velocityY * player.gravDir, ModContent.ProjectileType<GaelSpark>(), (int)((float)item.damage * 0.35f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f);
|
||||
|
||||
if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))
|
||||
{
|
||||
player.Calamity().gaelBloodShotCooldown = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
|
||||
{
|
||||
//True melee boost
|
||||
if (SwingType == 2)
|
||||
{
|
||||
damage = (int)((Main.hardMode ? TrueMeleeBoostHardmode : TrueMeleeBoostPreHardmode) * damage);
|
||||
}
|
||||
}
|
||||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
{
|
||||
//This is mostly from a function in Player.cs which handles the Brand of the Inferno alt click effect
|
||||
//attackCD = The attack countdown. Can reflect attacks from projectiles and hostile npcs while > 0
|
||||
//shield_parry_cooldown = A simple count down variable for effects.
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
bool shieldRaised = false;
|
||||
if (player.selectedItem != 58 && player.controlUseTile && !player.tileInteractionHappened && player.releaseUseItem && !player.controlUseItem && !player.mouseInterface && !CaptureManager.Instance.Active && !Main.HoveringOverAnNPC && !Main.SmartInteractShowingGenuine
|
||||
&& player.inventory[player.selectedItem].type == ModContent.ItemType<GaelsGreatsword>() && !player.mount.Active && (player.itemAnimation == 0 || PlayerInput.Triggers.JustPressed.MouseRight))
|
||||
{
|
||||
shieldRaised = true;
|
||||
}
|
||||
if (player.shield_parry_cooldown > 0)
|
||||
{
|
||||
player.shield_parry_cooldown--;
|
||||
if (player.shield_parry_cooldown == 1)
|
||||
{
|
||||
Main.PlaySound(25, -1, -1, 1, 1f, 0f);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int dustIndex = Dust.NewDust(player.Center + new Vector2((float)(player.direction * 6 + ((player.direction == -1) ? -10 : 0)), -14f), 10, 16, 45, 0f, 0f, 255, new Color(255, 100, 0, 127), (float)Main.rand.NextFloat(1f, 1.6f));
|
||||
Main.dust[dustIndex].noLight = true;
|
||||
Main.dust[dustIndex].noGravity = true;
|
||||
Main.dust[dustIndex].velocity *= 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shieldRaised != player.shieldRaised)
|
||||
{
|
||||
player.shieldRaised = shieldRaised;
|
||||
if (player.shieldRaised)
|
||||
{
|
||||
player.itemAnimation = 0;
|
||||
player.itemTime = 0;
|
||||
player.reuseDelay = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.shield_parry_cooldown = 15;
|
||||
if (player.attackCD < 30)
|
||||
{
|
||||
player.attackCD = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
switch (SwingType)
|
||||
{
|
||||
//Two small, quick skulls
|
||||
case 0:
|
||||
int numProj = 2;
|
||||
float rotation = MathHelper.ToRadians(10f);
|
||||
for (int i = 0; i < numProj; i++)
|
||||
{
|
||||
Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1)));
|
||||
Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI);
|
||||
}
|
||||
break;
|
||||
//Giant, slow, fading skull
|
||||
case 1:
|
||||
int projectileIndex = Projectile.NewProjectile(position, new Vector2(speedX,speedY) * 0.5f, type, damage * 2, knockBack, player.whoAmI, ai1:1f);
|
||||
Main.projectile[projectileIndex].scale = 1.75f;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -1,6 +1,7 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.World;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -268,6 +269,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
{
|
||||
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<EssenceofChaos>());
|
||||
}
|
||||
//DropHelper.DropItemChance(npc, ModContent.ItemType<GaelsGreatsword>(), CalamityWorld.defiled ? 0.05f : 0.02f);
|
||||
}
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.World;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -268,6 +269,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
{
|
||||
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<EssenceofChaos>());
|
||||
}
|
||||
//DropHelper.DropItemChance(npc, ModContent.ItemType<GaelsGreatsword>(), CalamityWorld.defiled ? 0.05f : 0.02f);
|
||||
}
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class GaelSkull : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Skull");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
Main.projFrames[projectile.type] = 5;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 16;
|
||||
projectile.height = 16;
|
||||
projectile.friendly = true;
|
||||
projectile.melee = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = 2;
|
||||
projectile.timeLeft = 600;
|
||||
projectile.light = 1f;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = GaelsGreatsword.BaseImmunityFrames;
|
||||
|
||||
if (CalamityWorld.downedYharon)
|
||||
{
|
||||
projectile.localNPCHitCooldown = GaelsGreatsword.PostYharonImmunityFrames;
|
||||
}
|
||||
else if (NPC.downedMoonlord)
|
||||
{
|
||||
projectile.localNPCHitCooldown = GaelsGreatsword.PostMoonLordImmunityFrames;
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
projectile.localNPCHitCooldown = GaelsGreatsword.HardmodeImmunityFrames;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
float checkingDistance = GaelsGreatsword.BaseSearchDistance;
|
||||
if (CalamityWorld.downedYharon)
|
||||
{
|
||||
checkingDistance = GaelsGreatsword.PostYharonSearchDistance;
|
||||
}
|
||||
else if (NPC.downedMoonlord)
|
||||
{
|
||||
checkingDistance = GaelsGreatsword.PostMoonLordSearchDistance;
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
checkingDistance = GaelsGreatsword.HardmodeSearchDistance;
|
||||
}
|
||||
|
||||
//Targeting
|
||||
|
||||
NPC target = projectile.Center.ClosestNPCAt(checkingDistance);
|
||||
projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC
|
||||
if (target != null)
|
||||
{
|
||||
float velocityMagnitude = projectile.velocity.Length();
|
||||
Vector2 distanceNorm = projectile.DirectionTo(target.Center) * velocityMagnitude * (projectile.Distance(target.Center) < 220f ? 1.3f : 1f);
|
||||
float inverseTurnSpeed = (projectile.Distance(target.Center) < 240f ? 4f : 13f);
|
||||
projectile.velocity = (projectile.velocity * inverseTurnSpeed + distanceNorm) / (inverseTurnSpeed + 0.4f);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.velocity *= velocityMagnitude;
|
||||
}
|
||||
|
||||
//Rotation
|
||||
|
||||
if (projectile.velocity.X < 0f)
|
||||
{
|
||||
projectile.spriteDirection = -1;
|
||||
projectile.rotation = (-projectile.velocity).ToRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.spriteDirection = 1;
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
}
|
||||
|
||||
//Dust circle
|
||||
|
||||
projectile.ai[0] += 1f;
|
||||
if (projectile.ai[0] % 20 == 0f)
|
||||
{
|
||||
for (int l = 0; l < 24; l++)
|
||||
{
|
||||
Vector2 spawnPositionAdditive = Vector2.UnitX * (float)-(float)projectile.width / 2f;
|
||||
spawnPositionAdditive += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.TwoPi / 24f), default) * new Vector2(8f, 16f) * projectile.scale;
|
||||
spawnPositionAdditive = spawnPositionAdditive.RotatedBy((double)(projectile.rotation), default);
|
||||
int dustIndex = Dust.NewDust(projectile.Center, 0, 0, 218, 0f, 0f, 0, default, 1.5f);
|
||||
Main.dust[dustIndex].noGravity = true;
|
||||
Main.dust[dustIndex].position = projectile.Center + spawnPositionAdditive;
|
||||
Main.dust[dustIndex].velocity = projectile.velocity * 0.1f;
|
||||
Main.dust[dustIndex].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[dustIndex].position) * 1.25f;
|
||||
}
|
||||
}
|
||||
|
||||
//Frame logic
|
||||
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter % 5 == 0)
|
||||
{
|
||||
projectile.frame++;
|
||||
}
|
||||
if (projectile.frame >= Main.projFrames[projectile.type])
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
|
||||
//Fat skull logic
|
||||
if (projectile.ai[1] == 1f)
|
||||
{
|
||||
if (projectile.localAI[0] == 0f && !NPC.downedMoonlord)
|
||||
{
|
||||
projectile.penetrate = GaelsGreatsword.PreMoonlordPenetrate;
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
else if (NPC.downedMoonlord)
|
||||
{
|
||||
projectile.penetrate = 5;
|
||||
}
|
||||
projectile.alpha += 1;
|
||||
projectile.damage = (int)Math.Ceiling(projectile.damage * 0.992); //Exponentially decays to a factor of 0.12896 of the original damage
|
||||
if (projectile.alpha >= 255)
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
else if (projectile.alpha > 0)
|
||||
{
|
||||
projectile.alpha -= 15;
|
||||
if (projectile.alpha < 0)
|
||||
{
|
||||
projectile.alpha = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
projectile.position = projectile.Center;
|
||||
projectile.width = projectile.height = 240;
|
||||
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
|
||||
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
|
||||
projectile.maxPenetrate = -1;
|
||||
projectile.penetrate = -1;
|
||||
projectile.Damage();
|
||||
Main.PlaySound((int)SoundType.NPCKilled, (int)projectile.Center.X, (int)projectile.Center.Y, 52, 0.4f);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 100, default, 1.5f);
|
||||
}
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
float angle = MathHelper.TwoPi * i / 30f;
|
||||
int dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 0, default, 2.5f);
|
||||
Main.dust[dustIndex].noGravity = true;
|
||||
Main.dust[dustIndex].velocity *= 3f;
|
||||
dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 218, 0f, 0f, 100, default, 1.5f);
|
||||
Main.dust[dustIndex].velocity *= 2f;
|
||||
Main.dust[dustIndex].noGravity = true;
|
||||
Dust.NewDust(projectile.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,40 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class GaelSpark : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Spark");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 6;
|
||||
projectile.height = 6;
|
||||
projectile.friendly = true;
|
||||
projectile.melee = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = 1;
|
||||
projectile.timeLeft = 180;
|
||||
projectile.alpha = 255;
|
||||
}
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
projectile.velocity.X = 0f;
|
||||
return false;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, 0.7f, 0f, 0f);
|
||||
projectile.velocity.Y += 0.3f;
|
||||
int dustIndex = Dust.NewDust(projectile.Center, 0, 0, DustID.Blood, 0f, 0f, 0, default, 1.4f);
|
||||
Main.dust[dustIndex].noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 130 B |
@@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
}
|
||||
public override bool? CanHitNPC(NPC target) => HomingCooldown == 0 && !target.townNPC
|
||||
&& target.type != NPCID.DD2EterniaCrystal && target.CanBeChasedBy();
|
||||
&& target.type != NPCID.DD2EterniaCrystal && !target.immortal && !target.dontTakeDamage;
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
HomingCooldown = 25;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public override bool PreDrawExtras(SpriteBatch spriteBatch)
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f);
|
||||
CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType<ChaoticSpreadRod>(), new Color(138, 50, 73, 100));
|
||||
CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType<ChaoticSpreadRod>(), new Color(138, 50, 73, 100), 30f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public override bool PreDrawExtras(SpriteBatch spriteBatch)
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f);
|
||||
CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType<NavyFishingRod>(), new Color(36, 61, 111, 100));
|
||||
CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType<NavyFishingRod>(), new Color(36, 61, 111, 100), 33f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1258,7 +1258,7 @@ namespace CalamityMod
|
||||
new Rectangle?(frame), Color.White, rotation, center, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
|
||||
public static void DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor)
|
||||
public static void DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, float yPositionAdditive = 35f)
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, 0.4f, 0f, 0.4f);
|
||||
|
||||
@@ -1278,7 +1278,7 @@ namespace CalamityMod
|
||||
{
|
||||
pPosX -= 13f;
|
||||
}
|
||||
pPosY -= 35f * gravDir;
|
||||
pPosY -= yPositionAdditive * gravDir;
|
||||
}
|
||||
|
||||
if (gravDir == -1f)
|
||||
|
||||
Reference in new issue
Block a user