public sealed override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Player player = Main.player[projectile.owner]; OrchidModPlayer modPlayer = player.GetModPlayer <OrchidModPlayer>(); if (target.type != NPCID.TargetDummy) { OrchidModGlobalProjectile modProjectile = projectile.GetGlobalProjectile <OrchidModGlobalProjectile>(); OrchidModShamanHelper.addShamanicEmpowerment(modProjectile.shamanEmpowermentType, player, modPlayer, mod); } SafeOnHitNPC(target, damage, knockback, crit, player, modPlayer); }
public static void addShamanicEmpowerment(int type, Player player, OrchidModPlayer modPlayer, Mod mod) { if (type == 0) { return; } if (modPlayer.shamanForest && type == 4 && modPlayer.shamanEarthTimer == 0) { player.AddBuff(BuffType <Shaman.Buffs.DeepForestAura>(), 1); int projType = ProjectileType <Shaman.Projectiles.Equipment.DeepForestCharmProj>(); Projectile.NewProjectile(player.Center.X, player.position.Y, 0f, 0f, projType, 1, 0, player.whoAmI, 0f, 0f); Projectile.NewProjectile(player.Center.X, player.position.Y, 0f, 0f, projType, 2, 0, player.whoAmI, 0f, 0f); } bool newEmpowerment = false; int currentTimer = 0; int lowestDuration = 60 * modPlayer.shamanBuffTimer + 1; lowestDuration = (modPlayer.shamanFireTimer < lowestDuration) ? modPlayer.shamanFireTimer : lowestDuration; lowestDuration = (modPlayer.shamanWaterTimer < lowestDuration) ? modPlayer.shamanWaterTimer : lowestDuration; lowestDuration = (modPlayer.shamanAirTimer < lowestDuration) ? modPlayer.shamanAirTimer : lowestDuration; lowestDuration = (modPlayer.shamanEarthTimer < lowestDuration) ? modPlayer.shamanEarthTimer : lowestDuration; lowestDuration = (modPlayer.shamanSpiritTimer < lowestDuration) ? modPlayer.shamanSpiritTimer : lowestDuration; switch (type) { case 1: currentTimer = modPlayer.shamanFireTimer; break; case 2: currentTimer = modPlayer.shamanWaterTimer; break; case 3: currentTimer = modPlayer.shamanAirTimer; break; case 4: currentTimer = modPlayer.shamanEarthTimer; break; case 5: currentTimer = modPlayer.shamanSpiritTimer; break; default: return; } newEmpowerment = currentTimer == 0; if (newEmpowerment) { if (modPlayer.shamanDryad && OrchidModShamanHelper.getNbShamanicBonds(player, modPlayer, mod) > 0) { int lowestNoZeroDuation = 60 * modPlayer.shamanBuffTimer + 1; lowestNoZeroDuation = (modPlayer.shamanFireTimer != 0 && modPlayer.shamanFireTimer < lowestDuration) ? 0 + modPlayer.shamanFireTimer : lowestDuration; lowestNoZeroDuation = (modPlayer.shamanWaterTimer != 0 && modPlayer.shamanWaterTimer < lowestDuration) ? 0 + modPlayer.shamanWaterTimer : lowestDuration; lowestNoZeroDuation = (modPlayer.shamanAirTimer != 0 && modPlayer.shamanAirTimer < lowestDuration) ? 0 + modPlayer.shamanAirTimer : lowestDuration; lowestNoZeroDuation = (modPlayer.shamanEarthTimer != 0 && modPlayer.shamanEarthTimer < lowestDuration) ? 0 + modPlayer.shamanEarthTimer : lowestDuration; lowestNoZeroDuation = (modPlayer.shamanSpiritTimer != 0 && modPlayer.shamanSpiritTimer < lowestDuration) ? 0 + modPlayer.shamanSpiritTimer : lowestDuration; modPlayer.shamanFireTimer = (modPlayer.shamanFireTimer == lowestDuration) ? modPlayer.shamanFireTimer + 60 * 3 : modPlayer.shamanFireTimer; modPlayer.shamanWaterTimer = (modPlayer.shamanWaterTimer == lowestDuration) ? modPlayer.shamanWaterTimer + 60 * 3 : modPlayer.shamanWaterTimer; modPlayer.shamanAirTimer = (modPlayer.shamanAirTimer == lowestDuration) ? modPlayer.shamanAirTimer + 60 * 3 : modPlayer.shamanAirTimer; modPlayer.shamanEarthTimer = (modPlayer.shamanEarthTimer == lowestDuration) ? modPlayer.shamanEarthTimer + 60 * 3 : modPlayer.shamanEarthTimer; modPlayer.shamanSpiritTimer = (modPlayer.shamanSpiritTimer == lowestDuration) ? modPlayer.shamanSpiritTimer + 60 * 3 : modPlayer.shamanSpiritTimer; } } int maxBufftimer = 60 * modPlayer.shamanBuffTimer; int toAdd = (int)(maxBufftimer / (2 + modPlayer.shamanHitDelay)); switch (type) { case 1: modPlayer.shamanFireTimer = modPlayer.shamanFireTimer + toAdd > maxBufftimer ? maxBufftimer : modPlayer.shamanFireTimer + toAdd; break; case 2: modPlayer.shamanWaterTimer = modPlayer.shamanWaterTimer + toAdd > maxBufftimer ? maxBufftimer : modPlayer.shamanWaterTimer + toAdd; break; case 3: modPlayer.shamanAirTimer = modPlayer.shamanAirTimer + toAdd > maxBufftimer ? maxBufftimer : modPlayer.shamanAirTimer + toAdd; break; case 4: modPlayer.shamanEarthTimer = modPlayer.shamanEarthTimer + toAdd > maxBufftimer ? maxBufftimer : modPlayer.shamanEarthTimer + toAdd; break; case 5: modPlayer.shamanSpiritTimer = modPlayer.shamanSpiritTimer + toAdd > maxBufftimer ? maxBufftimer : modPlayer.shamanSpiritTimer + toAdd; break; default: return; } modPlayer.shamanHitDelay = 8; }
public static void ModifyHitNPCWithProjShaman(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection, Player player, OrchidModPlayer modPlayer, Mod mod) { if (crit) { if (player.FindBuffIndex(mod.BuffType("OpalEmpowerment")) > -1) { damage += 5; } if (player.FindBuffIndex(mod.BuffType("DestroyerFrenzy")) > -1) { damage = (int)(damage * 1.15f); } if (projectile.type == mod.ProjectileType("TitanicScepterProj")) { damage = (int)(damage * 1.5f); } if (player.FindBuffIndex(mod.BuffType("TitanicBuff")) > -1) { damage = (int)(damage * 1.2f); } if (modPlayer.shamanDestroyer && modPlayer.shamanWaterTimer > 0) { modPlayer.shamanTimerDestroyer = 60; modPlayer.shamanDestroyerCount++; } } if (target.type != NPCID.TargetDummy) { if (projectile.type != mod.ProjectileType("LavaDroplet") && projectile.type != mod.ProjectileType("LostSoul") && projectile.type != mod.ProjectileType("HarpyAnkletProj") && projectile.type != mod.ProjectileType("DeepForestCharmProj") && projectile.type != mod.ProjectileType("Smite") ) { if (modPlayer.shamanFireTimer > 0) { if (modPlayer.shamanPoison) { target.AddBuff((20), 5 * 60); } if (modPlayer.shamanVenom) { target.AddBuff((70), 5 * 60); } if (modPlayer.shamanFire) { target.AddBuff((24), 5 * 60); } if (modPlayer.shamanIce) { target.AddBuff((44), 5 * 60); } if (modPlayer.shamanDemonite) { target.AddBuff(153, 20); // Shadowflame } } if (crit == true && modPlayer.shamanSkull && modPlayer.shamanWaterTimer > 0) { int dmg = (int)(80 * modPlayer.shamanDamage + 5E-06f); Vector2 mouseTarget = Main.MouseWorld; Vector2 heading = mouseTarget - Main.player[projectile.owner].position; heading.Normalize(); heading *= new Vector2(5f, 5f).Length(); Vector2 projectileVelocity = (new Vector2(heading.X, heading.Y).RotatedByRandom(MathHelper.ToRadians(10))); Projectile.NewProjectile(Main.player[projectile.owner].Center.X, Main.player[projectile.owner].Center.Y, projectileVelocity.X, projectileVelocity.Y, mod.ProjectileType("LostSoul"), dmg, 0f, projectile.owner, 0f, 0f); } if (crit == true && modPlayer.shamanWaterHoney && modPlayer.shamanWaterTimer > 0 && modPlayer.timerVial == 30) { modPlayer.timerVial = 0; player.HealEffect(3, true); player.statLife += 3; } if (Main.rand.Next(15) == 0 && modPlayer.shamanDownpour && OrchidModShamanHelper.getNbShamanicBonds(player, modPlayer, mod) > 2) { int dmg = (int)(50 * modPlayer.shamanDamage + 5E-06f); target.StrikeNPCNoInteraction(dmg, 0f, 0); Main.PlaySound(2, (int)target.Center.X, (int)target.Center.Y - 200, 93); for (int i = 0; i < 15; i++) { int dust = Dust.NewDust(target.position, target.width, target.height, 226); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 2f; } } } } }