| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- using System.Collections;
- using System.Collections.Generic;
- namespace DCGO.CardEffects.EX3
- {
- public class EX3_065 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- if (timing == EffectTiming.OnStartTurn)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Start of Your Turn] If your opponent has a Digimon in play, gain 1 memory.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- return true;
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
- {
- if (card.Owner.CanAddMemory(activateClass))
- {
- return true;
- }
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
- }
- }
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Activate [On Play] Effect", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Your Turn] When one of your Digimon digivolves into a Digimon with [Rock Dragon], [Earth Dragon], [Machine Dragon], or [Sky Dragon] in its traits, by suspending this Digimon, activate 1 of that Digimon's [On Play] effects.";
- }
- bool PermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- if (permanent.TopCard.CardTraits.Contains("Rock Dragon"))
- {
- return true;
- }
- if (permanent.TopCard.CardTraits.Contains("RockDragon"))
- {
- return true;
- }
- if (permanent.TopCard.CardTraits.Contains("Earth Dragon"))
- {
- return true;
- }
- if (permanent.TopCard.CardTraits.Contains("EarthDragon"))
- {
- return true;
- }
- if (permanent.TopCard.CardTraits.Contains("Machine Dragon"))
- {
- return true;
- }
- if (permanent.TopCard.CardTraits.Contains("MachineDragon"))
- {
- return true;
- }
- if (permanent.TopCard.CardTraits.Contains("Sky Dragon"))
- {
- return true;
- }
- if (permanent.TopCard.CardTraits.Contains("SkyDragon"))
- {
- return true;
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.CanActivateSuspendCostEffect(card))
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
- List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
- hashtable: _hashtable,
- rootCondition: null);
- if (permanents != null)
- {
- List<ICardEffect> candidateEffects = permanents
- .Map(permanent => permanent.EffectList(EffectTiming.OnEnterFieldAnyone))
- .Flat()
- .Clone()
- .Filter(cardEffect => cardEffect != null && cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect && cardEffect.IsOnPlay);
- if (candidateEffects.Count >= 1)
- {
- ICardEffect selectedEffect = null;
- if (candidateEffects.Count == 1)
- {
- selectedEffect = candidateEffects[0];
- }
- else
- {
- List<SkillInfo> skillInfos = candidateEffects
- .Map(cardEffect => new SkillInfo(cardEffect, null, EffectTiming.None));
- List<CardSource> cardSources = candidateEffects
- .Map(cardEffect => cardEffect.EffectSourceCard);
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: (cardSource) => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => false,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: null,
- message: "Select 1 effect to activate.",
- maxCount: 1,
- canEndNotMax: false,
- isShowOpponent: false,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Custom,
- customRootCardList: cardSources,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetNotShowCard();
- selectCardEffect.SetUpSkillInfos(skillInfos);
- selectCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator AfterSelectIndexCoroutine(List<int> selectedIndexes)
- {
- if (selectedIndexes.Count == 1)
- {
- selectedEffect = candidateEffects[selectedIndexes[0]];
- yield return null;
- }
- }
- }
- if (selectedEffect != null)
- {
- if (selectedEffect.EffectSourceCard != null)
- {
- if (selectedEffect.EffectSourceCard.PermanentOfThisCard() != null)
- {
- Hashtable effectHashtable = CardEffectCommons.OnPlayCheckHashtableOfCard(selectedEffect.EffectSourceCard);
- if (selectedEffect.CanUse(effectHashtable))
- {
- selectedEffect.SetIsDigimonEffect(true);
- yield return ContinuousController.instance.StartCoroutine(((ActivateICardEffect)selectedEffect).Activate_Optional_Effect_Execute(effectHashtable));
- }
- }
- }
- }
- }
- }
- }
- }
- if (timing == EffectTiming.SecuritySkill)
- {
- cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
- }
- return cardEffects;
- }
- }
- }
|