| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace DCGO.CardEffects.Examples
- {
- public class Link_Examples : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Basic link effect keyword
- if (timing == EffectTiming.OnDeclaration)
- {
- cardEffects.Add(CardEffectFactory.LinkEffect(card, 1, 2000));
- }
- #endregion
- #region When Linked Example, Specifically When THIS card is added as a linked card
- if (timing == EffectTiming.WhenLinked)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Testing When Linking", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- activateClass.SetIsLinkedEffect(true);
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When linked] Testing When linking";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return isExistOnField(card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- UnityEngine.Debug.Log("CARD SUCCESSFULLY LINKED");
- yield return null;
- }
- }
- #endregion
- #region When Linked Example, When A card is linked at all
- if (timing == EffectTiming.WhenLinked)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Testing When Linked", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Your Turn] When this Digimon gets linked";
- }
- bool PermanentCondition(Permanent permanent)
- {
- return permanent == card.PermanentOfThisCard();
- }
- bool CardCondition(CardSource source)
- {
- return true;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenLinked(hashtable, PermanentCondition, CardCondition);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return isExistOnField(card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- UnityEngine.Debug.Log("CARD LINKED");
- yield return null;
- }
- }
- #endregion
- #region Trash 1 Link card
- if (timing == EffectTiming.OnStartMainPhase)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "";
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent))
- {
- if (permanent.LinkedCards.Map(link => link.Source).Count(CanSelectCardCondition) >= 1)
- {
- return true;
- }
- }
- return false;
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return true;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- return true;
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- return true;
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashLinkedCards(
- permanentCondition: CanSelectPermanentCondition,
- cardCondition: CanSelectCardCondition,
- maxCount: 1,
- canNoTrash: false,
- isFromOnly1Permanent: true,
- activateClass: activateClass
- ));
- }
- }
- #endregion
- #region Change Link Max Count
- if (timing == EffectTiming.None)
- {
- bool Condition()
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- return true;
- }
- return false;
- }
- cardEffects.Add(CardEffectFactory.ChangeSelfLinkMaxStaticEffect(
- changeValue: 1,
- isInheritedEffect: true,
- card: card,
- condition: Condition));
- }
- return cardEffects;
- }
- #endregion
- }
- }
|