コード例 #1
0
        public void GainLife(int amount)
        {
            life += amount;

            if (TriggerSystem.HasTriggers(ConvergeTriggerType.GainLife))
            {
                TriggerSystem.CheckTriggers(ConvergeTriggerType.GainLife, new TriggerData(this, null, null, amount));
            }
        }
コード例 #2
0
        public void DealDamage(ConvergeObject victim, int amount, bool isCombatDamage)
        {
            if (amount <= 0)
            {
                return;
            }

            if (TriggerSystem.HasTriggers(ConvergeTriggerType.DealDamage))
            {
                TriggerSystem.CheckTriggers(ConvergeTriggerType.DealDamage, new TriggerData(controller, this, victim, amount));
            }

            victim.TakeDamage(this, amount);

            if (keywords.HasFlag(ConvergeKeyword.Lifelink))
            {
                controller.GainLife(amount);
            }
        }
コード例 #3
0
        public void PlayOn(ConvergeObject target, ConvergePlayer you)
        {
            if (zone.zoneId == ConvergeZoneId.Hand &&
                (cardType.HasFlag(ConvergeCardType.Action) || cardType.HasFlag(ConvergeCardType.Augment)) &&
                CanTarget(target, you)
                )
            {
                if (you.TryPayCost(cost))
                {
                    if (TriggerSystem.HasTriggers(ConvergeTriggerType.PlayCard))
                    {
                        TriggerSystem.CheckTriggers(ConvergeTriggerType.PlayCard, new TriggerData(you, this, target, 0));
                    }

                    ConvergeEffectContext context = new ConvergeEffectContext(this, you);
                    context.target = target;
                    original.actionEffect.Run(context);
                    MoveZone(owner.discardPile);
                }
            }
        }
コード例 #4
0
        void UpdateZoneChanges()
        {
            bool didAnything = zoneChanges.Count > 0;

            for (int Idx = 0; Idx < zoneChanges.Count; ++Idx)
            {
                KeyValuePair <ConvergeObject, ConvergeZone> kv = zoneChanges[Idx];
                ConvergeObject obj     = kv.Key;
                ConvergeZone   newZone = kv.Value;
                ConvergeZone   oldZone = obj.zone;

                if (newZone.zoneId == ConvergeZoneId.DiscardPile && TriggerSystem.HasTriggers(ConvergeTriggerType.Discarded))
                {
                    TriggerSystem.CheckTriggers(ConvergeTriggerType.Discarded, new TriggerData(newZone.owner, null, obj, 0));
                }

                newZone.Add(obj);

                if (newZone.inPlay && (oldZone == null || !oldZone.inPlay) && TriggerSystem.HasTriggers(ConvergeTriggerType.EnterPlay))
                {
                    TriggerSystem.CheckTriggers(ConvergeTriggerType.EnterPlay, new TriggerData(newZone.owner, obj, null, 0));
                }

                if (obj.ui == null && !newZone.isHidden && obj.zone == newZone)
                {
                    obj.ui = new ConvergeUIObject(obj);
                    ui.Add(obj.ui);
                }
                else if (obj.ui != null && newZone.isHidden && obj.zone == newZone)
                {
                    ui.Remove(obj.ui);
                    obj.ui = null;
                }
            }
            zoneChanges.Clear();
        }
コード例 #5
0
        public void Play(ConvergePlayer you)
        {
            if (zone.zoneId == ConvergeZoneId.Hand)
            {
                if (this.cardType.HasFlag(ConvergeCardType.Resource))
                {
                    if (you.numLandsPlayed < you.numLandsPlayable)
                    {
                        you.numLandsPlayed++;
                    }
                    else
                    {
                        return;
                    }
                }
                else if (original.actionTarget != null)
                {
                    // this spell needs a target
                    return;
                }

                if (TriggerSystem.HasTriggers(ConvergeTriggerType.PlayCard))
                {
                    TriggerSystem.CheckTriggers(ConvergeTriggerType.PlayCard, new TriggerData(you, this, null, 0));
                }

                if (you.TryPayCost(cost))
                {
                    if (this.cardType.HasFlag(ConvergeCardType.Unit))
                    {
                        MoveZone(you.defense);
                        if (!this.keywords.HasFlag(ConvergeKeyword.Haste))
                        {
                            tapped = true;
                        }
                    }
                    else if (this.cardType.HasFlag(ConvergeCardType.Action))
                    {
                        ConvergeEffectContext context = new ConvergeEffectContext(this, you);
                        original.actionEffect.Run(context);
                        MoveZone(owner.discardPile);
                    }
                    else if (this.cardType.HasFlag(ConvergeCardType.Resource) && this.activatedAbilities.Count == 0)
                    {
                        MoveZone(you.resourceZone);
                    }
                    else
                    {
                        MoveZone(you.home);
                    }
                }
            }
            else if (zone.zoneId == ConvergeZoneId.Attack)
            {
                WithdrawAttack();
            }
            else if (zone.zoneId == ConvergeZoneId.Defense)
            {
                EnterAttack();
            }
        }
コード例 #6
0
 public void OnLeavingPlay()
 {
     TriggerSystem.Remove(this);
 }
コード例 #7
0
 public void OnEnteringPlay()
 {
     TriggerSystem.Add(this);
 }