From b553aff0d2f655880d4a0b57b243762eb2a924a1 Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Thu, 5 Dec 2019 17:30:42 -0800 Subject: [PATCH] Added in a few more preconditions. Time to make events. --- .../CommunityCenterCompleted.cs | 38 +++++++++++++++++++ .../PlayerSpecific/NotDatingAnyone.cs | 36 ++++++++++++++++++ GeneralMods/StardustCore/StardustCore.csproj | 2 + 3 files changed, 76 insertions(+) create mode 100644 GeneralMods/StardustCore/Events/Preconditions/PlayerSpecific/CommunityCenterCompleted.cs create mode 100644 GeneralMods/StardustCore/Events/Preconditions/PlayerSpecific/NotDatingAnyone.cs diff --git a/GeneralMods/StardustCore/Events/Preconditions/PlayerSpecific/CommunityCenterCompleted.cs b/GeneralMods/StardustCore/Events/Preconditions/PlayerSpecific/CommunityCenterCompleted.cs new file mode 100644 index 00000000..ea6b00af --- /dev/null +++ b/GeneralMods/StardustCore/Events/Preconditions/PlayerSpecific/CommunityCenterCompleted.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace StardustCore.Events.Preconditions.PlayerSpecific +{ + public class CommunityCenterCompleted: EventPrecondition + { + /// + /// False means the community center doesn't need to be completed. + /// + bool needsToBeCompleted; + + public CommunityCenterCompleted() + { + + } + + public CommunityCenterCompleted(bool NeedsToBeCompleted) + { + this.needsToBeCompleted = NeedsToBeCompleted; + } + + public override string ToString() + { + return "Omegasis.EventFramework.Preconditions.Player.CommunityCenterCompleted?"; + } + + public override bool meetsCondition() + { + return this.needsToBeCompleted == Game1.player.hasCompletedCommunityCenter(); + } + + } +} diff --git a/GeneralMods/StardustCore/Events/Preconditions/PlayerSpecific/NotDatingAnyone.cs b/GeneralMods/StardustCore/Events/Preconditions/PlayerSpecific/NotDatingAnyone.cs new file mode 100644 index 00000000..68f4383b --- /dev/null +++ b/GeneralMods/StardustCore/Events/Preconditions/PlayerSpecific/NotDatingAnyone.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace StardustCore.Events.Preconditions.PlayerSpecific +{ + public class NotDatingAnyone: EventPrecondition + { + public NotDatingAnyone() + { + + } + + public override string ToString() + { + return "Omegasis.EventFramework.Precondition.NotDatingAnyone"; + } + + + public override bool meetsCondition() + { + foreach(GameLocation loc in Game1.locations) + { + foreach (NPC npc in loc.getCharacters()) + { + if (Game1.player.friendshipData[npc.Name].IsDating()) return false; + } + } + return true; + } + + } +} diff --git a/GeneralMods/StardustCore/StardustCore.csproj b/GeneralMods/StardustCore/StardustCore.csproj index 34aa5a8c..6175872e 100644 --- a/GeneralMods/StardustCore/StardustCore.csproj +++ b/GeneralMods/StardustCore/StardustCore.csproj @@ -104,6 +104,7 @@ + @@ -112,6 +113,7 @@ +