Esempio n. 1
0
        public bool Evaluate(EventContext context, Game game)
        {
            Event e = game.GetEventById(eventId);
            if (e == null)
                return false;

            Dictionary<string, object> computedParameters = new Dictionary<string, object>();
            foreach (var pair in parameters)
            {
                computedParameters.Add(pair.Key, context.GetScopedObjectByName(pair.Value));
            }
            EventContext newContext = new EventContext(context.CurrentCharacter, computedParameters);
            return e.GetAvailableOptions(newContext, game).Length > 0;
        }
Esempio n. 2
0
 public bool Evaluate(EventContext context, Game game)
 {
     return (context.GetScopedObjectByName(otherCharacter) as Character).Spouse == context.CurrentCharacter;
 }
Esempio n. 3
0
 public bool Evaluate(EventContext context, Game game)
 {
     context.PushScope(context.GetScopedObjectByName(scopeName));
     bool result = logic.Evaluate(context, game);
     context.PopScope();
     return result;
 }
Esempio n. 4
0
 public bool Evaluate(EventContext context, Game game)
 {
     Character aboutCharacter = context.GetScopedObjectByName(about) as Character;
     return context.CurrentCharacter.HasInformationAbout(aboutCharacter, type);
 }
Esempio n. 5
0
 public bool Evaluate(EventContext context, Game game)
 {
     return (context.GetScopedObjectByName(otherCharacter) as Character).Children.Contains(context.CurrentCharacter);
 }
Esempio n. 6
0
 public double Evaluate(Game game, EventContext context, Weights weights)
 {
     Dictionary<string, object> computedParameters = new Dictionary<string, object>();
     foreach (var pair in parameters)
     {
         computedParameters.Add(pair.Key, context.GetScopedObjectByName(pair.Value));
     }
     EventContext newContext = new EventContext(context.CurrentCharacter, computedParameters);
     return game.GetEventById(eventid).Evaluate(game, newContext, weights);
 }
Esempio n. 7
0
        public void Execute(EventResults result, Game game, EventContext context)
        {
            Dictionary<string, object> computedParameters = new Dictionary<string, object>();
            foreach (var pair in parameters)
            {
                computedParameters.Add(pair.Key, context.GetScopedObjectByName(pair.Value));
            }
            EventContext newContext = new EventContext(context.CurrentCharacter, computedParameters);
            game.GetEventById(eventid).Execute(result, game, newContext);

            //We need to commit any changes that were performed on the new context to our old one.
            newContext.CommitTo(context);
        }
Esempio n. 8
0
 public void Execute(EventResults result, Game game, EventContext context)
 {
     context.PushScope(context.GetScopedObjectByName(scopeName));
     operation.Execute(result, game, context);
     context.PopScope();
 }
Esempio n. 9
0
        public void Execute(EventResults result, Game game, EventContext context)
        {
            Character tellingCharacter = context.GetScopedObjectByName("ROOT") as Character;
            InformationInstance informationInstance = tellingCharacter.ChooseInformationAbout(type, context.GetScopedObjectByName(about) as Character);
            bool isNewInformation = context.CurrentCharacter.AddInformation(informationInstance);
            context.PushScope(informationInstance);
            operation.Execute(result, game, context);
            context.PopScope();

            result.AddObservableInfo(informationInstance, overhearChance, tellingCharacter);

            if (isNewInformation)
            {
                game.Log(context.CurrentCharacter.Name + " learned an information.");
                informationInstance.ExecuteOnTold(context.CurrentCharacter, game, context.CurrentCharacter.CurrentRoom);
            }
        }
Esempio n. 10
0
 public double Evaluate(Game game, EventContext context, Weights weights)
 {
     context.PushScope(context.GetScopedObjectByName(scopeName));
     double result = operation.Evaluate(game, context, weights);
     context.PopScope();
     return result;
 }
Esempio n. 11
0
 public void Execute(EventResults result, Game game, EventContext context)
 {
     Dictionary<string, object> computedParameters = new Dictionary<string, object>();
     foreach (var pair in parameters)
     {
         computedParameters.Add(pair.Key, context.GetScopedObjectByName(pair.Value));
     }
     result.AddObservableInfo(new InformationInstance(game.GetInformationById(informationId), computedParameters, game.CurrentTime), chance, null);
 }
Esempio n. 12
0
 public double Evaluate(Game game, EventContext context, Weights weights)
 {
     Dictionary<string, object> computedParameters = new Dictionary<string, object>();
     foreach (var pair in parameters)
     {
         computedParameters.Add(pair.Key, context.GetScopedObjectByName(pair.Value));
     }
     InformationInstance info = new InformationInstance(game.GetInformationById(informationId), computedParameters, game.CurrentTime);
     return weights.MeasureObserveInformation(info, game, context.CurrentCharacter);
 }
Esempio n. 13
0
 public void Execute(EventResults result, Game game, EventContext context)
 {
     OpinionModifierInstance mod = game.CreateOpinionModifier(identifier, context.GetScopedObjectByName(character) as Character);
     context.CurrentCharacter.AddOpinionModifier(mod);
 }
Esempio n. 14
0
 public double Evaluate(Game game, EventContext context, Weights weights)
 {
     return weights.MeasureOpinion(context.CurrentCharacter, context.GetScopedObjectByName(character) as Character, game.GetOpinionModifier(identifier));
 }