Example #1
0
                public override void Run(TextBasedAdventure.Base.Move Move)
                {
                    var SayMove = Move as Move;

                    if (SayMove.Target != null)
                    {
                        (SayMove.Target as Actor).Listen(SayMove.Actor, SayMove.Message);
                    }
                    else
                    {
                        foreach (var actor in Move.Actor.CurrentArea.Actors.Where(a => a != Move.Actor))
                        {
                            actor.Listen(SayMove.Actor, SayMove.Message);
                        }
                    }
                }
Example #2
0
 public virtual bool ModifyMove(ref Move Move)
 {
     return(false); // by default, don't interrupt the move
 }
Example #3
0
                public override bool TryParse(IEnumerable <string> Arguments, Actor Actor, out TextBasedAdventure.Base.Move Move)
                {
                    Move = null;

                    if (!Arguments.Any())
                    {
                        return(false);
                    }

                    if (Arguments.Where(arg => arg.ToLower() == "to").Any())
                    {
                        var target_tokens = Arguments.SkipWhile(arg => arg.ToLower() != "to").Skip(1);

                        if (!target_tokens.Any())
                        {
                            return(false);
                        }

                        var targets = Actor.CurrentArea.FindObject(string.Join(" ", target_tokens));

                        if (!targets.Any())
                        {
                            return(false);
                        }

                        var message = Arguments.Take(Arguments.Count() - (target_tokens.Count() + 1));

                        if (!message.Any())
                        {
                            return(false);
                        }

                        Move = new Move(this, Actor, string.Join(" ", message), targets.First());

                        return(true);
                    }
                    else
                    {
                        Move = new Move(this, Actor, string.Join(" ", Arguments), null);

                        return(true);
                    }
                }