| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace DCGO.CardEffects.BT19
- {
- public class BT19_010 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region All Turns
- if (timing == EffectTiming.WhenRemoveField)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Save up to 3 Digimon cards with the [Xros Heart] trait.", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[All Turns] When this Digimon would leave the battle area, you may place up to 3 Digimon cards with the [Xros Heart] trait from this Digimon's digivolution cards under 1 of your Tamers.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card);
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon && cardSource.EqualsTraits("Xros Heart");
- }
- bool CanSelectSaveTamerPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
- && permanent.IsTamer;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- card.PermanentOfThisCard().DigivolutionCards.Some(CanSelectCardCondition);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- List<CardSource> selectedCards = new List<CardSource>();
- int maxCount = Math.Min(3, card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select digivolution cards to place under 1 of your Tamers.",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Custom,
- customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetUpCustomMessage(
- "Select digivolution cards to place under 1 of your Tamers.",
- "The opponent is selecting digivolution cards to place under 1 of your Tamers.");
- selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
- yield return StartCoroutine(selectCardEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- if (selectedCards.Count >= 1)
- {
- Permanent selectedPermanent = null;
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectSaveTamerPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen cards under.",
- "The opponent is selecting 1 Tamer to place the chosen cards under.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null)
- {
- yield return ContinuousController.instance.StartCoroutine(
- selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
- }
- }
- }
- }
- #endregion
- #region DigiXros
- if (timing == EffectTiming.None)
- {
- AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
- addDigiXrosConditionClass.SetUpICardEffect($"DigiXros -2", CanUseCondition, card);
- addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
- addDigiXrosConditionClass.SetNotShowUI(true);
- cardEffects.Add(addDigiXrosConditionClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return true;
- }
- DigiXrosCondition GetDigiXros(CardSource cardSource)
- {
- if (cardSource == card)
- {
- DigiXrosConditionElement elementA = new DigiXrosConditionElement(CanSelectCardConditionA, "Shoutmon");
- bool CanSelectCardConditionA(CardSource conditionCardSource)
- {
- if (conditionCardSource)
- {
- if (conditionCardSource.Owner == card.Owner)
- {
- if (conditionCardSource.IsDigimon)
- {
- if (conditionCardSource.CardNames_DigiXros.Contains("Shoutmon"))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- DigiXrosConditionElement elementB = new DigiXrosConditionElement(CanSelectCardConditionB, "Ballistamon");
- bool CanSelectCardConditionB(CardSource conditionCardSource)
- {
- if (conditionCardSource)
- {
- if (conditionCardSource.Owner == card.Owner)
- {
- if (conditionCardSource.IsDigimon)
- {
- if (conditionCardSource.CardNames_DigiXros.Contains("Ballistamon"))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- DigiXrosConditionElement elementC = new DigiXrosConditionElement(CanSelectCardConditionC, "Dorulumon");
- bool CanSelectCardConditionC(CardSource conditionCardSource)
- {
- if (conditionCardSource)
- {
- if (conditionCardSource.Owner == card.Owner)
- {
- if (conditionCardSource.IsDigimon)
- {
- if (conditionCardSource.CardNames_DigiXros.Contains("Dorulumon"))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- DigiXrosConditionElement elementD = new DigiXrosConditionElement(CanSelectCardConditionD, "Starmons");
- bool CanSelectCardConditionD(CardSource conditionCardSource)
- {
- if (conditionCardSource)
- {
- if (conditionCardSource.Owner == card.Owner)
- {
- if (conditionCardSource.IsDigimon)
- {
- if (conditionCardSource.CardNames_DigiXros.Contains("Starmons"))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>()
- { elementA, elementB, elementC, elementD };
- DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
- return digiXrosCondition;
- }
- return null;
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|