PersistentBuffList.
This commit is contained in:
1 parent
30a2e249e1
commit
04d05c56eb
4 files changed
+47
-22
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user