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 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); }