| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System.Collections;
- using System.Collections.Generic;
- using System;
- using System.Linq;
- using UnityEngine;
- public partial class CardEffectCommons
- {
- #region Can trigger [Fortitude]
- public static bool CanTriggerFortitude(Hashtable hashtable, CardSource card)
- {
- return CanTriggerOnDeletion(hashtable, card);
- }
- #endregion
- #region Can activate [Fortitude]
- public static bool CanActivateFortitude(Hashtable hashtable, CardSource card, bool isInheritedEffect, ICardEffect activateClass)
- {
- if (IsExistOnTrash(card))
- {
- if (!isInheritedEffect || CanActivateOnDeletionInherited(hashtable, card))
- {
- List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
- if (hashtables != null)
- {
- foreach (Hashtable hashtable1 in hashtables)
- {
- List<CardSource> CardSources = CardEffectCommons.GetCardSourcesFromHashtable(hashtable1);
- if (CardSources != null)
- {
- if (CardSources.Contains(card))
- {
- if (CardSources.Count >= 2)
- {
- if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: card, payCost: false, cardEffect: activateClass, root: SelectCardEffect.Root.Trash))
- {
- return true;
- }
- }
- }
- }
- }
- }
- }
- }
- return false;
- }
- #endregion
- #region Effect process of [Fortitude]
- public static IEnumerator FortitudeProcess(Hashtable hashtable, CardSource card, ICardEffect activateClass)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
- cardSources: new List<CardSource>() { card },
- activateClass: activateClass,
- payCost: false,
- isTapped: false,
- root: SelectCardEffect.Root.Trash,
- activateETB: true));
- }
- #endregion
- #region Target 1 Digimon gains [Fortitude]
- public static IEnumerator GainFortitude(Permanent targetPermanent, EffectDuration effectDuration, ICardEffect activateClass)
- {
- if (targetPermanent == null) yield break;
- if (!IsPermanentExistsOnBattleArea(targetPermanent)) yield break;
- if (activateClass == null) yield break;
- if (activateClass.EffectSourceCard == null) yield break;
- CardSource card = activateClass.EffectSourceCard;
- bool CanUseCondition()
- {
- if (IsPermanentExistsOnBattleArea(targetPermanent))
- {
- if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- return true;
- }
- }
- return false;
- }
- ActivateClass evade = CardEffectFactory.EvadeEffect(targetPermanent: targetPermanent, isInheritedEffect: false, condition: CanUseCondition, rootCardEffect: activateClass, targetPermanent.TopCard);
- AddEffectToPermanent(targetPermanent: targetPermanent, effectDuration: effectDuration, card: card, cardEffect: evade, timing: EffectTiming.OnDestroyedAnyone);
- if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(targetPermanent));
- }
- }
- #endregion
- }
|