예제 #1
0
 public StealGameCommandModel(string name, HashSet <string> triggers, GamePlayerSelectionType playerSelectionType, GameOutcomeModel successfulOutcome, CustomCommandModel failedCommand)
     : base(name, triggers, GameCommandTypeEnum.Steal)
 {
     this.PlayerSelectionType = playerSelectionType;
     this.SuccessfulOutcome   = successfulOutcome;
     this.FailedCommand       = failedCommand;
 }
        protected async Task SetSelectedUser(GamePlayerSelectionType selectionType, CommandParametersModel parameters)
        {
            if (selectionType.HasFlag(GamePlayerSelectionType.Targeted))
            {
                await parameters.SetTargetUser();

                if (parameters.TargetUser != null)
                {
                    if (parameters.IsTargetUserSelf)
                    {
                        parameters.TargetUser = null;
                    }
                    else if (!ChannelSession.Services.User.IsUserActive(parameters.TargetUser.ID))
                    {
                        parameters.TargetUser = null;
                        return;
                    }
                }
            }

            if (parameters.TargetUser == null && selectionType.HasFlag(GamePlayerSelectionType.Random))
            {
                parameters.TargetUser = this.GetRandomUser(parameters);
            }
        }
예제 #3
0
        private GamePlayerSelectionType GetSelectionType()
        {
#pragma warning disable CS0612 // Type or member is obsolete
            GamePlayerSelectionType selectionType = GamePlayerSelectionType.None;
#pragma warning restore CS0612 // Type or member is obsolete
            if (this.UserSelectionTargeted)
            {
                selectionType |= GamePlayerSelectionType.Targeted;
            }
            if (this.UserSelectionRandom)
            {
                selectionType |= GamePlayerSelectionType.Random;
            }
            return(selectionType);
        }
        protected async Task SetSelectedUser(GamePlayerSelectionType selectionType, CommandParametersModel parameters)
        {
            if (selectionType.HasFlag(GamePlayerSelectionType.Targeted))
            {
                await parameters.SetTargetUser();

                if (parameters.IsTargetUserSelf)
                {
                    parameters.TargetUser = null;
                }
            }

            if (parameters.TargetUser == null && selectionType.HasFlag(GamePlayerSelectionType.Random))
            {
                parameters.TargetUser = this.GetRandomUser(parameters);
            }
        }
예제 #5
0
 public HotPotatoGameCommandModel(string name, HashSet <string> triggers, int lowerTimeLimit, int upperTimeLimit, bool resetTimeOnToss, GamePlayerSelectionType playerSelectionType,
                                  CustomCommandModel startedCommand, CustomCommandModel tossPotatoCommand, CustomCommandModel potatoExplodeCommand)
     : base(name, triggers, GameCommandTypeEnum.HotPotato)
 {
     this.LowerTimeLimit       = lowerTimeLimit;
     this.UpperTimeLimit       = upperTimeLimit;
     this.ResetTimeOnToss      = resetTimeOnToss;
     this.PlayerSelectionType  = playerSelectionType;
     this.StartedCommand       = startedCommand;
     this.TossPotatoCommand    = tossPotatoCommand;
     this.PotatoExplodeCommand = potatoExplodeCommand;
 }
 public DuelGameCommandModel(string name, HashSet <string> triggers, int timeLimit, GamePlayerSelectionType playerSelectionType, CustomCommandModel startedCommand, CustomCommandModel notAcceptedCommand,
                             GameOutcomeModel successfulOutcome, CustomCommandModel failedCommand)
     : base(name, triggers, GameCommandTypeEnum.Duel)
 {
     this.TimeLimit           = timeLimit;
     this.PlayerSelectionType = playerSelectionType;
     this.StartedCommand      = startedCommand;
     this.NotAcceptedCommand  = notAcceptedCommand;
     this.SuccessfulOutcome   = successfulOutcome;
     this.FailedCommand       = failedCommand;
 }