Beispiel #1
0
        public override GameEffect Clone(GameEffect outputType)
        {
            Composite_GameEffect clone = new Composite_GameEffect();

            clone.CopyFrom(this);
            return(clone);
        }
Beispiel #2
0
        public Composite_GameEffect(GameEffect effect1, GameEffect effect2)
        {
            LinkedList <GameEffect> subEffects = new LinkedList <GameEffect>();

            subEffects.AddLast(effect1);
            subEffects.AddLast(effect2);
            this.Initialize(subEffects);
        }
        public void Destroy(GameEffect cause, Game game)
        {
            // inform the controller
            Writable_GamePlayer controller = game.GetWritable(this.ControllerID);

            controller.MonsterIDsInPlay.GetWritable().Remove(this.GetID((Readable_MonsterCard)null));
            // process any on-death effects
            GameTrigger_Factory.TriggerAll <GameEffect>(this.afterDeath_triggers, cause, this.ControllerID, game);
        }
Beispiel #4
0
 public void AddChoice(GameChoice choice)
 {
     if (choice.Options.Count() == 1)
     {
         // if there's only one option, we might as well resolve it now rather than queuing up a decision to ask the player about later
         GameEffect effect = choice.Options.First();
         effect.Process(this);
     }
     else
     {
         // If an effect creates a choice, then that choice is processed before any previous choices (like attacking or ending the turn)
         this.pendingEffects.AddFirst(choice);
     }
 }
Beispiel #5
0
 public Analyzed_GameState(Game resultantGame, Analyzed_GameState parent, GameEffect sourceEffect, Dictionary <ID <Readable_GamePlayer>, double> winProbabilities)
 {
     this.Game         = resultantGame;
     this.SourceEffect = sourceEffect;
     //this.ChoosingPlayerID = choosingPlayerID;
     this.winProbabilities = winProbabilities;
     foreach (KeyValuePair <ID <Readable_GamePlayer>, double> entry in winProbabilities)
     {
         if (entry.Value < 0)
         {
             Console.WriteLine("Error: cannot have negative win probability");
         }
     }
     this.Parent = parent;
 }
Beispiel #6
0
        public void PlayOneAction()
        {
            GameChoice   choice   = this.Get_NextChoice();
            GameStrategy strategy = this.GetStrategy(this.Get_ReadableSnapshot(choice.ControllerID));
            GameEffect   effect   = strategy.ChooseBestAction(choice, this);

            if (!(choice.Options.Contains(effect)))
            {
                Console.WriteLine("GameStrategy " + strategy + " made an invalid choice: " + effect);
                effect = strategy.ChooseBestAction(choice, this);
            }
            if (this.ShouldPrint)
            {
                Console.WriteLine(effect.ToString(this));
            }
            effect.Process(this);
        }
Beispiel #7
0
 private void PutGameOptions(Analyzed_GameState gameState, GameChoice choice)
 {
     if (choice.Options.Count() < 1)
     {
         Console.WriteLine("Error: a GameChoice must always have options");
     }
     gameState.ChoosingPlayerID = choice.ControllerID;
     foreach (GameEffect effect in choice.Options)
     {
         // quickly do a lazy clone of the game (we just use pointers to the other game until anything actually changes)
         Game newGame = gameState.Game.Clone();
         // make a new effect and execute it
         GameEffect clonedEffect = effect.Clone((GameEffect)null);
         clonedEffect.Process(newGame);
         new Analyzed_GameState(newGame, gameState, effect, this.GameEvaluator.EstimateWinProbabilities(newGame));
     }
 }
Beispiel #8
0
 public override GameEffect Clone(GameEffect outputType)
 {
     return(new AttackEffect(this.attackerID, this.defenderID));
 }
Beispiel #9
0
 public override GameEffect Clone(GameEffect outputType)
 {
     return(new PlayCard_Effect(this.cardId));
 }
Beispiel #10
0
 public override GameEffect Clone(GameEffect outputType)
 {
     return(new Specific_LifeEffect(this.TargetID, this.AmountToGain));
 }
Beispiel #11
0
 public override GameEffect Clone(GameEffect outputType)
 {
     return(new EmptyEffect());
 }
Beispiel #12
0
 public void CopyFrom(SpellCard other)
 {
     this.PlayEffect = other.PlayEffect;
     base.CopyFrom(other);
 }
Beispiel #13
0
 public override GameEffect Clone(GameEffect outputType)
 {
     return(this.Clone((TriggeredGameEffect <TTriggerType>)null));
 }
Beispiel #14
0
 public void CopyFrom(GameEffect original)
 {
     this.controllerID = original.controllerID;
 }
Beispiel #15
0
 public abstract GameEffect Clone(GameEffect outputType);
Beispiel #16
0
 public override GameEffect Clone(GameEffect outputType)
 {
     return(new EndTurn_Effect(this.ControllerID));
 }