246debuff and seconds to frames utilities

This commit is contained in:
termigator1359 committed 2020-04-16 20:23:01 -04:00
1 parent 4609f93027
commit 6aee63d78e
2 files changed
+75 -360

No files matched your search

+41 -360
View File
@@ -3568,9 +3568,9 @@ namespace CalamityMod.CalPlayer
if (player.FindBuffIndex(ModContent.BuffType<DraconicSurgeBuff>()) > -1)
{
player.ClearBuff(ModContent.BuffType<DraconicSurgeBuff>());
player.AddBuff(ModContent.BuffType<DraconicSurgeCooldown>(), 3600); //1 minute
player.AddBuff(ModContent.BuffType<DraconicSurgeCooldown>(), CalamityUtils.SecondsToFrames(60f));
}
player.AddBuff(ModContent.BuffType<GodSlayerCooldown>(), 2700);
player.AddBuff(ModContent.BuffType<GodSlayerCooldown>(), CalamityUtils.SecondsToFrames(45f));
return false;
}
if (silvaSet && silvaCountdown > 0)
@@ -3594,7 +3594,7 @@ namespace CalamityMod.CalPlayer
if (player.FindBuffIndex(ModContent.BuffType<DraconicSurgeBuff>()) > -1)
{
player.ClearBuff(ModContent.BuffType<DraconicSurgeBuff>());
player.AddBuff(ModContent.BuffType<DraconicSurgeCooldown>(), 3600); //1 minute
player.AddBuff(ModContent.BuffType<DraconicSurgeCooldown>(), CalamityUtils.SecondsToFrames(60f));
}
}
else if (silvaWings)
@@ -3616,8 +3616,8 @@ namespace CalamityMod.CalPlayer
}
if (permafrostsConcoction && player.FindBuffIndex(ModContent.BuffType<ConcoctionCooldown>()) == -1)
{
player.AddBuff(ModContent.BuffType<ConcoctionCooldown>(), 10800);
player.AddBuff(ModContent.BuffType<Encased>(), 180);
player.AddBuff(ModContent.BuffType<ConcoctionCooldown>(), CalamityUtils.SecondsToFrames(180f));
player.AddBuff(ModContent.BuffType<Encased>(), CalamityUtils.SecondsToFrames(3f));
player.statLife = player.statLifeMax2 * 3 / 10;
Main.PlaySound(SoundID.Item92, player.position);
for (int i = 0; i < 60; i++)
@@ -3971,7 +3971,7 @@ namespace CalamityMod.CalPlayer
num340 *= 1.5f;
num342 *= (float)player.direction;
num341 *= player.gravDir;
Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Mushroom, (int)((float)item.damage * 0.25f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f);
Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Mushroom, (int)(item.damage * 0.25f * player.MeleeDamage()), 0f, player.whoAmI, 0f, 0f);
}
}
if (aWeapon)
@@ -4073,126 +4073,38 @@ namespace CalamityMod.CalPlayer
}
if (cryogenSoul || frostFlare)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(BuffID.Frostburn, 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(BuffID.Frostburn, 240, false);
}
else
{
target.AddBuff(BuffID.Frostburn, 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn);
}
if (yInsignia)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<HolyFlames>());
}
if (ataxiaFire)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(BuffID.OnFire, 720, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(BuffID.OnFire, 480, false);
}
else
{
target.AddBuff(BuffID.OnFire, 240, false);
}
}
}
if (aWeapon)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 120, false);
CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire, 4f);
}
if (aWeapon)
{
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<AbyssalFlames>());
}
}
if (abyssalAmulet)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<CrushDepth>());
}
if (dsSetBonus)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<DemonFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<DemonFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<DemonFlames>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<DemonFlames>());
}
if (alchFlask)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<Plague>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<Plague>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<Plague>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<Plague>());
}
if (armorCrumbling || armorShattering)
{
if (item.melee || item.Calamity().rogue)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<ArmorCrunch>());
}
}
if (item.Calamity().rogue)
@@ -4303,33 +4215,11 @@ namespace CalamityMod.CalPlayer
if (abyssalAmulet)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<CrushDepth>());
}
if (dsSetBonus)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<DemonFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<DemonFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<DemonFlames>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<DemonFlames>());
}
if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189))
{
@@ -4337,18 +4227,7 @@ namespace CalamityMod.CalPlayer
}
else if (alchFlask)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<Plague>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<Plague>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<Plague>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<Plague>());
}
if (proj.melee)
{
@@ -4370,81 +4249,26 @@ namespace CalamityMod.CalPlayer
}
if (aWeapon)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<AbyssalFlames>());
}
if (cryogenSoul || frostFlare)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(BuffID.Frostburn, 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(BuffID.Frostburn, 240, false);
}
else
{
target.AddBuff(BuffID.Frostburn, 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn);
}
if (yInsignia)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<HolyFlames>());
}
if (ataxiaFire)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(BuffID.OnFire, 720, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(BuffID.OnFire, 480, false);
}
else
{
target.AddBuff(BuffID.OnFire, 240, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire, 4f);
}
}
if (armorCrumbling || armorShattering)
{
if (proj.melee || proj.Calamity().rogue)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 120, false);
}
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<ArmorCrunch>());
}
}
if (perforatorLore)
@@ -4577,95 +4401,29 @@ namespace CalamityMod.CalPlayer
}
if (aWeapon)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 120, false);
}
}
if (abyssalAmulet)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<AbyssalFlames>());
}
if (cryogenSoul || frostFlare)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(BuffID.Frostburn, 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(BuffID.Frostburn, 240, false);
}
else
{
target.AddBuff(BuffID.Frostburn, 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, BuffID.Frostburn);
}
if (yInsignia)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<HolyFlames>());
}
if (ataxiaFire)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(BuffID.OnFire, 720, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(BuffID.OnFire, 480, false);
}
else
{
target.AddBuff(BuffID.OnFire, 240, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, BuffID.OnFire, 4f);
}
}
if (alchFlask)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<Plague>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<Plague>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<Plague>(), 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<Plague>());
}
if (abyssalAmulet)
{
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<CrushDepth>());
}
if (item.Calamity().rogue)
{
if (player.meleeEnchant > 0)
@@ -4771,18 +4529,7 @@ namespace CalamityMod.CalPlayer
if (abyssalAmulet)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<CrushDepth>());
}
if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189))
{
@@ -4790,18 +4537,7 @@ namespace CalamityMod.CalPlayer
}
else if (alchFlask)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<Plague>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<Plague>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<Plague>(), 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<Plague>());
}
if (proj.melee)
{
@@ -4823,81 +4559,26 @@ namespace CalamityMod.CalPlayer
}
if (aWeapon)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<AbyssalFlames>());
}
if (cryogenSoul || frostFlare)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(BuffID.Frostburn, 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(BuffID.Frostburn, 240, false);
}
else
{
target.AddBuff(BuffID.Frostburn, 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, BuffID.Frostburn);
}
if (yInsignia)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<HolyFlames>());
}
if (ataxiaFire)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(BuffID.OnFire, 720, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(BuffID.OnFire, 480, false);
}
else
{
target.AddBuff(BuffID.OnFire, 240, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, BuffID.OnFire, 4f);
}
}
if (armorCrumbling || armorShattering)
{
if (proj.melee || proj.Calamity().rogue)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 360, false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 240, false);
}
else
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 120, false);
}
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<ArmorCrunch>());
}
}
if (perforatorLore)
+34
View File
@@ -2514,6 +2514,40 @@ namespace CalamityMod
if (condition)
list.Add(type);
}
public static void Inflict246DebuffsNPC(NPC target, int buff, float timeBase = 2f)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(buff, SecondsToFrames(timeBase * 3f), false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(buff, SecondsToFrames(timeBase * 2f), false);
}
else
{
target.AddBuff(buff, SecondsToFrames(timeBase), false);
}
}
public static void Inflict246DebuffsPvp(Player target, int buff, float timeBase = 2f)
{
if (Main.rand.NextBool(4))
{
target.AddBuff(buff, SecondsToFrames(timeBase * 3f), false);
}
else if (Main.rand.NextBool(2))
{
target.AddBuff(buff, SecondsToFrames(timeBase * 2f), false);
}
else
{
target.AddBuff(buff, SecondsToFrames(timeBase), false);
}
}
public static int SecondsToFrames(float seconds) => (int)(seconds * 60);
#endregion
}
}