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