public MoveZoneEvent(OID source, Zone oldZone, Zone newZone, OID oid) : base(source) { this.oldZone = oldZone; this.newZone = newZone; this.oid = oid; }
public bool CanPay(OID source) { this.source = source; return(IsPaymentPossible); }
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 }); } } } }
public UntapEvent(OID source) : base(source) { }
public TapEvent(OID source) : base(source) { }
internal DrawCardEvent(OID source, int player) : base(source) { this.player = player; }
public EffectEvent(OID source, Effect effect, List <Target> targets) : base(source) { this.effect = effect; this.targets = targets; }
public ActivateAbilityEvent(OID source, ActivatedAbility ability) : base(source) { this.ability = ability; }
public DeclareTargetEvent(OID source, Target target) : base(source) { this.target = target; }
protected new static bool DefaultCondition(OID oid) { return(BattlefieldCondition(oid) && ControllerCondition(oid)); }
public PlayerOrOID(OID oid) { this.oid = oid; type = ValueType.OID; }
protected static bool ControllerCondition(OID oid) { MTG mtg = MTG.Instance; return(mtg.objects[oid].attr.controller == mtg.turn.playerPriorityIndex); }
protected static bool BattlefieldCondition(OID oid) { MTG mtg = MTG.Instance; return(mtg.FindZoneFromOID(oid) == mtg.battlefield); }
protected static bool SorceryCondition(OID oid) { return(MTG.Instance.CanCastSorceries); }
public LoseLifeEvent(OID source, int player, int amount) : base(source) { this.player = player; this.amount = amount; }
public CastSpellEvent(OID oid) : base(oid) { }
public DealDamageEvent(OID source, PlayerOrOID target, int amount) : base(source) { this.target = target; this.amount = amount; }
public PushTriggeredAbilityEvent(OID source, MTG.TriggeredAbilityEntry ability) : base(source) { this.ability = ability; }
internal DiscardCardEvent(OID source, OID oid) : base(source) { this.oid = oid; }
public GenerateAbilityObjectEvent(OID source, ResolutionAbility resolution, AbilityObject.AbilityType abilityType) : base(source) { this.resolution = resolution; this.abilityType = abilityType; }
public MTGEvent(OID source) { this.source = source; }
public PlayLandEvent(OID source) : base(source) { }
internal AddManaEvent(OID source, int player, ManaSymbol mana) : base(source) { this.player = player; this.mana = mana; }
public ResolveManaAbilityEvent(OID source, ManaAbility ability) : base(source) { this.ability = ability; }
public RemoveManaEvent(OID source, int player, ManaSymbol mana) : base(source) { this.player = player; this.mana = mana; }
public virtual void SetSource(OID source) { this.source = source; }