Exemple #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;
        }
Exemple #2
0
 public bool Evaluate(EventContext context, Game game)
 {
     return (context.GetScopedObjectByName(otherCharacter) as Character).Spouse == context.CurrentCharacter;
 }
Exemple #3
0
 public bool Evaluate(EventContext context, Game game)
 {
     context.PushScope(context.GetScopedObjectByName(scopeName));
     bool result = logic.Evaluate(context, game);
     context.PopScope();
     return result;
 }
Exemple #4
0
 public bool Evaluate(EventContext context, Game game)
 {
     Character aboutCharacter = context.GetScopedObjectByName(about) as Character;
     return context.CurrentCharacter.HasInformationAbout(aboutCharacter, type);
 }
Exemple #5
0
 public bool Evaluate(EventContext context, Game game)
 {
     return (context.GetScopedObjectByName(otherCharacter) as Character).Children.Contains(context.CurrentCharacter);
 }
Exemple #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);
 }
Exemple #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);
        }
Exemple #8
0
 public void Execute(EventResults result, Game game, EventContext context)
 {
     context.PushScope(context.GetScopedObjectByName(scopeName));
     operation.Execute(result, game, context);
     context.PopScope();
 }
Exemple #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);
            }
        }
Exemple #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;
 }
Exemple #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);
 }
Exemple #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);
 }
Exemple #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);
 }
Exemple #14
0
 public double Evaluate(Game game, EventContext context, Weights weights)
 {
     return weights.MeasureOpinion(context.CurrentCharacter, context.GetScopedObjectByName(character) as Character, game.GetOpinionModifier(identifier));
 }