Пример #1
0
    private bool CanPlayActorTriggerSpell(Entity entity, Spell spell, bool spellInitialized)
    {
        if ((!entity.HasTriggerVisual() && !entity.IsPoisonous()) && !entity.HasInspire())
        {
            return(false);
        }
        if (((entity.GetController() != null) && !entity.GetController().IsFriendlySide()) && entity.IsObfuscated())
        {
            return(false);
        }
        Card cardWithActorTrigger = this.GetCardWithActorTrigger(entity);

        if (cardWithActorTrigger == null)
        {
            return(false);
        }
        if (cardWithActorTrigger.WillSuppressActorTriggerSpell())
        {
            return(false);
        }
        if (spell != null)
        {
            if (!spellInitialized)
            {
                return(false);
            }
        }
        else if (!SpellUtils.CanAddPowerTargets(base.m_taskList))
        {
            return(false);
        }
        return(true);
    }
    protected virtual bool AddPowerSourceAndTargets(PowerTaskList taskList)
    {
        if (!this.HasSourceCard(taskList))
        {
            return(false);
        }
        if (!SpellUtils.CanAddPowerTargets(taskList))
        {
            return(false);
        }
        Card card = taskList.GetSourceEntity().GetCard();

        this.SetSource(card);
        List <PowerTask> list = this.m_taskList.GetTaskList();

        for (int i = 0; i < list.Count; i++)
        {
            PowerTask task = list[i];
            Card      targetCardFromPowerTask = this.GetTargetCardFromPowerTask(task);
            if (((targetCardFromPowerTask != null) && (card != targetCardFromPowerTask)) && !this.IsTarget(targetCardFromPowerTask))
            {
                this.AddTarget(targetCardFromPowerTask);
            }
        }
        return((card != null) || (this.m_targets.Count > 0));
    }
    protected override bool AddPowerSourceAndTargets(PowerTaskList taskList)
    {
        this.Reset();
        if (!this.HasSourceCard(taskList))
        {
            return(false);
        }
        Entity sourceEntity = taskList.GetSourceEntity();
        Card   card         = sourceEntity.GetCard();
        Spell  spell        = this.DeterminePowerSpell(sourceEntity, card);

        if (sourceEntity.IsMinion())
        {
            if (!this.InitPowerSpell(card, spell))
            {
                if (!SpellUtils.CanAddPowerTargets(taskList))
                {
                    return(false);
                }
                if (this.GetActorBattlecrySpell(card) == null)
                {
                    return(false);
                }
            }
        }
        else
        {
            this.InitPowerSpell(card, spell);
            List <CardSoundSpell> soundSpells = this.DeterminePowerSounds(sourceEntity, card);
            this.InitPowerSounds(card, soundSpells);
            if ((this.m_powerSpell == null) && (this.m_powerSoundSpells.Count == 0))
            {
                return(false);
            }
        }
        base.SetSource(card);
        return(true);
    }
 protected bool CanAddPowerTargets()
 {
     return(SpellUtils.CanAddPowerTargets(this.m_taskList));
 }