- Various dye slot changes for accessory/armor dust spawning - Lab Hologram Projectors can now face left or right - Dragonblood Disgorger minor tooltip changes - Nuclear Rod renamed to Nuclear Fuel Rod - Graveyard enemies can now drop Blood Orbs - Nadir now uses Auric Bars and is buffed accordingly - [1.4.4 fix] Fixed typical spear AI prematurely expiring - [1.4.4 fix] Fixed Wulfrum Blunderbuss ammo text being misplaced
80 lines
3.4 KiB
C#
80 lines
3.4 KiB
C#
using System;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Enums;
|
|
using CalamityMod.Items.Accessories;
|
|
using CalamityMod.Projectiles.Typeless;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.Graphics.Shaders;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.CalPlayer.Dashes
|
|
{
|
|
public class AsgardsValorDash : PlayerDashEffect
|
|
{
|
|
public static new string ID => "Asgard's Valor";
|
|
|
|
public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam;
|
|
|
|
public override bool IsOmnidirectional => false;
|
|
|
|
public override float CalculateDashSpeed(Player player) => 16.9f;
|
|
|
|
public override void OnDashEffects(Player player)
|
|
{
|
|
// Spawn fire dust around the player's body.
|
|
for (int d = 0; d < 20; d++)
|
|
{
|
|
Dust holyFireDashDust = Dust.NewDustDirect(player.position, player.width, player.height, 246, 0f, 0f, 100, default, 3f);
|
|
holyFireDashDust.position += Main.rand.NextVector2Square(-5f, 5f);
|
|
holyFireDashDust.velocity *= 0.2f;
|
|
holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f);
|
|
holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player);
|
|
holyFireDashDust.noGravity = true;
|
|
holyFireDashDust.fadeIn = 0.5f;
|
|
}
|
|
}
|
|
|
|
public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor)
|
|
{
|
|
// Spawn fire dust around the player's body.
|
|
for (int d = 0; d < 4; d++)
|
|
{
|
|
Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, 246, 0f, 0f, 100, default, 2.75f);
|
|
holyFireDashDust.velocity *= 0.1f;
|
|
holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f);
|
|
holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player);
|
|
holyFireDashDust.noGravity = true;
|
|
if (Main.rand.NextBool(2))
|
|
holyFireDashDust.fadeIn = 0.5f;
|
|
}
|
|
}
|
|
|
|
public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext)
|
|
{
|
|
float kbFactor = 9f;
|
|
bool crit = Main.rand.Next(100) < player.GetCritChance<MeleeDamageClass>();
|
|
if (player.kbGlove)
|
|
kbFactor *= 2f;
|
|
if (player.kbBuff)
|
|
kbFactor *= 1.5f;
|
|
|
|
int hitDirection = player.direction;
|
|
if (player.velocity.X != 0f)
|
|
hitDirection = Math.Sign(player.velocity.X);
|
|
|
|
// Define hit context variables.
|
|
hitContext.CriticalHit = crit;
|
|
hitContext.HitDirection = hitDirection;
|
|
hitContext.KnockbackFactor = kbFactor;
|
|
hitContext.PlayerImmunityFrames = AsgardsValor.ShieldSlamIFrames;
|
|
hitContext.Damage = (int)player.GetTotalDamage<MeleeDamageClass>().ApplyTo(100f);
|
|
|
|
int holyExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(60);
|
|
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType<HolyExplosion>(), holyExplosionDamage, 15f, Main.myPlayer, 0f, 0f);
|
|
npc.AddBuff(ModContent.BuffType<HolyFlames>(), 180);
|
|
}
|
|
}
|
|
}
|