| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- namespace DCGO.CardEffects.BT17
- {
- public class BT17_051 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alternate Digivolution
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.EqualsCardName("Argomon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
- }
- #endregion
- #region On Play/When Digivolving Shared
- int maxLevel()
- {
- int max = 4;
- max += (int)Mathf.Floor(card.PermanentOfThisCard().DigivolutionCards.Count((source) => source.EqualsCardName("Argomon")) / 2);
- return max;
- }
- bool IsLevel5orLowerArgomon(CardSource source)
- {
- if (source.IsDigimon || source.IsDigiEgg)
- {
- if (source.HasLevel && source.Level <= 5)
- {
- if (source.EqualsCardName("Argomon"))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanSelectOpponentsDigimon(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
- {
- if (permanent.TopCard.Level <= maxLevel())
- {
- if (permanent.TopCard.HasLevel)
- {
- return true;
- }
- }
- }
- return false;
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place up to 4, Then delete up to 4 levels total digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[On Play] You may place up to 4 level 5 or lower [Argomon] from your trash as this Digimon's bottom digivolution cards. Then, delete up to 4 levels' total worth of your opponent’s Digimon. For every 2 [Argomon] in this Digimon's digivolution cards, add 1 to the maximum total level you may choose with this effect.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsLevel5orLowerArgomon))
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: IsLevel5orLowerArgomon,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- message: "Select cards to place as the bottom digivolution sources",
- maxCount: 4,
- canEndNotMax: true,
- isShowOpponent: false,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
- {
- if (cardSources.Count > 0)
- {
- yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(cardSources, activateClass));
- }
- }
- }
- if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentsDigimon) >= 1)
- {
- int maxCount = card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentsDigimon);
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectOpponentsDigimon,
- canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
- canEndSelectCondition: CanEndSelectCondition,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: true,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- bool CanEndSelectCondition(List<Permanent> permanents)
- {
- if (permanents.Count <= 0)
- {
- return false;
- }
- int sumCost = 0;
- foreach (Permanent permanent1 in permanents)
- {
- sumCost += permanent1.TopCard.Level;
- }
- if (sumCost > maxLevel())
- {
- return false;
- }
- return true;
- }
- bool CanTargetCondition_ByPreSelecetedList(List<Permanent> permanents, Permanent permanent)
- {
- int sumCost = 0;
- foreach (Permanent permanent1 in permanents)
- {
- sumCost += permanent1.TopCard.Level;
- }
- sumCost += permanent.TopCard.Level;
- if (sumCost > maxLevel())
- {
- return false;
- }
- return true;
- }
- }
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place up to 4, Then delete up to 4 levels total digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Digivolving] You may place up to 4 level 5 or lower [Argomon] from your trash as this Digimon's bottom digivolution cards. Then, delete up to 4 levels' total worth of your opponent’s Digimon. For every 2 [Argomon] in this Digimon's digivolution cards, add 1 to the maximum total level you may choose with this effect.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsLevel5orLowerArgomon))
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: IsLevel5orLowerArgomon,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- message: "Select cards to place as the bottom digivolution sources",
- maxCount: 4,
- canEndNotMax: true,
- isShowOpponent: false,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
- {
- if (cardSources.Count > 0)
- {
- yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(cardSources, activateClass));
- }
- }
- }
- if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentsDigimon) >= 1)
- {
- int maxCount = card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectOpponentsDigimon);
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectOpponentsDigimon,
- canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
- canEndSelectCondition: CanEndSelectCondition,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: true,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- bool CanEndSelectCondition(List<Permanent> permanents)
- {
- if (permanents.Count <= 0)
- {
- return false;
- }
- int sumCost = 0;
- foreach (Permanent permanent1 in permanents)
- {
- sumCost += permanent1.TopCard.Level;
- }
- if (sumCost > maxLevel())
- {
- return false;
- }
- return true;
- }
- bool CanTargetCondition_ByPreSelecetedList(List<Permanent> permanents, Permanent permanent)
- {
- int sumCost = 0;
- foreach (Permanent permanent1 in permanents)
- {
- sumCost += permanent1.TopCard.Level;
- }
- sumCost += permanent.TopCard.Level;
- if (sumCost > maxLevel())
- {
- return false;
- }
- return true;
- }
- }
- }
- }
- #endregion
- #region All Turns
- if (timing == EffectTiming.None)
- {
- int count()
- {
- return (int)Mathf.Floor(card.PermanentOfThisCard().DigivolutionCards.Count((source) => source.EqualsCardName("Argomon")) / 2);
- }
- bool Condition()
- {
- if (count() >= 1)
- return true;
- return false;
- }
- cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(
- changeValue: () => 1000 * count(),
- isInheritedEffect: false,
- card: card,
- condition: Condition));
- }
- #endregion
- #region Opponent's Turn
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
- {
- if (permanent.IsTamer)
- {
- return true;
- }
- }
- return false;
- }
- bool CanUseCondition()
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (!CardEffectCommons.IsOwnerTurn(card))
- return true;
- }
- return false;
- }
- string effectName = "[Opponent's Turn] None of your opponent's Tamers can unsuspend.";
- cardEffects.Add(CardEffectFactory.CantUnsuspendStaticEffect(
- permanentCondition: PermanentCondition,
- isInheritedEffect: false,
- card: card, condition: CanUseCondition,
- effectName: effectName));
- }
- #endregion
-
- return cardEffects;
- }
- }
- }
|