| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- // DigiLab
- namespace DCGO.CardEffects.P
- {
- public class P_225 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Ignore Color Requirement
- if (timing == EffectTiming.None)
- {
- IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
- ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
- ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
- cardEffects.Add(ignoreColorConditionClass);
- bool HasCSTrait(Permanent permanent)
- {
- if (CardEffectCommons.IsOwnerPermanent(permanent, card))
- {
- if (permanent.TopCard.HasCSTraits)
- {
- if (permanent.IsDigimon || permanent.IsTamer)
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.HasMatchConditionPermanent(HasCSTrait, true);
- }
- bool CardCondition(CardSource cardSource)
- {
- return cardSource == card;
- }
- }
- #endregion
- #region Main
- if (timing == EffectTiming.OptionSkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Draw 1, then place in battle area", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Main] <Draw 1>. Then, place this card in the battle area.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(new DrawClass(
- player: card.Owner,
- drawCount: 1,
- cardEffect: activateClass).Draw()
- );
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(
- card: card,
- cardEffect: activateClass)
- );
- }
- }
- #endregion
- #region Main [Delay]
- if (timing == EffectTiming.OnDeclaration)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("By placing the top stacked card of any of your level 4 or higher [CS] Trait Digimon as its bottom digivolution card, gain 2 memory.", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Main] <Delay>, By placing the top stacked card of any of your level 4 or higher [CS] Trait Digimon as its bottom digivolution card, gain 2 memory.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.CanDeclareOptionDelayEffect(card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card);
- }
- bool CanSelectCard(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
- && permanent.TopCard.HasCSTraits
- && permanent.TopCard.HasLevel
- && permanent.TopCard.Level >= 4
- && permanent.DigivolutionCards.Count >= 1;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
- targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
- activateClass: activateClass,
- successProcess: SuccessProcess,
- failureProcess: null));
- IEnumerator SuccessProcess(List<Permanent> permanents)
- {
- Permanent selectedPermanent = null;
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectCard))
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectCard));
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCard,
- 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.", "The opponent is selecting a Digimon.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if(selectedPermanent != null)
- {
- if (CardEffectCommons.IsExistOnBattleArea(selectedPermanent.TopCard) && selectedPermanent.DigivolutionCards.Count >= 1)
- {
- CardSource topCard = selectedPermanent.TopCard;
- yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { topCard }, activateClass));
- if (selectedPermanent.DigivolutionCards.Contains(topCard))
- {
- yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
- }
- }
- }
- }
- }
- }
- }
- #endregion
- #region Security
- if (timing == EffectTiming.SecuritySkill)
- {
- cardEffects.Add(CardEffectFactory.PlaceSelfDelayOptionSecurityEffect(card));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|