// Choose a target for this effect, and then spawn a specific effect and process it public override void Process(Game game) { int amountToGain = this.amountToGain_provider.GetValue(this, game, default(int)); IList <Readable_LifeTarget> availableTargets = this.targetsProvider.GetValue(this, game, (IList <Readable_LifeTarget>)null); // multiple choices of what to heal/damage, so ask the player what to do List <GameEffect> options = new List <GameEffect>(); foreach (Readable_LifeTarget target in availableTargets) { options.Add(new Specific_LifeEffect(target.GetID((Readable_LifeTarget)null), amountToGain)); } if (this.affectAll) { foreach (GameEffect option in options) { option.Process(game); } } else { if (options.Count == 0 || !this.TargetRequired) { options.Add(new EmptyEffect()); } // ask the game to choose one of these options Readable_GamePlayer controller = this.chooserProvider.GetValue(this, game, (Readable_GamePlayer)null); game.AddChoice(new GameChoice(options, controller.GetID((Readable_GamePlayer)null))); } }
public override void Process(Game game) { foreach (GameEffect option in this.options) { option.ControllerID = this.ControllerID; } GameChoice choice = new GameChoice(this.options, this.Get_ControllerID()); game.AddChoice(choice); }