Files
CalamityModPublic/Buffs/StatBuffs/RageMode.cs
T
ben-tk 26dafb727e rage and adrenaline sounds
may mess with the rage end sound more later
2021-11-12 13:02:51 -05:00

43 lines
1.5 KiB
C#

using CalamityMod.CalPlayer;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatBuffs
{
public class RageMode : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Rage Mode");
Description.SetDefault("35% damage boost.");
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = false;
Main.buffNoTimeDisplay[Type] = true; // Because duration is variable, time is not displayed.
longerExpertDebuff = false;
canBeCleared = false;
}
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer mp = player.Calamity();
// If the player still has Rage left to burn, the buff stays active indefinitely.
if (mp.rage > 0f)
{
player.buffTime[buffIndex] = 2; // Every frame, give another frame for the buff to live.
mp.rageModeActive = true;
}
// Otherwise, Rage Mode ends instantly.
else
{
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/RageEnd"), player.position);
player.DelBuff(buffIndex--); // TML documentation requires you to decrement buffIndex if deleting the buff during Update.
mp.rageModeActive = false;
mp.rage = 0f;
}
}
}
}