| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace DCGO.CardEffects.BT17
- {
- public class BT17_068 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region When Revealed from Deck
- if (timing == EffectTiming.None)
- {
- ChangeCardLevelClass changeCardLevelClass = new ChangeCardLevelClass();
- changeCardLevelClass.SetUpICardEffect($"Also treated as level 6 when revealed from the top of the deck.",CanUseCondition, card);
- changeCardLevelClass.SetUpChangeCardLevelClass(GetLevel: GetLevel);
- changeCardLevelClass.SetNotShowUI(true);
- cardEffects.Add(changeCardLevelClass);
-
- bool CanUseCondition(Hashtable hashtable)
- {
- return card.IsBeingRevealed;
- }
-
- int GetLevel(CardSource cardSource, int level)
- {
- if (cardSource == card)
- level = 6;
- return level;
- }
- }
- #endregion
- #region When Would be Played
- if (timing == EffectTiming.BeforePayCost)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Return [Apocalymon] from your trash to deck, to get Play Cost -3", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- activateClass.SetHashString("PlayCost-3_BT17_068");
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "When this card would be played from the hand, by returning 1 [Apocalymon] from your trash to the bottom of the deck, reduce the play cost by 3.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition);
- }
- bool IsApocalymonCardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon &&
- cardSource.EqualsCardName("Apocalymon");
- }
- bool CardCondition(CardSource cardSource)
- {
- return cardSource == card &&
- CardEffectCommons.IsExistOnHand(cardSource);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsApocalymonCardCondition);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsApocalymonCardCondition))
- {
- CardSource cardFromHashtable = CardEffectCommons.GetCardFromHashtable(hashtable);
- bool returned = false;
- bool canNoSelect = !(cardFromHashtable &&
- (CardEffectCommons.GetPayCostFromHashtable(hashtable)
- && card.PayingCost(SelectCardEffect.Root.Hand, null, checkAvailability: false) > card.Owner.MaxMemoryCost));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: IsApocalymonCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => canNoSelect,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- message: "Select 1 card to place at the bottom of the deck.",
- maxCount: 1,
- canEndNotMax: false,
- 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());
- 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));
- returned = true;
- }
- }
- if (returned)
- {
- if (card.Owner.CanReduceCost(null, card))
- {
- ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
- }
- ChangeCostClass changeCostClass = new ChangeCostClass();
- changeCostClass.SetUpICardEffect("Play Cost -3", CanUseConditionChangeCost, card);
- changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition,
- rootCondition: RootCondition, isUpDown: IsUpDown, isCheckAvailability: () => false,
- isChangePayingCost: () => true);
- card.Owner.UntilCalculateFixedCostEffect.Add(_ => changeCostClass);
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ShowReducedCost(hashtable));
- bool CanUseConditionChangeCost(Hashtable hashtableChangeCost)
- {
- return true;
- }
- int ChangeCost(CardSource cardSource, int cost, SelectCardEffect.Root root,
- List<Permanent> targetPermanents)
- {
- if (CardSourceCondition(cardSource) && RootCondition(root) && PermanentsCondition(targetPermanents))
- {
- cost -= 3;
- }
- return cost;
- }
- bool CardSourceCondition(CardSource cardSource)
- {
- return cardSource == card;
- }
- bool RootCondition(SelectCardEffect.Root root)
- {
- return true;
- }
- bool PermanentsCondition(List<Permanent> targetPermanents)
- {
- return targetPermanents == null ||
- targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0;
- }
- bool IsUpDown()
- {
- return true;
- }
- }
- }
- }
- }
- #endregion
- #region On Deletion
- if (timing == EffectTiming.OnDestroyedAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Play Digimon from hand or trash.", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[On Deletion] If deleted by an effect, you may play 1 [Gulfmon] or 1 level 6 Digimon with the [Dark Masters] trait from your hand or trash without paying the cost.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass) &&
- CardEffectCommons.IsByEffect(hashtable, null);
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.EqualsCardName("Gulfmon") ||
- (cardSource.IsDigimon &&
- cardSource.HasLevel &&
- cardSource.Level == 6 &&
- cardSource.ContainsTraits("Dark Masters"));
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
- (card.Owner.HandCards.Some(CanSelectCardCondition) ||
- card.Owner.TrashCards.Some(CanSelectCardCondition));
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- bool canSelectHand = card.Owner.HandCards.Some(CanSelectCardCondition);
- bool canSelectTrash = card.Owner.TrashCards.Some(CanSelectCardCondition);
- if (canSelectHand || canSelectTrash)
- {
- if (canSelectHand && canSelectTrash)
- {
- List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
- {
- new(message: "From hand", value: true, spriteIndex: 0),
- new(message: "From trash", value: false, spriteIndex: 1),
- };
- string selectPlayerMessage = "From which area do you play a card?";
- string notSelectPlayerMessage = "The opponent is choosing from which area to play a card.";
- GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
- selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
- notSelectPlayerMessage: notSelectPlayerMessage);
- }
- else
- {
- GManager.instance.userSelectionManager.SetBool(canSelectHand);
- }
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
- .WaitForEndSelect());
- bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
- List<CardSource> selectedCards = new List<CardSource>();
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- if (fromHand)
- {
- 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 to play.", "The opponent is selecting 1 card to play.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
- yield return StartCoroutine(selectHandEffect.Activate());
- }
- else
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to play.",
- maxCount: 1,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
- selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
- cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
- root: (fromHand) ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash,
- activateETB: true));
- }
- }
- }
- #endregion
- #region When Attacking - ESS
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place 1 digimon from trash under this Digimon's digivolution cards", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
- activateClass.SetIsInheritedEffect(true);
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[When Attacking] (Once Per Turn) By placing 1 level 5 or lower card with [Dark Masters] in its text from your trash as this Digimon's bottom digivolution card, this Digimon gets +2000 DP for the turn.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool IsDarkMastersCardCondition(CardSource cardSource)
- {
- return cardSource.HasLevel &&
- cardSource.Level <= 5 &&
- cardSource.HasText("Dark Masters");
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card) &&
- CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsDarkMastersCardCondition);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsDarkMastersCardCondition))
- {
- List<CardSource> selectedCards = new List<CardSource>();
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: IsDarkMastersCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to place on bottom of digivolution cards.",
- maxCount: 1,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetUpCustomMessage(
- "Select 1 card to place on bottom of digivolution cards.",
- "The opponent is selecting 1 card to place on bottom of digivolution cards.");
- selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- if (selectedCards.Count >= 1)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
- .AddDigivolutionCardsBottom(
- selectedCards,
- activateClass));
- yield return ContinuousController.instance.StartCoroutine(
- CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 2000,
- effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
- }
- }
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|