示例#1
0
 public MoveZoneEvent(OID source, Zone oldZone, Zone newZone, OID oid) : base(source)
 {
     this.oldZone = oldZone;
     this.newZone = newZone;
     this.oid     = oid;
 }
示例#2
0
 public bool CanPay(OID source)
 {
     this.source = source;
     return(IsPaymentPossible);
 }
示例#3
0
        public PriorityChoice()
        {
            Min   = 1; Max = 1;
            Title = "Choose what to do with your priority!";
            var mtg    = MTG.Instance;
            var player = mtg.players[mtg.turn.playerPriorityIndex];

            // What can a player do when they have priority?
            Options = new List <PriorityOption>();

            // They can pass, of course
            Options.Add(new PriorityOption
            {
                type = PriorityOption.OptionType.PassPriority
            });

            // 117.1a A player may cast an instant spell any time they have priority. A player may cast a noninstant spell during their main phase any time they have priority and the stack is empty.
            foreach (var oid in player.hand)
            {
                var cardtypes = mtg.objects[oid].attr.cardTypes;

                // TODO - This is an oversimplification
                if (cardtypes.Contains(MTGObject.CardType.Land))
                {
                    continue;
                }

                // TODO - Also an oversimplification :) (for the card type check at least)
                if (!mtg.CanCastSorceries && !cardtypes.Contains(MTGObject.CardType.Instant))
                {
                    continue;
                }

                if (!mtg.objects[oid].CanPayCastingCosts())
                {
                    continue;
                }

                Options.Add(new PriorityOption
                {
                    type   = PriorityOption.OptionType.CastSpell,
                    source = oid,
                });
            }

            // 117.1b A player may activate an activated ability any time they have priority.
            foreach (var kvp in mtg.objects)
            {
                OID oid = kvp.Key; MTGObject obj = kvp.Value;
                if (obj.attr.controller != mtg.turn.playerPriorityIndex)
                {
                    continue;
                }
                foreach (var ability in obj.attr.activatedAbilities)
                {
                    if (!(ability is ManaAbility) && ability.CanBeActivated(oid))
                    {
                        Options.Add(new PriorityOption
                        {
                            type             = PriorityOption.OptionType.ActivateAbility,
                            source           = oid,
                            activatedAbility = ability
                        });
                    }
                }
            }

            // 117.1c A player may take some special actions any time they have priority.A player may take other special actions during their main phase any time they have priority and the stack is empty.See rule 116, “Special Actions.”
            foreach (var oid in player.hand)
            {
                var cardtypes = mtg.objects[oid].attr.cardTypes;
                if (mtg.CanCastSorceries && cardtypes.Contains(MTGObject.CardType.Land))
                {
                    // TODO - One land per turn. Need the events log and a land drop total system
                    Options.Add(new PriorityOption
                    {
                        type   = PriorityOption.OptionType.PlayLand,
                        source = oid
                    });
                }
            }

            // 117.1d A player may activate a mana ability whenever they have priority, whenever they are casting a spell or activating an ability that requires a mana payment, or whenever a rule or effect asks for a mana payment(even in the middle of casting or resolving a spell or activating or resolving an ability).
            foreach (var kvp in mtg.objects)
            {
                OID oid = kvp.Key; MTGObject obj = kvp.Value;
                if (obj.attr.controller != mtg.turn.playerPriorityIndex)
                {
                    continue;
                }
                foreach (var ability in obj.attr.activatedAbilities)
                {
                    if (ability is ManaAbility && ability.CanBeActivated(oid))
                    {
                        Options.Add(new PriorityOption
                        {
                            type             = PriorityOption.OptionType.ManaAbility,
                            source           = oid,
                            activatedAbility = ability
                        });
                    }
                }
            }
        }
示例#4
0
 public UntapEvent(OID source) : base(source)
 {
 }
示例#5
0
 public TapEvent(OID source) : base(source)
 {
 }
示例#6
0
 internal DrawCardEvent(OID source, int player) : base(source)
 {
     this.player = player;
 }
示例#7
0
 public EffectEvent(OID source, Effect effect, List <Target> targets) : base(source)
 {
     this.effect  = effect;
     this.targets = targets;
 }
示例#8
0
 public ActivateAbilityEvent(OID source, ActivatedAbility ability) : base(source)
 {
     this.ability = ability;
 }
示例#9
0
 public DeclareTargetEvent(OID source, Target target) : base(source)
 {
     this.target = target;
 }
示例#10
0
 protected new static bool DefaultCondition(OID oid)
 {
     return(BattlefieldCondition(oid) && ControllerCondition(oid));
 }
示例#11
0
 public PlayerOrOID(OID oid)
 {
     this.oid = oid;
     type     = ValueType.OID;
 }
示例#12
0
        protected static bool ControllerCondition(OID oid)
        {
            MTG mtg = MTG.Instance;

            return(mtg.objects[oid].attr.controller == mtg.turn.playerPriorityIndex);
        }
示例#13
0
        protected static bool BattlefieldCondition(OID oid)
        {
            MTG mtg = MTG.Instance;

            return(mtg.FindZoneFromOID(oid) == mtg.battlefield);
        }
示例#14
0
 protected static bool SorceryCondition(OID oid)
 {
     return(MTG.Instance.CanCastSorceries);
 }
示例#15
0
 public LoseLifeEvent(OID source, int player, int amount) : base(source)
 {
     this.player = player;
     this.amount = amount;
 }
示例#16
0
 public CastSpellEvent(OID oid) : base(oid)
 {
 }
示例#17
0
 public DealDamageEvent(OID source, PlayerOrOID target, int amount) : base(source)
 {
     this.target = target;
     this.amount = amount;
 }
示例#18
0
 public PushTriggeredAbilityEvent(OID source, MTG.TriggeredAbilityEntry ability)
     : base(source)
 {
     this.ability = ability;
 }
示例#19
0
 internal DiscardCardEvent(OID source, OID oid) : base(source)
 {
     this.oid = oid;
 }
示例#20
0
 public GenerateAbilityObjectEvent(OID source, ResolutionAbility resolution, AbilityObject.AbilityType abilityType)
     : base(source)
 {
     this.resolution  = resolution;
     this.abilityType = abilityType;
 }
示例#21
0
 public MTGEvent(OID source)
 {
     this.source = source;
 }
示例#22
0
 public PlayLandEvent(OID source) : base(source)
 {
 }
示例#23
0
 internal AddManaEvent(OID source, int player, ManaSymbol mana) : base(source)
 {
     this.player = player;
     this.mana   = mana;
 }
示例#24
0
 public ResolveManaAbilityEvent(OID source, ManaAbility ability) : base(source)
 {
     this.ability = ability;
 }
示例#25
0
 public RemoveManaEvent(OID source, int player, ManaSymbol mana) : base(source)
 {
     this.player = player;
     this.mana   = mana;
 }
示例#26
0
 public virtual void SetSource(OID source)
 {
     this.source = source;
 }