public override void Execute(GameTrigger trigger) { if (!trigger.Character.IsInFight()) { trigger.ReplyError("You must be in a fight"); return; } if (!trigger.Character.Fight.AIDebugMode) { trigger.ReplyError("AI debug mode must be enabled"); return; } if (!(trigger.Character.Fight.FighterPlaying is AIFighter)) { trigger.ReplyError("Current fighter is not an AI fighter"); return; } var aiFighter = trigger.Character.Fight.FighterPlaying as AIFighter; foreach (var cast in aiFighter.Brain.SpellSelector.Possibilities) { trigger.Reply("(#1) Spell {0} ({1}) :: {2}", cast.Spell.Template.Name, cast.Spell.Id, SpellIdentifier.GetSpellCategories(cast.Spell)); var dumper = new ObjectDumper(8) { MemberPredicate = (member) => !member.Name.Contains("Target") }; trigger.Reply("\t{0} Targets", cast.Impacts.Count); foreach (var impact in cast.Impacts) { trigger.Reply(dumper.DumpElement(impact)); } } }
public static string Dump(object element, int indentSize) { var instance = new ObjectDumper(indentSize); return(instance.DumpElement(element)); }
public static string Dump(object element, int depth = 4, int indentSize = 2, char indentChar = ' ') { var instance = new ObjectDumper(depth, indentSize, indentChar); return(instance.DumpElement(element, true)); }
public static string Dump(object element, int indentSize) { var instance = new ObjectDumper(indentSize); return instance.DumpElement(element); }
public void AnalysePossibilities() { this.Possibilities = new System.Collections.Generic.List <SpellCastInformations>(); foreach (Spell current in this.Fighter.Spells.Values) { SpellCategory spellCategories = SpellIdentifier.GetSpellCategories(current); SpellLevelTemplate currentSpellLevel = current.CurrentSpellLevel; SpellCastInformations spellCastInformations = new SpellCastInformations(current); if ((long)this.Fighter.AP >= (long)((ulong)currentSpellLevel.ApCost) && !currentSpellLevel.StatesForbidden.Any(new Func <int, bool>(this.Fighter.HasState))) { if (!currentSpellLevel.StatesRequired.Any((int state) => !this.Fighter.HasState(state)) && this.Fighter.SpellHistory.CanCastSpell(current.CurrentSpellLevel)) { if ((spellCategories & SpellCategory.Summoning) != SpellCategory.None && this.Fighter.CanSummon()) { Cell freeAdjacentCell = this.m_environment.GetFreeAdjacentCell(); if (freeAdjacentCell == null) { continue; } spellCastInformations.IsSummoningSpell = true; spellCastInformations.SummonCell = freeAdjacentCell; } else { foreach (FightActor current2 in from fighter in this.Fighter.Fight.Fighters where fighter.IsAlive() && fighter.IsVisibleFor(this.Fighter) select fighter) { int mPToUse; if (this.CanReach(current2, current, out mPToUse) && this.Fighter.SpellHistory.CanCastSpell(current.CurrentSpellLevel, current2.Cell)) { spellCastInformations.MPToUse = mPToUse; SpellTarget spellTarget = this.ComputeSpellImpact(current, current2); if (spellTarget != null) { spellTarget.Target = current2; if (spellTarget.Damage >= 0.0) { spellCastInformations.Impacts.Add(spellTarget); } } } } } this.Possibilities.Add(spellCastInformations); } } } if (Brain.Brain.DebugMode) { Debug.WriteLine(this.Fighter.Name); using (System.Collections.Generic.Dictionary <int, Spell> .ValueCollection.Enumerator enumerator = this.Fighter.Spells.Values.GetEnumerator()) { while (enumerator.MoveNext()) { Spell spell = enumerator.Current; Debug.WriteLine("Spell {0} ({1}) :: {2}", new object[] { spell.Template.Name, spell.Id, SpellIdentifier.GetSpellCategories(spell) }); System.Collections.Generic.IEnumerable <SpellCastInformations> arg_2C4_0 = this.Possibilities; Func <SpellCastInformations, bool> predicate = (SpellCastInformations x) => x.Spell == spell; SpellCastInformations spellCastInformations2 = arg_2C4_0.FirstOrDefault(predicate); if (spellCastInformations2 != null) { if (spellCastInformations2.IsSummoningSpell) { Debug.WriteLine("\tSummon Spell"); } else { ObjectDumper objectDumper = new ObjectDumper(8); objectDumper.MemberPredicate = ((System.Reflection.MemberInfo member) => !member.Name.Contains("Target")); ObjectDumper objectDumper2 = objectDumper; Debug.WriteLine("\t{0} Targets", new object[] { spellCastInformations2.Impacts.Count }); foreach (SpellTarget spellTarget in spellCastInformations2.Impacts) { Debug.Write(objectDumper2.DumpElement(spellTarget)); if (spellTarget.Target != null) { Debug.WriteLine("\t\tTarget = " + spellTarget.Target + spellTarget.Target.Id.ToString()); } } } } } } Debug.WriteLine(""); } }