Files
CalamityModPublic/Buffs/CalamityGlobalBuff.cs
T

157 lines
5.1 KiB
C#

using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.World;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs
{
public class CalamityGlobalBuff : GlobalBuff
{
public override void Update(int type, Player player, ref int buffIndex)
{
if (type == BuffID.Shine)
{
player.Calamity().shine = true;
}
else if (type == BuffID.IceBarrier)
{
player.endurance -= 0.1f;
}
else if (type == BuffID.ObsidianSkin)
{
player.lavaMax += 420;
}
else if (type >= BuffID.NebulaUpDmg1 && type <= BuffID.NebulaUpDmg3)
{
float nebulaDamage = 0.075f * player.nebulaLevelDamage; //7.5% to 22.5%
player.allDamage -= nebulaDamage;
}
else if (type >= BuffID.NebulaUpLife1 && type <= BuffID.NebulaUpLife3)
{
player.lifeRegen -= 5 * player.nebulaLevelLife; //10 to 30 changed to 5 to 15
}
else if (type == BuffID.Warmth)
{
player.buffImmune[ModContent.BuffType<GlacialState>()] = true;
player.buffImmune[BuffID.Frozen] = true;
player.buffImmune[BuffID.Chilled] = true;
}
}
public override void Update(int type, NPC npc, ref int buffIndex)
{
if (type == BuffID.Webbed)
{
if (npc.Calamity().webbed < npc.buffTime[buffIndex])
npc.Calamity().webbed = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
else if (type == BuffID.Slow)
{
if (npc.Calamity().slowed < npc.buffTime[buffIndex])
npc.Calamity().slowed = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
if (type == BuffID.Electrified)
{
if (npc.Calamity().electrified < npc.buffTime[buffIndex])
npc.Calamity().electrified = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
}
public override void ModifyBuffTip(int type, ref string tip, ref int rare)
{
Player player = Main.player[Main.myPlayer];
//Vanilla buffs
switch (type)
{
case BuffID.NebulaUpDmg1:
tip = "7.5% increased damage";
break;
case BuffID.NebulaUpDmg2:
tip = "15% increased damage";
break;
case BuffID.NebulaUpDmg3:
tip = "22.5% increased damage";
break;
case BuffID.BeetleEndurance1:
tip = "Damage taken reduced by 10%";
break;
case BuffID.BeetleEndurance2:
tip = "Damage taken reduced by 20%";
break;
case BuffID.BeetleEndurance3:
tip = "Damage taken reduced by 30%";
break;
case BuffID.WeaponImbueVenom:
case BuffID.WeaponImbueCursedFlames:
case BuffID.WeaponImbueFire:
case BuffID.WeaponImbueGold:
case BuffID.WeaponImbueIchor:
case BuffID.WeaponImbueNanites:
case BuffID.WeaponImbuePoison:
tip = "Rogue and " + tip;
break;
case BuffID.WeaponImbueConfetti:
tip = "All attacks cause confetti to appear";
break;
case BuffID.IceBarrier:
tip = "Damage taken is reduced by 15%";
break;
case BuffID.ChaosState:
tip = "Rod of Discord teleports are disabled";
break;
case BuffID.CursedInferno:
if (CalamityWorld.revenge)
tip += ". All damage taken increased by 20%";
break;
case BuffID.Warmth:
tip += ". Immunity to the Chilled, Frozen, and Glacial State debuffs";
if (CalamityWorld.death)
tip += ". Provides cold protection in Death Mode";
break;
case BuffID.Invisibility:
tip += ". Grants rogue bonuses while holding certain rogue weapons";
break;
case BuffID.ObsidianSkin:
if (CalamityWorld.death)
tip += ". Provides heat protection in Death Mode";
break;
case BuffID.Inferno:
if (CalamityWorld.death)
tip += ". Provides cold protection in Death Mode";
break;
case BuffID.Campfire:
if (CalamityWorld.death)
tip += ". Provides cold protection in Death Mode";
break;
case BuffID.Daybreak:
tip = "Incinerated by solar rays";
break;
}
}
}
}