From b3700b6eac1d787dd157ccbc1d2d2004f82ad91b Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Fri, 27 Nov 2020 16:37:38 -0500 Subject: [PATCH] corpus avertor stealth strike --- Buffs/StatBuffs/AvertorBonus.cs | 24 ++++++ Buffs/StatBuffs/AvertorBonus.png | Bin 0 -> 607 bytes CalPlayer/CalamityPlayer.cs | 3 + CalPlayer/CalamityPlayerLifeRegen.cs | 4 + CalPlayer/CalamityPlayerMiscEffects.cs | 3 + Items/Weapons/Rogue/CorpusAvertor.cs | 15 +++- Projectiles/Rogue/CorpusAvertorProj.cs | 4 +- Projectiles/Rogue/CorpusAvertorStealth.cs | 100 ++++++++++++++++++++++ 8 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 Buffs/StatBuffs/AvertorBonus.cs create mode 100644 Buffs/StatBuffs/AvertorBonus.png create mode 100644 Projectiles/Rogue/CorpusAvertorStealth.cs diff --git a/Buffs/StatBuffs/AvertorBonus.cs b/Buffs/StatBuffs/AvertorBonus.cs new file mode 100644 index 0000000000..253ecbae2a --- /dev/null +++ b/Buffs/StatBuffs/AvertorBonus.cs @@ -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; + } + } +} diff --git a/Buffs/StatBuffs/AvertorBonus.png b/Buffs/StatBuffs/AvertorBonus.png new file mode 100644 index 0000000000000000000000000000000000000000..020e7e63c109931d055a3cd24af1280ae6a78222 GIT binary patch literal 607 zcmV-l0-*hgP)1vrG8kXoP{u- zZSNDelh=}9Y+_I_-rV^^xZ{+LuVp+q++EQx|9B()h3u)|P<>EvI&3K8sGkY zV-90N{FpQDDmbBf-u9FtjN7AtyZ1UZ_ReLX`(ca{AdDEtW*%(T!L~;MGJ3jxmu9HD zP7nqtVKOG}H|ETXKWL8vk=}kuDiMtcwv7#tq~P7bnV=ujxX0UZrX~}f9^x~)_dItm zEqfGT&$o8>RgM}TUY^BX-CWkWE7;zFi?U6{7G{)xxUtC-*EQOq?3@C76!4_^%~%?V zi3KB+F!z`c{D?~zuNbO`_9`$R>G5O?BN(CtPW0nPKlAu0VUGgbbWbhnCM07RtQ-{} zC1{=k2Ju4)=4ohY6&Kc7(*gD<00VBq{G)moq;u*i<~&a)$8i-*t?vph&Lsu8M_|sm zhq))%hMLf=h+tyA6XHo#6Y^Gs0XJWmn^OAzklN>F_qiCf=Nnez5A#fO`sHYG#bhDIxPjRGs@& tR^0=pO&tCp>tI)10r^7J+5FG1<4@{9y$I64e2)MC002ovPDHLkV1j@yAn*VH literal 0 HcmV?d00001 diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 3469181f7c..24d1992a64 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -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; diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 21a6c5da0f..bc2f84baa8 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -714,6 +714,10 @@ namespace CalamityMod.CalPlayer { player.lifeRegen += 2; } + if (modPlayer.avertorBonus) + { + player.lifeRegen += 4; + } if (modPlayer.bloodflareSummon) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 4e928dda74..91ea38d0c3 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -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; diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index db72a018ce..91b3a2ec7e 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -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(), damage * 2, knockBack * 2f, player.whoAmI); + Main.projectile[dagger].Calamity().stealthStrike = true; + return false; + } + return true; } } } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index a9c1d19485..12d8d64dd4 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -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(), + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (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; } diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs new file mode 100644 index 0000000000..035a02e220 --- /dev/null +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -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(), CalamityUtils.SecondsToFrames(20f), true); + player.AddBuff(ModContent.BuffType(), 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); + } + } + } +}