Exemple #1
0
        public void CreateReceivedRemoteToken(
            SituationCreationCommand situationCreationCommand,
            string locatorInfo = null)
        {
            var newToken =
                CreateTokenWithAttachedControllerAndSituation(situationCreationCommand, locatorInfo) as SituationToken;

            // ReSharper disable once PossibleNullReferenceException
            newToken.SetRemote(false);
        }
Exemple #2
0
        public void ReceiveRemoteSituation(string verbId, string recipeId)
        {
            var compendium = Registry.Retrieve <ICompendium>();
            var recipe     = compendium.GetRecipeById(recipeId);
            var command    = new SituationCreationCommand(
                compendium.GetVerbById(verbId), compendium.GetRecipeById(recipeId), SituationState.Ongoing)
            {
                TimeRemaining = recipe.Warmup
            };

            _situationBuilder.CreateReceivedRemoteToken(command);
        }
        public new void SituationExecutingRecipe(ISituationEffectCommand command)
        {
            var tabletopManager = Registry.Retrieve <ITabletopManager>();

            situationWindow.SetSlotConsumptions();
            StoreStacks(situationWindow.GetOngoingStacks());

            if (command.AsNewSituation)
            {
                List <IElementStack> stacksToAddToNewSituation = new List <IElementStack>();
                if (command.Expulsion != null)
                {
                    AspectMatchFilter filter = new AspectMatchFilter(command.Expulsion.Filter);
                    var filteredStacks       = filter.FilterElementStacks(situationWindow.GetStoredStacks()).ToList();
                    if (filteredStacks.Any() && command.Expulsion.Limit > 0)
                    {
                        while (filteredStacks.Count > command.Expulsion.Limit)
                        {
                            filteredStacks.RemoveAt(filteredStacks.Count - 1);
                        }

                        stacksToAddToNewSituation = filteredStacks;
                    }
                }

                IVerb verbForNewSituation = compendium.GetOrCreateVerbForCommand(command);
                var   scc = new SituationCreationCommand(
                    verbForNewSituation,
                    command.Recipe,
                    SituationState.FreshlyStarted,
                    situationToken as DraggableToken);
                if (command is SituationEffectCommand seCommand)
                {
                    scc.SendAway = seCommand.SendAway;
                }
                tabletopManager.BeginNewSituation(scc, stacksToAddToNewSituation);
                situationWindow.DisplayStoredElements();
                return;
            }

            currentCharacter.AddExecutionsToHistory(command.Recipe.Id, 1);
            var executor = new SituationEffectExecutor();

            executor.RunEffects(command, situationWindow.GetStorageStacksManager(), currentCharacter);

            if (command.Recipe.EndingFlag != null)
            {
                var ending = compendium.GetEndingById(command.Recipe.EndingFlag);
                tabletopManager.EndGame(ending, this);
            }

            situationWindow.DisplayStoredElements();
        }
        private void InitialiseActiveSituation(SituationCreationCommand command)
        {
            orig_InitialiseActiveSituation(command);

            SendingAway = command.SendAway;
            if (!SendingAway)
            {
                return;
            }
            SituationToken token = situationToken as SituationToken;

            if (token != null)
            {
                token.SetRemote(true);
            }
            var tabletopManager = Registry.Retrieve <ITabletopManager>() as TabletopManager;

            if (tabletopManager != null)
            {
                tabletopManager.SendRemoteSituation(command.Verb.Id, command.Recipe.Id);
            }
        }
 private extern void orig_InitialiseActiveSituation(SituationCreationCommand command);