| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- namespace DCGO.CardEffects.P
- {
- public class P_168 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Start of Your Main Phase
- if (timing == EffectTiming.OnStartMainPhase)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card) &&
- CardEffectCommons.IsOwnerTurn(card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card) &&
- card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1 &&
- card.Owner.CanAddMemory(activateClass);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
- }
- }
- #endregion
- #region Your Turn
- if (timing == EffectTiming.OnAddDigivolutionCards)
- {
- Permanent sourcesAddedPermanent = null;
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Digivolve 1 of you Digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[Your Turn] When effects add digivolution cards to any of your Digimon with [Aqua] or [Sea Animal] in any of their traits, by suspending this Tamer, one of those Digimon may digivolve into a Digimon card with [Aqua] or [Sea Animal] in any of its traits in the hand with the digivolution cost reduced by 1.";
- }
- bool IsValidPermanentToDigivolveCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
- (permanent.TopCard.HasAquaTraits || permanent.TopCard.HasSeaAnimalTraits);
- }
- bool IsValidCardToDigivolveIntoCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon && cardSource.HasLevel && cardSource.HasAquaTraits;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- if (CardEffectCommons.CanTriggerOnAddDigivolutionCard(
- hashtable: hashtable,
- permanentCondition: IsValidPermanentToDigivolveCondition,
- cardEffectCondition: cardEffect => cardEffect.EffectSourceCard != null,
- cardCondition: null))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanSelectDigimonToDigivolve(Permanent permanent)
- {
- return sourcesAddedPermanent == permanent &&
- CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- sourcesAddedPermanent = CardEffectCommons.GetPermanentFromHashtable(hashtable);
- return CardEffectCommons.IsExistOnBattleArea(card) &&
- CardEffectCommons.CanActivateSuspendCostEffect(card) &&
- IsValidPermanentToDigivolveCondition(sourcesAddedPermanent);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- List<Permanent> selectedCards = new List<Permanent>();
- yield return ContinuousController.instance.StartCoroutine(
- new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() },
- CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonToDigivolve))
- {
- Permanent selectedPermanent = null;
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimonToDigivolve));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectDigimonToDigivolve,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- targetPermanent: selectedPermanent,
- cardCondition: IsValidCardToDigivolveIntoCondition,
- payCost: true,
- reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: true,
- activateClass: activateClass,
- successProcess: null));
- }
- }
- }
- }
- #endregion
- #region Security Effect
- if (timing == EffectTiming.SecuritySkill)
- {
- cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|