Beispiel #1
0
        public void OnCastMagic(CastMagicEventArgs args)
        {
            if (this.CastMagic == null)
            {
                args.CastedWizardsIds.Add(this.Id);
            }

            else
            {
                this.CastMagic(this, args);
            }
        }
Beispiel #2
0
        public override void Execute(string[] commandParams, IRepository repository)
        {
            var id     = int.Parse(commandParams[0]);
            var wizard = repository.GetWizard(id);

            var args = new CastMagicEventArgs($"Reflection");

            wizard.Cast(wizard, args);
            foreach (var wizardId in args.CastedWizardsIds)
            {
                repository.AddWizardClones(wizardId);
            }
        }
Beispiel #3
0
 public void Cast(object sender, CastMagicEventArgs args)
 {
     Console.WriteLine($"{this.Name} {this.Id} casts " + string.Format(args.Expression, this.MagicalPower));
     this.OnCastMagic(args);
 }