コード例 #1
0
ファイル: LocationsHelper.cs プロジェクト: TomasMike/TG
        public static IEnumerable <int> GetNeighbourLocationNumbers(LocationCardControl lcc)
        {
            var retVal = new List <int>()
            {
                lcc.NorthDirectionKey, lcc.EastDirectionKey, lcc.SouthDirectionKey, lcc.WestDirectionKey
            };

            retVal.RemoveAll(_ => _ == 0);
            return(retVal);
        }
コード例 #2
0
ファイル: MenhirHelper.cs プロジェクト: TomasMike/TG
        public static bool AreAllActivationRequirementsMet(LocationCardControl lcc)
        {
            var requirement = lcc.MenhirActivationRequirement;

            return
                (AreAllPlayersInLocation(lcc) &&
                 requirement.RequiredItems.All(i => HavePlayersItem(i)) &&
                 requirement.RequiredSecretsByName.All(i => HavePlayersSecret(i)) &&
                 requirement.RequiredSecretsByNumber.All(i => HavePlayersSecret(i)) &&
                 requirement.PerCharacterCosts.All(i => HavePlayersEnoughResource(i.Key, i.Value * Game.Instance.Players.Count)) &&
                 (requirement.RequiredActiveMenhirInLocation || lcc.MenhirValue >= 0) &&
                 requirement.RequiredStatuses.All(i => i.Value == SaveManager.CurrentSaveSheet.CheckStatus(i.Key)));
        }
コード例 #3
0
ファイル: LocationsHelper.cs プロジェクト: TomasMike/TG
        public static IEnumerable <LocationCardControl> GetNeighbourLCCs(LocationCardControl lcc, bool returnOnlyInPlayLocations = false)
        {
            var retVal = new List <LocationCardControl>()
            {
                returnOnlyInPlayLocations?GetLCControlInPlay(lcc.NorthDirectionKey) : GetLCControl(lcc.NorthDirectionKey),
                    returnOnlyInPlayLocations ? GetLCControlInPlay(lcc.EastDirectionKey)  : GetLCControl(lcc.EastDirectionKey),
                    returnOnlyInPlayLocations ? GetLCControlInPlay(lcc.SouthDirectionKey) : GetLCControl(lcc.SouthDirectionKey),
                    returnOnlyInPlayLocations ? GetLCControlInPlay(lcc.WestDirectionKey)  : GetLCControl(lcc.WestDirectionKey)
            };

            retVal.RemoveAll(_ => _ == null);
            return(retVal);
        }
コード例 #4
0
ファイル: MenhirHelper.cs プロジェクト: TomasMike/TG
        public static string GetMenhirActivationDescription(LocationCardControl lcc)
        {
            var sb = new StringBuilder();

            sb.AppendLine($"[{(AreAllPlayersInLocation(lcc) ? "DONE":"NOT")}] Requires all Characters.");
            sb.AppendLine();

            var requirement = lcc.MenhirActivationRequirement;

            foreach (var itemName in requirement.RequiredItems)
            {
                sb.AppendLine($"[{(HavePlayersItem(itemName) ? "DONE" : "NOT")}] {itemName}");
            }

            foreach (var secretName in requirement.RequiredSecretsByName)
            {
                sb.AppendLine($"[{(HavePlayersSecret(secretName) ? "DONE" : "NOT")}] {secretName}");
            }

            foreach (var secretNumber in requirement.RequiredSecretsByNumber)
            {
                sb.AppendLine($"[{(HavePlayersSecret(secretNumber) ? "DONE" : "NOT")}] Secret {secretNumber}");
            }

            foreach (var costs in requirement.PerCharacterCosts)
            {
                var reqAmount = costs.Value * Game.Instance.Players.Count;
                sb.AppendLine($"[{(HavePlayersEnoughResource(costs.Key,reqAmount) ? "DONE" : "NOT")}] {costs.Key} per player => {reqAmount} {costs.Key}");
            }

            if (requirement.RequiredActiveMenhirInLocation)
            {
                sb.AppendLine($"[{(lcc.MenhirValue >= 0 ? "DONE" : "NOT")}]  Have an active menhir in this location");
            }

            foreach (var reqStatus in requirement.RequiredStatuses)
            {
                sb.AppendLine($"[{(SaveManager.CurrentSaveSheet.CheckStatus(reqStatus.Key) == reqStatus.Value ? "DONE" : "NOT")}] {(reqStatus.Value ? "Have" : "Not have")} {reqStatus.Key} status");
            }

            return(sb.ToString());
        }
コード例 #5
0
ファイル: MenhirHelper.cs プロジェクト: TomasMike/TG
 private static bool AreAllPlayersInLocation(LocationCardControl lcc)
 {
     return(Game.Instance.Players.All(p => p.CurrentLocation == lcc.LocationNumber));
 }
コード例 #6
0
ファイル: LocationsHelper.cs プロジェクト: TomasMike/TG
 public static IEnumerable <LocationCardControl> GetSurroundingLCCInPlay(LocationCardControl lcc)
 {
     return(GetSurroundingLocationsNumbers(lcc.LocationNumber).Select(_ => GetLCControlInPlay(_)).Where(_ => _ != null));
 }