Damage falloff on the charged blasts

This commit is contained in:
IbanPlay committed 2022-02-21 21:15:41 +01:00
1 parent a33f586a4a
commit c8629bf070
6 files changed
+56 -15

No files matched your search

+7 -2
View File
@@ -24,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee
public static float NeedleDamageMultiplier = 0.5f;
public static float snapDamageMultiplier = 1.3f; //Extra damage from making the scissors snap
public static float chargeDamageMultiplier = 1.6f; //Extra damage from charge
public static float chainDamageMultiplier = 0.1f;
@@ -31,7 +32,11 @@ namespace CalamityMod.Items.Weapons.Melee
public static float SlashBoltsDamageMultiplier = 0.2f;
public static float SnapBoltsDamageMultiplier = 0.1f;
public static float SwirlBoltAmount = 7f;
public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier
public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets
public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder
public static float SwirlBoltAmount = 7f; //The amount of cosmic bolts produced during hte swirl attack
public static float SwirlBoltDamageMultiplier = 0.8f; //This is the damage multiplier for ALL THE BOLTS: Aka, said damage multiplier is divided by the amount of bolts in a swirl and the full damage multiplier is gotten if you hit all the bolts
const string ComboTooltip = "Performs a combo of swings, alternating between narrow and wide swings and throwing the blade out every 5 swings\n" +
@@ -118,7 +123,7 @@ namespace CalamityMod.Items.Weapons.Melee
if (Charge > 0 && player.controlUp)
{
float angle = new Vector2(speedX, speedY).ToRotation();
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheCosmosBlast>(), (int)(damage * Charge * 1.8f), 0, player.whoAmI, Charge);
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheCosmosBlast>(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI, Charge);
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3)
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
+6 -1
View File
@@ -25,6 +25,11 @@ namespace CalamityMod.Items.Weapons.Melee
public static float snapDamageMultiplier = 1.3f; //Extra damage from making the scissors snap
public static float chargeDamageMultiplier = 1.6f; //Extra damage from charge
public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier
public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets
public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder
const string ComboTooltip = "Performs a combo of swings, throwing the blade out every 5 swings. Releasing the mouse while the blade is out will throw the second half towards it, making the scissors snap\n" +
"Snapping the scissors together increase their damage and empower your next two swings";
@@ -107,7 +112,7 @@ namespace CalamityMod.Items.Weapons.Melee
if (Charge > 0 && player.controlUp)
{
float angle = new Vector2(speedX, speedY).ToRotation();
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheElementsSnapBlast>(), (int)(damage * Charge * 1.8f), 0, player.whoAmI);
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheElementsSnapBlast>(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI);
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3)
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
+8 -2
View File
@@ -22,6 +22,11 @@ namespace CalamityMod.Items.Weapons.Melee
public static float beamDamageMultiplier = 0.8f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied
public static float glassStarDamageMultiplier = 0.2f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied
public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier
public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets
public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder
public override bool CloneNewInstances => true;
const string ParryTooltip = "Using RMB will extend the Ark out in front of you. Hitting an enemy with it will parry them, granting you a small window of invulnerability\n" +
@@ -80,8 +85,9 @@ namespace CalamityMod.Items.Weapons.Melee
{
if (Charge > 0 && player.controlUp)
{
float angle = new Vector2(speedX, speedY).ToRotation();
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, Vector2.Zero, ProjectileType<TrueAncientBlast>(), (int)(damage * Charge * chargeDamageMultiplier * 0.8f), 0, player.whoAmI, angle, 600);
float angle = player.DirectionTo(Main.MouseWorld).ToRotation();
Vector2 laserVector = player.DirectionTo(Main.MouseWorld) * 600;
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, laserVector, ProjectileType<TrueAncientBlast>(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI);
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3)
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
@@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee
{
public class ArkoftheCosmosBlast : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight";
public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; //Umm actually the rending scissors are for aote mr programmer what the hel.. it gets changed in predraw anywyas
private bool initialized = false;
public ref float Charge => ref projectile.ai[0];
@@ -60,6 +60,8 @@ namespace CalamityMod.Projectiles.Melee
public Vector2 scissorPosition => projectile.Center + ThrustDisplaceRatio() * projectile.velocity * 200f;
public ref float HitCounter => ref projectile.localAI[0];
public Player Owner => Main.player[projectile.owner];
public Particle PolarStar;
@@ -232,6 +234,13 @@ namespace CalamityMod.Projectiles.Melee
}
}
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
//Add some damage falloff
damage = (int)(damage * Math.Pow((1 - ArkoftheCosmos.blastFalloffStrenght), HitCounter * ArkoftheCosmos.blastFalloffSpeed));
HitCounter++;
}
public override void Kill(int timeLeft)
{
if (Dashing)
@@ -44,6 +44,8 @@ namespace CalamityMod.Projectiles.Melee
public int CurrentAnimation => (MaxTime - projectile.timeLeft) <= SnapTime ? 0 : (MaxTime - projectile.timeLeft) <= SnapTime + HoldTime ? 1 : 2;
public ref float HitCounter => ref projectile.ai[0];
public Player Owner => Main.player[projectile.owner];
public override void SetStaticDefaults()
@@ -165,6 +167,12 @@ namespace CalamityMod.Projectiles.Melee
GeneralParticleHandler.SpawnParticle(energyLeak);
}
}
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
//Add some damage falloff
damage = (int)(damage * Math.Pow((1 - ArkoftheElements.blastFalloffStrenght), HitCounter * ArkoftheElements.blastFalloffSpeed));
HitCounter++;
}
//Animation keys
public CurveSegment anticipation = new CurveSegment(EasingType.SineBump, 0f, 0.2f, -0.1f);
+17 -9
View File
@@ -33,13 +33,10 @@ namespace CalamityMod.Projectiles.Melee
const float MaxTime = 20;
public float Timer => MaxTime - projectile.timeLeft;
public ref float angle => ref projectile.ai[0];
public ref float lenght => ref projectile.ai[1];
public ref float HitCounter => ref projectile.ai[0];
public Player Owner => Main.player[projectile.owner];
public Vector2 lineVector => angle.ToRotationVector2() * lenght;
public override void SetDefaults()
{
projectile.melee = true;
@@ -55,9 +52,11 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + lineVector, 20f, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 20f, ref collisionPoint);
}
public override bool ShouldUpdatePosition() => false;
public override void AI()
{
if (Timer == 0)
@@ -65,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee
Particle Star = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Color.HotPink, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f);
GeneralParticleHandler.SpawnParticle(Star);
Star = new GenericSparkle(projectile.Center + lineVector, Vector2.Zero, Color.White, Color.PaleGoldenrod, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f);
Star = new GenericSparkle(projectile.Center + projectile.velocity, Vector2.Zero, Color.White, Color.PaleGoldenrod, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f);
GeneralParticleHandler.SpawnParticle(Star);
Main.PlaySound(SoundID.Item84, projectile.Center);
@@ -80,12 +79,19 @@ namespace CalamityMod.Projectiles.Melee
for (int i = 0; i < 10; i++)
{
Vector2 particleSpeed = angle.ToRotationVector2().RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f);
Vector2 particleSpeed = Vector2.Normalize(projectile.velocity).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f);
Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f);
GeneralParticleHandler.SpawnParticle(energyLeak);
}
}
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
//Add some damage falloff
damage = (int)(damage * Math.Pow((1 - TrueArkoftheAncients.blastFalloffStrenght), HitCounter * TrueArkoftheAncients.blastFalloffSpeed));
HitCounter++;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients");
@@ -93,6 +99,8 @@ namespace CalamityMod.Projectiles.Melee
float displace = 10 * (1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.8f));
float angle = projectile.velocity.ToRotation();
float drawRotation = angle + MathHelper.PiOver4;
Vector2 drawOrigin = new Vector2(0f, sword.Height);
Vector2 drawOffset = Owner.Center + angle.ToRotationVector2() * displace - Main.screenPosition;
@@ -111,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 origin = new Vector2(tex.Width / 2f, tex.Height);
float size = Timer / MaxTime > 0.5f ? (float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.2f + 0.8f : (float)Math.Sin(Timer / MaxTime * MathHelper.Pi);
size *= 3;
Vector2 scale = new Vector2(size, lenght / tex.Height);
Vector2 scale = new Vector2(size, projectile.velocity.Length() / tex.Height);
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0);
//Cap the lines
@@ -119,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee
scale = new Vector2(size, size);
origin = new Vector2(cap.Width / 2f, cap.Height);
spriteBatch.Draw(cap, projectile.Center - Main.screenPosition, null, Color.LightPink, rot + MathHelper.Pi, origin, scale, SpriteEffects.None, 0);
spriteBatch.Draw(cap, projectile.Center + lineVector - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0);
spriteBatch.Draw(cap, projectile.Center + projectile.velocity - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0);
spriteBatch.End();