public static void Reset() { Grimoires.Clear(); Grimoire.ResetStaticVariables(); CoroutineEngine.Reset(); LastResult = false; }
private static void ExecuteList(Grimoire grimoire, List <Spell> list) { for (int j = 0; j < list.Count; j++) { if (list[j].Enabled) { LastResult = list[j].Execute(grimoire); } } }
/// <summary> /// Add new grimoire /// </summary> /// <param name="grimoire"></param> /// <returns></returns> public static bool AddGrimoire(Grimoire grimoire) { if (grimoire.Name != null && Grimoires.Any(x => x.Name == grimoire.Name)) { return(false); } else { Grimoires.Add(grimoire); return(true); } }
/// <summary> /// Add new grimoire /// </summary> /// <param name="grimoire"></param> /// <returns></returns> public static bool AddGrimoire(Grimoire grimoire) { if (grimoire.Name != "" && Grimoires.Any(x => x.Name == grimoire.Name)) { //Grimoire name already taken return(false); } else { //Unnamed grimoire or name is not taken Grimoires.Add(grimoire); return(true); } }
//Could use optimization public override bool Evaluate(Grimoire grimoire) { int ct = Conditionals.Count; bool res = Conditionals[0].Evaluate(grimoire); //bypassed if only one for (int j = 1; j < ct; j++) { var next = Conditionals[j - 1].NextOp; if (next == QuestionOp.AND) { res = res && Conditionals[j].Evaluate(grimoire); } else if (next == QuestionOp.OR) { res = res || Conditionals[j].Evaluate(grimoire); } else { break; } } return(res); }
public abstract bool Evaluate(Grimoire grimoire);
//Add param data in subclasses public abstract void DoAction(Grimoire grimoire);
public static void RemoveGrimoire(Grimoire g) { Grimoires.Remove(g); }