| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- //Canoweissmon
- namespace DCGO.CardEffects.BT21
- {
- public class BT21_022 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alternative Digivolution Condition
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- if (targetPermanent.TopCard.Level == 4)
- {
- if (targetPermanent.TopCard.HasText("Gammamon"))
- {
- return true;
- }
- }
- return false;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
- permanentCondition: PermanentCondition,
- digivolutionCost: 3,
- ignoreDigivolutionRequirement: false,
- card: card,
- condition: null)
- );
- }
- #endregion
- #region On Play / When Digivolving Shared
- bool CanSelectCardCondition(CardSource cardSource)
- {
- if (cardSource.IsDigimon)
- {
- if (cardSource.HasText("Gammamon"))
- {
- return true;
- }
- }
- return false;
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
- {
- if (permanent.DP <= 7000)
- {
- return true;
- }
- }
- return false;
- }
- bool SharedCanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- bool cardAdded = false;
- CardSource selectedCard = null;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage("Select 1 card.", "The opponent is selecting 1 card.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- if (selectedCard != null)
- {
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
- cardAdded = true;
- }
- if (cardAdded)
- {
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Add card from hand as source, destroy a 7k or less digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- => "[On Play] By placing 1 Digimon card with [Gammamon] in its text from your hand as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with 7000 DP or less.";
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
- {
- return true;
- }
- }
- return false;
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Add card from hand as source, destroy a 7k or less digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- => "[When Digivolving] By placing 1 Digimon card with [Gammamon] in its text from your hand as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with 7000 DP or less.";
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
- {
- return true;
- }
- }
- return false;
- }
- }
- #endregion
- #region ESS
- if (timing == EffectTiming.WhenRemoveField)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Prevent from leaving", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("PreventLeaving_BT21_022");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- => "[All Turns] [Once Per Turn] When this Digimon with [Gammamon] in its text would leave the battle area by your opponent's effects, by trashing 3 Digimon cards from its digivolution cards, it doesn't leave.";
- bool SourceCondition(CardSource source)
- {
- return source.IsDigimon;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
- {
- if (CardEffectCommons.IsByEffect(hashtable, CardEffectCondition))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
- {
- if (card.PermanentOfThisCard().TopCard.HasText("Gammamon"))
- {
- if(card.PermanentOfThisCard().DigivolutionCards.Count(SourceCondition) >= 3)
- return true;
- }
- }
- return false;
- }
- bool CardEffectCondition(ICardEffect effect)
- {
- return CardEffectCommons.IsOpponentEffect(effect, card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- Permanent permanent = card.PermanentOfThisCard();
- List<CardSource> selectedCards = new List<CardSource>();
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: SourceCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: SelectCardCoroutine,
- message: "Select digivolution cards to trash",
- maxCount: 3,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Custom,
- customRootCardList: permanent.DigivolutionCards,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: null);
- selectCardEffect.SetUpCustomMessage("Select digivolution cards to trash.", "The opponent is selecting digivolution cards to return to trash.");
- selectCardEffect.SetNotShowCard();
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator SelectCardCoroutine(List<CardSource> cardSources)
- {
- selectedCards = cardSources;
- yield return null;
- }
- if (selectedCards.Count >= 3)
- {
- yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(permanent, selectedCards, activateClass).TrashDigivolutionCards());
- permanent.willBeRemoveField = false;
- permanent.HideDeleteEffect();
- permanent.HideHandBounceEffect();
- permanent.HideDeckBounceEffect();
- permanent.HideWillRemoveFieldEffect();
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|