private void OnDamageInflicted(object sender, DamageInflictedEventArgs e) { if (e.Action is InflictMoveDamage) { foreach (Slot target in e.Action.Targets) { PokemonEngine.Model.Battle.ITrainer trainer = target.Participant as PokemonEngine.Model.Battle.ITrainer; if (e.Action is InflictMoveDamage && (e.Action as InflictMoveDamage).IsCriticalHit) { Trace.WriteLine("A critical hit!"); } Trace.WriteLine($"{trainer.UID}'s {target.Pokemon.Species} took {e.Action[target]} damage."); } } if (e.Action is InflictDamage.Typed <PokemonEngine.Model.Battle.Weather> ) { InflictDamage.Typed <PokemonEngine.Model.Battle.Weather> action = e.Action as InflictDamage.Typed <PokemonEngine.Model.Battle.Weather>; if (action.Targets.FirstOrDefault() != null) { switch (action.Source.Type) { case PokemonEngine.Model.Weather.Hail: { foreach (Slot slot in action.Targets) { buffetedByHail = true; PokemonEngine.Model.Battle.ITrainer trainer = slot.Participant as PokemonEngine.Model.Battle.ITrainer; Trace.WriteLine($"{trainer.UID}'s {slot.Pokemon.Species} is buffeted by the hail!"); } break; } } } } }
private void OnUseMove(object sender, UseMoveEventArgs e) { PokemonEngine.Model.Battle.ITrainer trainer = e.Action.Slot.Participant as PokemonEngine.Model.Battle.ITrainer; Trace.WriteLine($"{trainer.UID}'s {e.Action.Slot.Pokemon.Species} used {e.Action.Move.Name}"); }