| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635 |
- using System.Collections;
- using System.Collections.Generic;
- using System;
- using System.Linq;
- namespace DCGO.CardEffects.BT17
- {
- public class BT17_026 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Hand - Main
- if (timing == EffectTiming.OnDeclaration)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Your [Koji Minamoto] digivolves into this card", CanUseCondition,
- card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[Hand] [Main] By placing 1 [Lobomon] and [KendoGarurumon] from your trash under 1 of your [Koji Minamoto]s, digivolve it into this card as if that card is a level 4 blue Digimon for a digivolution cost of 3.";
- }
- bool CanSelectLobomonCardCondition(CardSource cardSource)
- {
- if (cardSource != null)
- {
- if (cardSource.Owner == card.Owner)
- {
- if (cardSource.EqualsCardName("Lobomon"))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanSelectKendoGarurumonCardCondition(CardSource cardSource)
- {
- if (cardSource != null)
- {
- if (cardSource.Owner == card.Owner)
- {
- if (cardSource.EqualsCardName("KendoGarurumon"))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (permanent != null)
- {
- if (permanent.TopCard != null)
- {
- if (permanent.TopCard.Owner == card.Owner)
- {
- if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
- {
- if (!permanent.IsToken)
- {
- if (permanent.TopCard.EqualsCardName("Koji Minamoto") ||
- permanent.TopCard.EqualsCardName("KojiMinamoto"))
- {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (card.Owner.HandCards.Contains(card))
- {
- if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card,
- CanSelectLobomonCardCondition))
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card,
- CanSelectKendoGarurumonCardCondition))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (card.Owner.HandCards.Contains(card))
- {
- if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
- {
- Permanent selectedPermanent = null;
- int maxCount = Math.Min(1,
- card.Owner.GetBattleAreaPermanents().Count(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: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 [Koji Minamoto].",
- "The opponent is selecting 1 [Koji Minamoto].");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card,
- (cardSource) =>
- CanSelectLobomonCardCondition(cardSource) ||
- CanSelectKendoGarurumonCardCondition(cardSource)))
- {
- bool digivolve = false;
- maxCount = 2;
- if (card.Owner.TrashCards.Count((cardSource) =>
- CanSelectLobomonCardCondition(cardSource) ||
- CanSelectKendoGarurumonCardCondition(cardSource)) <
- maxCount)
- {
- maxCount = card.Owner.TrashCards.Count((cardSource) =>
- CanSelectLobomonCardCondition(cardSource) ||
- CanSelectKendoGarurumonCardCondition(cardSource));
- }
- List<CardSource> selectedCards = new List<CardSource>();
- SelectCardEffect selectCardEffect =
- GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: (cardSource) =>
- CanSelectLobomonCardCondition(cardSource) ||
- CanSelectKendoGarurumonCardCondition(cardSource),
- canTargetCondition_ByPreSelecetedList: CanTargetConditionByPreSelectedList,
- canEndSelectCondition: CanEndSelectCondition,
- canNoSelect: () => false,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message:
- "Select cards to place on the bottom of Digivolution cards\n(cards will be placed in the digivolution cards so that cards with lower numbers are on top).",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(
- selectCardEffect.Activate());
- bool CanTargetConditionByPreSelectedList(List<CardSource> cardSources,
- CardSource cardSource)
- {
- if (cardSources.Count(CanSelectLobomonCardCondition) >= 1)
- {
- if (CanSelectLobomonCardCondition(cardSource))
- {
- return false;
- }
- }
- if (cardSources.Count(CanSelectKendoGarurumonCardCondition) >= 1)
- {
- if (CanSelectKendoGarurumonCardCondition(cardSource))
- {
- return false;
- }
- }
- return true;
- }
- bool CanEndSelectCondition(List<CardSource> cardSources)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card,
- CanSelectLobomonCardCondition))
- {
- if (cardSources.Count(CanSelectLobomonCardCondition) == 0)
- {
- return false;
- }
- }
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card,
- CanSelectKendoGarurumonCardCondition))
- {
- if (cardSources.Count(CanSelectKendoGarurumonCardCondition) == 0)
- {
- return false;
- }
- }
- if (cardSources.Count(CanSelectLobomonCardCondition) >= 2)
- {
- return false;
- }
- if (cardSources.Count(CanSelectKendoGarurumonCardCondition) >= 2)
- {
- return false;
- }
- return true;
- }
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- if (selectedCards.Count >= 1)
- {
- yield return ContinuousController.instance.StartCoroutine(
- selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
- if (selectedCards.Count == 2)
- {
- digivolve = true;
- }
- }
- if (digivolve)
- {
- CardSource topCard = selectedPermanent.TopCard;
- ChangeCardColorClass changeCardColorClass = new ChangeCardColorClass();
- changeCardColorClass.SetUpICardEffect($"Treated as blue",
- CanUseChangeColorCondition,
- card);
- changeCardColorClass.SetUpChangeCardColorClass(
- ChangeCardColors: ChangeCardColors);
- changeCardColorClass.SetNotShowUI(true);
- bool CanUseChangeColorCondition(Hashtable ccHashtable)
- {
- if (selectedPermanent.TopCard != null)
- {
- if (card.Owner.GetBattleAreaPermanents().Contains(selectedPermanent))
- {
- if (topCard == selectedPermanent.TopCard)
- {
- return true;
- }
- }
- }
- return false;
- }
- List<CardColor> ChangeCardColors(CardSource cardSource,
- List<CardColor> cardColors)
- {
- if (cardSource == selectedPermanent.TopCard)
- {
- cardColors.Add(CardColor.Red);
- }
- return cardColors;
- }
- ChangePermanentLevelClass changePermanentLevelClass =
- new ChangePermanentLevelClass();
- changePermanentLevelClass.SetUpICardEffect($"Treated as level 4",
- CanUseChangeColorCondition, card);
- changePermanentLevelClass.SetUpChangePermanentLevelClass(GetLevel: GetLevel);
- changePermanentLevelClass.SetNotShowUI(true);
- int GetLevel(Permanent permanent, int level)
- {
- if (selectedPermanent.TopCard != null)
- {
- if (permanent == selectedPermanent)
- {
- level = 4;
- }
- }
- return level;
- }
- TreatAsDigimonClass treatAsDigimonClass = new TreatAsDigimonClass();
- treatAsDigimonClass.SetUpICardEffect($"Treated as Digimon",
- CanUseChangeColorCondition,
- card);
- treatAsDigimonClass.SetUpTreatAsDigimonClass(
- permanentCondition: PermanentCondition);
- treatAsDigimonClass.SetNotShowUI(true);
- bool PermanentCondition(Permanent permanent)
- {
- if (selectedPermanent.TopCard != null)
- {
- if (permanent == selectedPermanent)
- {
- return true;
- }
- }
- return false;
- }
- DontHaveDPClass dontHaveDPClass = new DontHaveDPClass();
- dontHaveDPClass.SetUpICardEffect("Don't have DP", CanUseChangeColorCondition,
- card);
- dontHaveDPClass.SetUpDontHaveDPClass(PermanentCondition: PermanentCondition);
- dontHaveDPClass.SetNotShowUI(true);
- List<Func<EffectTiming, ICardEffect>> getCardEffects =
- new List<Func<EffectTiming, ICardEffect>>()
- {
- _ => changeCardColorClass,
- _ => changePermanentLevelClass,
- _ => treatAsDigimonClass,
- _ => dontHaveDPClass,
- };
- foreach (Func<EffectTiming, ICardEffect> getCardEffect in getCardEffects)
- {
- card.Owner.PermanentEffects.Add(getCardEffect);
- }
- if (card.CanPlayCardTargetFrame(selectedPermanent.PermanentFrame, true,
- activateClass))
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- targetPermanent: selectedPermanent,
- cardCondition: source => source == card,
- payCost: true,
- reduceCostTuple: null,
- fixedCostTuple: (fixedCost: 3, fixedCostCardCondition: null),
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: true,
- activateClass: activateClass,
- successProcess: null));
- }
- foreach (Func<EffectTiming, ICardEffect> getCardEffect in getCardEffects)
- {
- card.Owner.PermanentEffects.Remove(getCardEffect);
- }
- }
- }
- }
- }
- }
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Return 1 digivolution card and 1 of your opponent's Digimon can't suspend", CanUseCondition,
- card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[When Digivolving] By returning 1 card with the [Hybrid] trait from this Digimon's digivolution cards to the hand, 1 of your opponent's Digimon or Tamers can't suspend until the end of their turn.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- bool CanSelectSourceCardCondition(CardSource cardSource)
- {
- return cardSource.CardTraits.Contains("Hybrid");
- }
- bool CanSelectOpponentPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
- {
- return permanent.IsDigimon || permanent.IsTamer;
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectSourceCardCondition) >= 1)
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- Permanent selectedPermanent = card.PermanentOfThisCard();
- if (selectedPermanent.DigivolutionCards.Count(CanSelectSourceCardCondition) >= 1)
- {
- int maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectSourceCardCondition));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectSourceCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => false,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to add to your hand.",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.AddHand,
- root: SelectCardEffect.Root.Custom,
- customRootCardList: selectedPermanent.DigivolutionCards,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- yield return StartCoroutine(selectCardEffect.Activate());
-
- if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentPermanentCondition))
- {
- maxCount = Math.Min(1,
- CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
- SelectPermanentEffect selectPermanentEffect =
- GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition_ByPreSelecetedList: null,
- canTargetCondition: CanSelectOpponentPermanentCondition,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon/Tamer that will be unable to suspend.",
- "The opponent is selecting 1 Digimon/Tamer that will be unable to suspend.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
- canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCanNotSuspendCondition, card);
- canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCanNotSuspendCondition);
- selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
- if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance
- .GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
- }
- bool CanUseCanNotSuspendCondition(Hashtable hashtableCanNotSuspend)
- {
- if (selectedPermanent.TopCard != null)
- {
- if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- return true;
- }
- }
- return false;
- }
- bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
- {
- if (permanentCanNotSuspend == selectedPermanent)
- {
- return true;
- }
- return false;
- }
- }
- }
- }
- }
- }
- #endregion
- #region When Attacking - ESS
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Return 1 of your opponent's Digimon to hand", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetIsInheritedEffect(true);
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[When Attacking] [Once Per Turn] If this Digimon has the [Hybrid]/[Ten Warriors] trait, return 1 of your opponent's level 4 or lower Digimon to the hand.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
- {
- if (permanent.Level <= 4)
- {
- return true;
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.PermanentOfThisCard().TopCard.ContainsTraits("Hybrid") ||
- card.PermanentOfThisCard().TopCard.ContainsTraits("Ten Warriors") ||
- card.PermanentOfThisCard().TopCard.ContainsTraits("TenWarriors"))
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- return true;
- }
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- 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.Bounce,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|