public virtual void TrackSpellCasting(SpellCastingEvent cast) { // the spell cast will be added to all active fights foreach (var f in ActiveFights) { var p = f.Participants.FirstOrDefault(x => x.Name == cast.Source); if (p == null) { p = new Combatant(cast.Source); f.Participants.Add(p); } p.Casting.Add(cast); } }
public void SpellCasting() { SpellCastingEvent cast = null; var parser = new LogParser(PLAYER); parser.OnSpellCasting += (args) => cast = args; cast = null; parser.ParseLine("[Sun May 01 08:44:56 2016] A woundhealer goblin begins to cast a spell. <Inner Fire>"); Assert.NotNull(cast); Assert.Equal("A woundhealer goblin", cast.Source); Assert.Equal("Inner Fire", cast.Spell); cast = null; parser.ParseLine("[Tue Nov 03 22:38:46 2015] You begin casting Ro's Burning Cloak Rk. III."); Assert.NotNull(cast); Assert.Equal(PLAYER, cast.Source); Assert.Equal("Ro's Burning Cloak Rk. III", cast.Spell); }