Esempio n. 1
0
        /// <summary>Prepares the base character.</summary>
        /// <param name="session">The session.</param>
        /// <returns>Filled out base character.</returns>
        public static Thing PrepareBaseCharacter(Session session)
        {
            var movableBehavior        = new MovableBehavior();
            var livingBehavior         = new LivingBehavior();
            var sensesBehavior         = new SensesBehavior();
            var userControlledBehavior = new UserControlledBehavior()
            {
                Controller = session,
            };
            var playerBehavior = new PlayerBehavior(sensesBehavior, userControlledBehavior)
            {
                SessionId = session.ID,
            };

            var player = new Thing(livingBehavior, sensesBehavior, userControlledBehavior, playerBehavior, movableBehavior);

            var game = GameSystemController.Instance;

            // Load the default stats for the current gaming system
            foreach (var gameStat in game.GameStats)
            {
                var currStat = new GameStat(session, gameStat.Name, gameStat.Abbreviation, gameStat.Formula, gameStat.Value, gameStat.MinValue, gameStat.MaxValue, gameStat.Visible);
                player.Stats.Add(currStat.Abbreviation, currStat);
            }

            // Load the secondary stats\attributes for the current gaming system
            foreach (var attribute in game.GameAttributes)
            {
                var newAttribute = new GameAttribute(session, attribute.Name, attribute.Abbreviation, attribute.Formula, attribute.Value, attribute.MinValue, attribute.MaxValue, attribute.Visible);
                player.Attributes.Add(newAttribute.Abbreviation, newAttribute);
            }

            return(player);
        }
Esempio n. 2
0
        private static void FindStat(string statNameToFind)
        {
            var statToFind = parentThing.FindGameStat(statNameToFind);

            var stat = (WRMStat)Convert.ChangeType(statToFind, typeof(WRMStat));

            privateStat = (GameStat)Convert.ChangeType(parentThing.FindGameStat(stat.Name), typeof(GameStat));
        }
Esempio n. 3
0
        /// <summary>
        /// Adds the game stat to this <see cref="Thing"/>.
        /// </summary>
        /// <param name="gameStat">The game stat to be added.</param>
        public void AddStat(GameStat gameStat)
        {
            gameStat.Parent = this;

            this.Stats.Add(gameStat.Name, gameStat);

            gameStat.OnAdd();
        }
Esempio n. 4
0
 /// <summary>Removes the game stat from this <see cref="Thing"/>.</summary>
 /// <param name="gameStat">The game stat to be removed.</param>
 public void RemoveStat(GameStat gameStat)
 {
     gameStat.Parent = null;
     if (Stats.ContainsKey(gameStat.Name))
     {
         Stats.Remove(gameStat.Name);
     }
     gameStat.OnRemove();
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StatEffect" /> class.
 /// </summary>
 /// <param name="activeThing">The active thing.</param>
 /// <param name="stat">The stat.</param>
 /// <param name="valueMod">The modification to the stat's value.</param>
 /// <param name="minimumMod">The modification to the stat's minimum.</param>
 /// <param name="maximumMod">The modification to the stat's maximum.</param>
 /// <param name="duration">The duration of the effect.</param>
 /// <param name="sensoryMessage">The sensory message.</param>
 /// <param name="expirationMessage">The expiration message.</param>
 public StatEffect(Thing activeThing, GameStat stat, int valueMod, int minimumMod, int maximumMod, TimeSpan duration, SensoryMessage sensoryMessage, SensoryMessage expirationMessage)
     : base(duration)
 {
     this.Name = stat.Name;
     this.Stat = stat;
     this.ValueMod = valueMod;
     this.MinimumMod = minimumMod;
     this.MaximumMod = maximumMod;
     this.ActiveThing = activeThing;
     this.SensoryMessage = sensoryMessage;
     this.ExpirationMessage = expirationMessage;
     this.Duration = duration;
 }
Esempio n. 6
0
        /// <summary>Prepares the base character.</summary>
        /// <param name="session">The session.</param>
        /// <returns>Filled out base character.</returns>
        public static Thing PrepareBaseCharacter(Session session)
        {
            var movableBehavior = new MovableBehavior();
            var livingBehavior = new LivingBehavior();
            var sensesBehavior = new SensesBehavior();
            var userControlledBehavior = new UserControlledBehavior()
            {
                Controller = session,
            };
            var playerBehavior = new PlayerBehavior(sensesBehavior, userControlledBehavior)
            {
                SessionId = session.ID,
            };

            var player = new Thing(livingBehavior, sensesBehavior, userControlledBehavior, playerBehavior, movableBehavior);

            var game = GameSystemController.Instance;

            // Load the default stats for the current gaming system
            foreach (var gameStat in game.GameStats)
            {
                var currStat = new GameStat(session, gameStat.Name, gameStat.Abbreviation, gameStat.Formula, gameStat.Value, gameStat.MinValue, gameStat.MaxValue, gameStat.Visible);
                player.Stats.Add(currStat.Abbreviation, currStat);
            }

            // Load the secondary stats\attributes for the current gaming system
            foreach (var attribute in game.GameAttributes)
            {
                var newAttribute = new GameAttribute(session, attribute.Name, attribute.Abbreviation, attribute.Formula, attribute.Value, attribute.MinValue, attribute.MaxValue, attribute.Visible);
                player.Attributes.Add(newAttribute.Abbreviation, newAttribute);
            }

            return player;
        }