Esempio n. 1
0
 Act(Person s, Verb v, Noun o1, Noun o2, Act c, System.Action<Act> R)
     : this()
 {
     //Debug.Assert(Arity(v) == 2 || o2, v.ToString() + " is a ternary verb.");
     subject = s; verb = v; primaryObject = o1; secondaryObject = o2; parent = c; Register = R;
     args = new VerbArguments(this);
     Register(this);
 }
        public Act LastInteraction(Person to)
        {
            // wtf thanks for the undocumented "derr I couldn't find one" exception you M$ retards
            if (!memory.Exists(a => a.subject == this && a.args.Who == to)) return null;

            // double thanks for not supporting conversion from Predicate<Act> to Func<Act, bool>
            // f**k code reuse anyway
            return memory.Last(a => a.subject == this && a.args.Who == to);
        }
Esempio n. 3
0
 public Person ClosestPerson(Person whoIsAsking)
 {
     var tmp = new List<Person>(acters);
     tmp.Remove(whoIsAsking);
     return tmp.OrderBy(p =>
     {
         var delta = new Vector2(p.X - whoIsAsking.X, p.Y - whoIsAsking.Y );
         delta *= delta;
         return delta.Length();
     }).First();
 }
 public string Hail(Person who)
 {
     //var rval = Quirks & Quirk.CASUAL ? "Hey, " : "";
     var rval = "";
     if (AmbiguousListener)
     {
         rval += who;
         rval = Helper.Capitalize(rval);
     }
     if (rval.Length > 0 && !rval.EndsWith(", ")) rval += ", ";
     return rval;
 }
Esempio n. 5
0
 string ProOrProperNoun(Person who)
 {
     if (who == acter) return "I";
     else if (who == actedOn) return "you";
     else return who;
 }
Esempio n. 6
0
 /// <summary> She pours tequila on him. </summary>
 /// <param name="subject"> She </param>
 /// <param name="verb"> pours </param>
 /// <param name="primaryObject"> tequila </param>
 /// <param name="secondaryObject"> him </param>
 public Act Cause(Person subject, Verb verb, Noun primaryObject, Noun secondaryObject)
 {
     return new Act(subject, verb, primaryObject, secondaryObject, this, Register);
 }
Esempio n. 7
0
 /// <summary> She pours tequila. </summary>
 /// <param name="subject"> She </param>
 /// <param name="verb"> pours </param>
 /// <param name="_object"> tequila. </param>
 public Act Cause(Person subject, Verb verb, Noun _object)
 {
     return Cause(subject, verb, _object, Noun.NOTHING);
 }
        protected void Enlist(Person other, Act need)
        {
            Listener = other;

            Debug.Assert(need.verb == Verb.NEED);
            var gimme = need.Cause(this, Verb.ASK_FOR, other, need.args.What);

            Commit(gimme);
        }
        protected void Respond(Person other, bool affirm)
        {
            Listener = other;

            var context = other.LastInteraction(this);
            if (!context) context = Act.NO_ACT;

            Act a;
            switch (context.verb)
            {
                case Verb.ASK_FOR:
                    if (affirm)
                    {
                        a = context.Cause(this, Verb.PROMISE, other, context.args.What);
                        quests.Add(a);
                    }
                    else a = context.Cause(this, Verb.IDLE, other);
                    break;
                case Verb.TALK:
                    a = context.Cause(this, affirm ? Verb.AGREE : Verb.ARGUE, other, context.args.Last);
                    break;
                default:
                    a = Babble(context);
                    break;
            }

            Commit(a);
        }
 protected void Query(Person other, Noun about, Act because)
 {
     Listener = other;
     Commit(because.Cause(this, Verb.ASK_WHY, other, about));
 }
Esempio n. 11
0
 public Act FirstCause(Person subject, Verb verb, Noun primaryObject, Noun secondaryObject)
 {
     Debug.Assert(primaryObject || verb != Verb.GIVE, "that's a ternary verb.");
     return NO_ACT.Cause(subject, verb, primaryObject, secondaryObject);
 }
Esempio n. 12
0
 public static Query Make(Person from, Person to, Act about)
 {
     throw new Exception();
     //return new Query(about.Cause(from, Verb.TALK, to));
 }