PersistentBuffList.

This commit is contained in:
Flowaria authored and Cameron Ewell committed 2024-11-13 16:18:35 -05:00
1 parent 30a2e249e1
commit 04d05c56eb
4 files changed
+47 -22

No files matched your search

+1 -1
View File
@@ -3868,7 +3868,7 @@ namespace CalamityMod.CalPlayer
else
{
// Reset buff persistence if Amalgam is removed.
if (Main.persistentBuff[buffID] && !CalamityLists.persistentBuffList.Contains(buffID))
if (Main.persistentBuff[buffID] && !PersistentBuffList.IsPersistentBuff(buffID))
Main.persistentBuff[buffID] = false;
}
}
-17
View File
@@ -66,7 +66,6 @@ namespace CalamityMod
{
public sealed class CalamityLists : ModSystem
{
public static List<int> persistentBuffList;
public static List<int> MagicGunIDs;
public static List<int> BlacklistedWeaponsWithToolPower;
@@ -127,21 +126,6 @@ namespace CalamityMod
public override void OnModLoad()
{
persistentBuffList = new List<int>()
{
BuffType<WeaponImbueBrimstone>(),
BuffType<WeaponImbueCrumbling>(),
BuffType<WeaponImbueHolyFlames>(),
BuffID.WeaponImbueVenom,
BuffID.WeaponImbueCursedFlames,
BuffID.WeaponImbueFire,
BuffID.WeaponImbueGold,
BuffID.WeaponImbueIchor,
BuffID.WeaponImbueNanites,
BuffID.WeaponImbueConfetti,
BuffID.WeaponImbuePoison
};
MagicGunIDs = new List<int>()
{
ItemType<AbyssShocker>(),
@@ -1182,7 +1166,6 @@ namespace CalamityMod
public override void Unload()
{
persistentBuffList = null;
MagicGunIDs = null;
BlacklistedWeaponsWithToolPower = null;
+4 -4
View File
@@ -929,21 +929,21 @@ namespace CalamityMod
}
public static bool SetPersistentBuffList(int type, bool isPersistent)
{
if (isPersistent && !CalamityLists.persistentBuffList.Contains(type))
if (isPersistent && !PersistentBuffList.IsPersistentBuff(type))
{
CalamityLists.persistentBuffList.Add(type);
PersistentBuffList.List.Add(type);
return true;
}
else if (!isPersistent)
{
return CalamityLists.persistentBuffList.Remove(type);
return PersistentBuffList.List.Remove(type);
}
return false;
}
public static bool IsOnAmalgamBuffList(int type) => AmalgamBuffList.IsBuffBoostedByAmalgan(type);
public static bool IsOnPersistentBuffList(int type) => CalamityLists.persistentBuffList.Contains(type);
public static bool IsOnPersistentBuffList(int type) => PersistentBuffList.IsPersistentBuff(type);
#endregion
#region Venerated Locket Bans
+42
View File
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.Buffs.Potions;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Systems.Collections
{
public sealed class PersistentBuffList : ModSystem
{
public static IList<int> List { get; private set; }
public override void OnModLoad()
{
List =
[
BuffType<WeaponImbueBrimstone>(),
BuffType<WeaponImbueCrumbling>(),
BuffType<WeaponImbueHolyFlames>(),
BuffID.WeaponImbueVenom,
BuffID.WeaponImbueCursedFlames,
BuffID.WeaponImbueFire,
BuffID.WeaponImbueGold,
BuffID.WeaponImbueIchor,
BuffID.WeaponImbueNanites,
BuffID.WeaponImbueConfetti,
BuffID.WeaponImbuePoison
];
}
public override void Unload() => List = null;
/// <summary>
/// A shorthand method to check if this buffType is a PersistentBuff.
/// </summary>
public static bool IsPersistentBuff(int buffType) => List.Contains(buffType);
}
}