| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Linq;
- using Photon;
- using System;
- using Photon.Pun;
- public class EX5_074 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- if (timing == EffectTiming.None)
- {
- static bool PermanentCondition(Permanent targetPermanent)
- {
- if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 6)
- {
- if (targetPermanent.TopCard.CardTraits.Contains("Four Sovereigns"))
- {
- return true;
- }
- if (targetPermanent.TopCard.CardTraits.Contains("FourSovereigns"))
- {
- return true;
- }
- }
- return false;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
- }
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Return cards from trash to the bottom of deck to reduce opponent's Digimon's DP", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[On Play] By returning up to 4 cards with the [Deva]/[Four Sovereigns] trait from your trash to the bottom of the deck, for each one, all your opponent's Digimon get -4000 DP for the turn.";
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- if (cardSource.CardTraits.Contains("Deva"))
- {
- return true;
- }
- if (cardSource.CardTraits.Contains("Four Sovereigns"))
- {
- return true;
- }
- if (cardSource.CardTraits.Contains("FourSovereigns"))
- {
- return true;
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 1)
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 1)
- {
- int maxCount = Math.Min(4, card.Owner.TrashCards.Count(CanSelectCardCondition));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: CanEndSelectCondition,
- canNoSelect: () => true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- message: "Select cards to place at the bottom of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
- maxCount: maxCount,
- canEndNotMax: true,
- isShowOpponent: false,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetNotShowCard();
- selectCardEffect.SetNotAddLog();
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- bool CanEndSelectCondition(List<CardSource> cardSources)
- {
- if (CardEffectCommons.HasNoElement(cardSources))
- {
- return false;
- }
- return true;
- }
- IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
- {
- if (cardSources.Count >= 1)
- {
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true));
- int minusDP = 4000 * cardSources.Count;
- bool PermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
- permanentCondition: PermanentCondition,
- changeValue: -minusDP,
- effectDuration: EffectDuration.UntilEachTurnEnd,
- activateClass: activateClass));
- }
- }
- }
- }
- }
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Return cards from trash to the bottom of deck to reduce opponent's Digimon's DP", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Attacking] By returning up to 4 cards with the [Deva]/[Four Sovereigns] trait from your trash to the bottom of the deck, for each one, all your opponent's Digimon get -4000 DP for the turn.";
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- if (cardSource.CardTraits.Contains("Deva"))
- {
- return true;
- }
- if (cardSource.CardTraits.Contains("Four Sovereigns"))
- {
- return true;
- }
- if (cardSource.CardTraits.Contains("FourSovereigns"))
- {
- return true;
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 1)
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 1)
- {
- int maxCount = Math.Min(4, card.Owner.TrashCards.Count(CanSelectCardCondition));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: CanEndSelectCondition,
- canNoSelect: () => true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- message: "Select cards to place at the bottom of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
- maxCount: maxCount,
- canEndNotMax: true,
- isShowOpponent: false,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetNotShowCard();
- selectCardEffect.SetNotAddLog();
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- bool CanEndSelectCondition(List<CardSource> cardSources)
- {
- if (CardEffectCommons.HasNoElement(cardSources))
- {
- return false;
- }
- return true;
- }
- IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
- {
- if (cardSources.Count >= 1)
- {
- yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true));
- int minusDP = 4000 * cardSources.Count;
- bool PermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
- permanentCondition: PermanentCondition,
- changeValue: -minusDP,
- effectDuration: EffectDuration.UntilEachTurnEnd,
- activateClass: activateClass));
- }
- }
- }
- }
- }
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Trash the top cards of opponent's security", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Attacking] For each of your Digimon with the [Four Sovereigns] trait, trash the top card of your opponent's security stack.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.Owner.Enemy.SecurityCards.Count >= 1)
- {
- if (card.Owner.GetBattleAreaDigimons().Some(permanent =>
- permanent.TopCard.CardTraits.Contains("Four Sovereigns")
- || permanent.TopCard.CardTraits.Contains("FourSovereigns")))
- {
- return true;
- }
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- int trashCount = card.Owner.GetBattleAreaDigimons().Count(permanent =>
- permanent.TopCard.CardTraits.Contains("Four Sovereigns")
- || permanent.TopCard.CardTraits.Contains("FourSovereigns"));
- yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
- player: card.Owner.Enemy,
- destroySecurityCount: trashCount,
- cardEffect: activateClass,
- fromTop: true).DestroySecurity());
- }
- }
- if (timing == EffectTiming.None)
- {
- CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
- canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects", CanUseCondition, card);
- canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
- cardEffects.Add(canNotAffectedClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- return true;
- }
- return false;
- }
- bool CardCondition(CardSource cardSource)
- {
- if (cardSource == card)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (cardSource == card.PermanentOfThisCard().TopCard)
- {
- return true;
- }
- }
- }
- return false;
- }
- bool SkillCondition(ICardEffect cardEffect)
- {
- if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
- {
- if (cardEffect.IsDigimonEffect)
- {
- return true;
- }
- if (cardEffect.IsDigimonEffect && cardEffect.IsSecurityEffect)
- {
- return true;
- }
- }
- return false;
- }
- }
- return cardEffects;
- }
- }
|