corpus avertor stealth strike
This commit is contained in:
1 parent
c3ea22f923
commit
b3700b6eac
8 files changed
+147
-6
No files matched your search
@@ -0,0 +1,24 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.StatBuffs
|
||||
{
|
||||
public class AvertorBonus : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Avertor Bonus");
|
||||
Description.SetDefault("Boosted damage and life regeneration");
|
||||
Main.debuff[Type] = true;
|
||||
Main.pvpBuff[Type] = true;
|
||||
Main.buffNoSave[Type] = false;
|
||||
longerExpertDebuff = false;
|
||||
canBeCleared = false;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.Calamity().avertorBonus = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 607 B |
@@ -874,6 +874,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool hallowedPower = false;
|
||||
public bool hallowedRegen = false;
|
||||
public bool kamiBoost = false;
|
||||
public bool avertorBonus = false;
|
||||
#endregion
|
||||
|
||||
#region Minion
|
||||
@@ -1631,6 +1632,7 @@ namespace CalamityMod.CalPlayer
|
||||
hallowedRegen = false;
|
||||
hallowedPower = false;
|
||||
kamiBoost = false;
|
||||
avertorBonus = false;
|
||||
IBoots = false;
|
||||
elysianFire = false;
|
||||
sTracers = false;
|
||||
@@ -2194,6 +2196,7 @@ namespace CalamityMod.CalPlayer
|
||||
xRage = false;
|
||||
xWrath = false;
|
||||
kamiBoost = false;
|
||||
avertorBonus = false;
|
||||
graxDefense = false;
|
||||
encased = false;
|
||||
sMeleeBoost = false;
|
||||
|
||||
@@ -714,6 +714,10 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
player.lifeRegen += 2;
|
||||
}
|
||||
if (modPlayer.avertorBonus)
|
||||
{
|
||||
player.lifeRegen += 4;
|
||||
}
|
||||
|
||||
if (modPlayer.bloodflareSummon)
|
||||
{
|
||||
|
||||
@@ -1200,6 +1200,9 @@ namespace CalamityMod.CalPlayer
|
||||
if (modPlayer.kamiBoost)
|
||||
player.allDamage += 0.15f;
|
||||
|
||||
if (modPlayer.avertorBonus)
|
||||
player.allDamage += 0.1f;
|
||||
|
||||
if (modPlayer.roverDriveTimer < 616)
|
||||
{
|
||||
player.statDefense += 10;
|
||||
|
||||
@@ -13,7 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
DisplayName.SetDefault("Corpus Avertor");
|
||||
Tooltip.SetDefault("Seems like it has worn down over time\n" +
|
||||
"Attacks grant lifesteal based on damage dealt\n" +
|
||||
"The lower your HP the more damage this weapon does and heals the player on enemy hits");
|
||||
"The lower your HP the more damage this weapon does and heals the player on enemy hits\n" +
|
||||
"Stealth strikes throw a single rainbow outlined dagger\n" +
|
||||
"On enemy hits, this dagger boosts the damage and life regen of all members of your team\n" +
|
||||
"However, there is a small chance it will cut your health in half instead");
|
||||
}
|
||||
|
||||
public override void SafeSetDefaults()
|
||||
@@ -46,9 +49,13 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
|
||||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
{
|
||||
int dagger = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f);
|
||||
Main.projectile[dagger].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable();
|
||||
return false;
|
||||
if (player.Calamity().StealthStrikeAvailable())
|
||||
{
|
||||
int dagger = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<CorpusAvertorStealth>(), damage * 2, knockBack * 2f, player.whoAmI);
|
||||
Main.projectile[dagger].Calamity().stealthStrike = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
float mult = projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75
|
||||
velocity *= mult;
|
||||
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, ModContent.ProjectileType<CorpusAvertorClone>(),
|
||||
Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType<CorpusAvertorClone>(),
|
||||
(int)(projectile.damage * mult), projectile.knockBack * mult, projectile.owner, projectile.ai[0]);
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
projectile.velocity.Y *= 1.01f;
|
||||
|
||||
int scale = (int)((projectile.ai[0] - 60f) * 4.25f);
|
||||
int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f);
|
||||
int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f);
|
||||
Main.dust[dust].velocity *= 0f;
|
||||
Main.dust[dust].noGravity = true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
using CalamityMod.Buffs.StatBuffs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public class CorpusAvertorStealth : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Corpus Avertor");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 24;
|
||||
projectile.height = 24;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = 1;
|
||||
projectile.timeLeft = 300;
|
||||
projectile.Calamity().rogue = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f;
|
||||
|
||||
if (projectile.ai[0] < 120f)
|
||||
projectile.ai[0] += 1f;
|
||||
|
||||
projectile.velocity.X *= 1.01f;
|
||||
projectile.velocity.Y *= 1.01f;
|
||||
|
||||
int scale = (int)((projectile.ai[0] - 60f) * 4.25f);
|
||||
int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f);
|
||||
Main.dust[dust].velocity *= 0f;
|
||||
Main.dust[dust].noGravity = true;
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha);
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if (target.type == NPCID.TargetDummy)
|
||||
return;
|
||||
|
||||
OnHitEffects(damage);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
OnHitEffects(damage);
|
||||
}
|
||||
|
||||
private void OnHitEffects(int damage)
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
if (Main.rand.NextBool(7))
|
||||
{
|
||||
int lifeLossAmt = (int)(Math.Ceiling(player.statLife * 0.5));
|
||||
player.statLife -= lifeLossAmt;
|
||||
if (Main.myPlayer == player.whoAmI)
|
||||
{
|
||||
player.HealEffect(-lifeLossAmt, true);
|
||||
}
|
||||
if (player.statLife <= 0)
|
||||
{
|
||||
player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " became the blood god's sacrifice."), 1000.0, 0, false);
|
||||
}
|
||||
}
|
||||
else if (Main.LocalPlayer.team == player.team && player.team != 0)
|
||||
{
|
||||
Main.LocalPlayer.AddBuff(ModContent.BuffType<AvertorBonus>(), CalamityUtils.SecondsToFrames(20f), true);
|
||||
player.AddBuff(ModContent.BuffType<AvertorBonus>(), CalamityUtils.SecondsToFrames(20f), true);
|
||||
float heal = damage * 0.025f;
|
||||
if ((int)heal == 0)
|
||||
return;
|
||||
if (Main.player[Main.myPlayer].lifeSteal <= 0f)
|
||||
return;
|
||||
|
||||
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, player, heal, ProjectileID.VampireHeal, 1200f, 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user