public bool Evaluate(EventContext context, Game game) { //No children means its never true. Used in CHILDREN_WELLDRESS_PRESTIGE_MOD. if (context.CurrentCharacter.Children.Count == 0) return false; for (int i = 0; i < context.CurrentCharacter.Children.Count; ++i) { context.PushScope(context.CurrentCharacter.Children[i]); if (!requirements.Evaluate(context, game)) { //We've found a child that doesn't the requirements. This is a failure context.PopScope(); return false; } context.PopScope(); } return true; }
public double Evaluate(Game game, EventContext context, Weights weights) { //TODO: Start with random index. // TODO: Should we be doing some average here instead of just stopping // at the first one that works? for (int i = 0; i < context.CurrentCharacter.Children.Count; ++i) { Character character = context.CurrentCharacter.Children[i]; context.PushScope(character); if (requirements.Evaluate(context, game)) { double result = operation.Evaluate(game, context, weights); //AnyChild stops after a single interation. context.PopScope(); return result; } context.PopScope(); } return 0.0; }
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) { //No children means its never true. if (context.CurrentCharacter.Children.Count == 0) return false; //TODO: start with a random child index. for(int i = 0; i < context.CurrentCharacter.Children.Count; ++i) { context.PushScope(context.CurrentCharacter.Children[i]); if(requirements.Evaluate(context, game)) { //We've found a child that meets the requirements. context.PopScope(); return true; } context.PopScope(); } return false; }
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) { //TODO: Start with random index. for(int i = 0; i < context.CurrentCharacter.Children.Count; ++i) { Character character = context.CurrentCharacter.Children[i]; context.PushScope(character); if (requirements.Evaluate(context, game)) { operation.Execute(result, game, context); //AnyChild stops after a single interation. context.PopScope(); return; } context.PopScope(); } }
public void Execute(EventResults result, Game game, EventContext context) { context.PushScope(context.GetScopedObjectByName(scopeName)); operation.Execute(result, game, context); context.PopScope(); }
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) { foreach (var character in context.CurrentCharacter.CurrentRoom.GetCharacters(context.CurrentCharacter)) { context.PushScope(character); if (requirements.Evaluate(context, game)) { operation.Execute(result, game, context); } context.PopScope(); } }
public double Evaluate(Game game, EventContext context, Weights weights) { double result = 0.0; foreach (var character in context.CurrentCharacter.CurrentRoom.GetCharacters(context.CurrentCharacter)) { context.PushScope(character); if (requirements.Evaluate(context, game)) { result += operation.Evaluate(game, context, weights); } context.PopScope(); } return result; }
public void Execute(EventResults result, Game game, EventContext context) { Character chosen = context.CurrentCharacter.ChooseCharacter(game.FilterCharacters(requirements, context), operation, context, scopeName); context.PushScope(chosen, scopeName); operation.Execute(result, game, context); context.PopScope(); }
private double EvaluateChangedModifiers(Character character, EventContext context, Game game) { context.PushScope(character); List<PrestigeModifier> addedModifiers = new List<PrestigeModifier>(); List<PrestigeModifier> removedModifiers = new List<PrestigeModifier>(); game.GetChangedModifiers(context, addedModifiers, removedModifiers); double result = 0.0; if (addedModifiers.Count > 0 || removedModifiers.Count > 0) { foreach (var added in addedModifiers) { result += added.DailyChange; } foreach (var removed in removedModifiers) { result -= removed.DailyChange; } } context.PopScope(); return result * 100.0 * 10.0; }
public Character[] FilterCharacters(ILogic requirements, EventContext context) { List<Character> matchingCharacters = new List<Character>(); foreach (Character character in this.AllCharacters) { context.PushScope(character); if (requirements.Evaluate(context, this)) { matchingCharacters.Add(character); } context.PopScope(); } return matchingCharacters.ToArray(); }