Merge of BasicallyIAmFox's Conditions Class with 2.0.4.001

This commit is contained in:
Ozzatron committed 2024-05-13 19:25:18 -04:00
commit a99a44be2d
6431 files changed
+117092 -65532

No files matched your search

+19 -9
View File
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using CalamityMod.Items.Accessories;
using CalamityMod.NPCs.SulphurousSea;
using CalamityMod.Items.Potions;
using CalamityMod.NPCs.SulphurousSea;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
@@ -286,7 +286,8 @@ namespace CalamityMod
/// Adds all the common potions for fishing crates, alongside scaling mana and regen potions
/// </summary>
/// <param name="loot">The ILoot interface for the loot table.</param>
public static void AddCratePotionRules(this ILoot loot)
/// <param name="hardMode">Whether or not the crate is considered a hardmode crate.</param>
public static void AddCratePotionRules(this ILoot loot, bool hardMode = true)
{
loot.Add(ItemID.ObsidianSkinPotion, 10, 1, 3);
loot.Add(ItemID.SwiftnessPotion, 10, 1, 3);
@@ -311,14 +312,23 @@ namespace CalamityMod
var lcrRegularPotion = new LeadingConditionRule(If(() => NPC.downedBoss3));
// Actually chain all the LCRs together
lcrSupremePotion.Add(supremePots);
lcrSupremePotion.OnFailedConditions(lcrSuperPotion);
lcrSuperPotion.Add(superPots);
lcrSuperPotion.OnFailedConditions(lcrGreaterPotion);
lcrGreaterPotion.Add(greaterPots);
lcrGreaterPotion.OnFailedConditions(lcrRegularPotion);
// Greater potions upwards are only chained if the crate is marked as Hardmode
if (hardMode)
{
lcrSupremePotion.Add(supremePots);
lcrSupremePotion.OnFailedConditions(lcrSuperPotion);
lcrSuperPotion.Add(superPots);
lcrSuperPotion.OnFailedConditions(lcrGreaterPotion);
lcrGreaterPotion.Add(greaterPots);
lcrGreaterPotion.OnFailedConditions(lcrRegularPotion);
}
lcrRegularPotion.Add(regularPots);
lcrRegularPotion.OnFailedConditions(lesserPots);
// Add the chain starting from regular potions if marked as a Pre-Hardmode crate
if (!hardMode)
{
loot.Add(lcrRegularPotion);
}
}
#endregion
@@ -1108,7 +1118,7 @@ namespace CalamityMod
// You can customize this duration as you see fit. Calamity defaults it to 5 minutes.
private const int DefaultDropProtectionTime = 18000; // 5 minutes
private int protectionTime;
public PerPlayerDropRule(int itemID, int denominator, int minQuantity = 1, int maxQuantity = 1, int numerator = 1, int protectFrames = DefaultDropProtectionTime)
: base(itemID, denominator, minQuantity, maxQuantity, numerator)
{