| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // BeelStarMon // Fly Bullet
- namespace DCGO.CardEffects.BT25
- {
- public class BT25_085 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Digimon Effects
- #region Alt Digivolution
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent permanent)
- {
- return permanent.TopCard.HasText("Three Musketeers")
- || permanent.TopCard.EqualsTraits("TS");
- }
-
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 5));
- }
- #endregion
- #region Blocker
- if (timing == EffectTiming.None)
- {
- cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
- }
- #endregion
- #region Shared WD / WA
- string UseOptionHashString = "BT25_085_WD_WA";
- string UseOptionEffectName = "Use a [Three Musketeers] or [TS] Option from hand or under this digimon for free";
- string UseOptionEffectDescription(string tag)
- => $"[{tag}] [Once Per Turn] You may use 1 [Three Musketeers] or [TS] trait Option card from your hand or this Digimon's digivolution cards without paying the cost.";
- CardEffectFactory.ActivateClassesForSharedEffects
- (ref cardEffects, timing, card,
- UseOptionEffectName,
- UseOptionActivateCoroutine,
- UseOptionEffectDescription,
- optional: false,
- isSkippable: true,
- additionalActivateCondition: CanActivateUseOption,
- maxCountPerTurn: 1,
- hashValue: UseOptionHashString,
- whenDigivolving: true,
- whenAttacking: true);
- bool IsTraitedOption(CardSource cardSource)
- {
- return cardSource.IsOption
- && (cardSource.EqualsTraits("Three Musketeers")
- || cardSource.EqualsTraits("TS"))
- && !cardSource.CanNotPlayThisOption;
- }
- bool CanActivateUseOption(Hashtable hashtable, ActivateClass activateClass)
- {
- return CardEffectCommons.HasMatchConditionOwnersHand(card, IsTraitedOption)
- || card.PermanentOfThisCard().DigivolutionCards.Any(IsTraitedOption);
- }
- IEnumerator UseOptionActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- bool executed = false;
- bool validHandCards = CardEffectCommons.HasMatchConditionOwnersHand(card, IsTraitedOption);
- bool validDigivolutionCards = card.PermanentOfThisCard().DigivolutionCards.Any(IsTraitedOption);
- List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
- if (validHandCards)
- {
- selectionElements.Add(new (message: $"Use from Hand", value : 1, spriteIndex: 0));
- }
- if (validDigivolutionCards)
- {
- selectionElements.Add(new (message: $"Use from Digivolution Cards", value : 2, spriteIndex: 0));
- }
- selectionElements.Add( new (message: "Don't use an Option", value: 3, spriteIndex: 1));
- string selectPlayerMessage = "From which area will you use an Option?";
- string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
- GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
- bool doUse = GManager.instance.userSelectionManager.SelectedIntValue != 3;
- bool fromHand = GManager.instance.userSelectionManager.SelectedIntValue == 1;
- if (doUse)
- {
- if (fromHand)
- {
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: IsTraitedOption,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: cardSource => SelectCardCoroutine(cardSource, SelectCardEffect.Root.Hand),
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage("Select a [Three Musketeers] Option to place use.", "Opponent is selecting a card to use.");
- yield return StartCoroutine(selectHandEffect.Activate());
- }
- else
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: IsTraitedOption,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: cardSource => SelectCardCoroutine(cardSource, SelectCardEffect.Root.DigivolutionCards),
- afterSelectCardCoroutine: null,
- message: "Select 1 card to place.",
- maxCount: 1,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.DigivolutionCards,
- customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetUpCustomMessage("Select a [Three Musketeers] Option to place use.", "Opponent is selecting a card to use.");
- yield return StartCoroutine(selectCardEffect.Activate());
- }
- IEnumerator SelectCardCoroutine(CardSource cardSource, SelectCardEffect.Root root)
- {
- executed = true;
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayOptionCards(
- cardSources: new List<CardSource> { cardSource },
- activateClass: activateClass,
- payCost: false,
- root: root));
- }
- }
- if (!executed)
- {
- activateClass.RemoveUse();
- }
- }
- #endregion
- #region Shared WD / WA / Counter
- string UnsuspendHashString = "BT25_085_WD_WA_Counter";
- string UnsuspendEffectName = "By trashing 1 Option from any of your digivolution cards or link cards, unsuspend";
- string UnsuspendEffectDescription(string tag)
- => $"[{tag}] [Once Per Turn] By trashing 1 Option card from any of your Digimon's digivolution cards or link cards, this Digimon unsuspends.";
- CardEffectFactory.ActivateClassesForSharedEffects
- (ref cardEffects, timing, card,
- UnsuspendEffectName,
- UnsuspendActivateCoroutine,
- UnsuspendEffectDescription,
- optional: false,
- isSkippable: true,
- additionalActivateCondition: CanActivateUnsuspend,
- maxCountPerTurn: 1,
- hashValue: UnsuspendHashString,
- whenDigivolving: true,
- whenAttacking: true,
- counter: true);
- bool CanTrashCardSource(CardSource cardSource) => cardSource.IsOption;
- bool PermanentWithTrashableCard(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
- && permanent.DigivolutionOrLinkCards.Any(CanTrashCardSource);
- }
- bool CanActivateUnsuspend(Hashtable hashtable, ActivateClass activateClass) => CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentWithTrashableCard);
- IEnumerator UnsuspendActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- bool executed = false;
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: PermanentWithTrashableCard,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select a Digimon to trash a card from", "Opponent is selecting a card to trash a card from");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanTrashCardSource,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- message: "Select 1 card to trash.",
- maxCount: 1,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Discard,
- root: SelectCardEffect.Root.DigivolutionCards,//This only sets behavior, so currently is safe to use for this combined list. Will ensure pending effects show
- customRootCardList: permanent.DigivolutionOrLinkCards,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetUpCustomMessage("Select a [Three Musketeers] card to place under 1 of your Digimon.", "Opponent is selecting a card to place.");
- yield return StartCoroutine(selectCardEffect.Activate());
- IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
- {
- executed = cardSources.Count > 0;
- yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
- new List<Permanent>() { card.PermanentOfThisCard() },
- activateClass).Unsuspend());
- }
- }
- if (!executed)
- {
- activateClass.RemoveUse();
- }
- }
- #endregion
- #endregion
- #region Option Effects
- #region Ignore Colour Requirement
- if (timing == EffectTiming.None)
- {
- cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
- bool CardCondition(CardSource cardSource)
- {
- return cardSource.HasText("Three Musketeers");
- }
- }
- #endregion
- #region Main
- if (timing == EffectTiming.OptionSkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Delete 1 highest level enemy Digimon. Place 1 [Three Musketeers] card from hand or trash under any of your Digimon.", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- => "[Main] Delete 1 of your opponent's highest level Digimon. Then, you may place 1 [Three Musketeer] trait card from your hand or trash as any of your Digimon's bottom digivolution card.";
- bool CanUseCondition(Hashtable hashtable)
- => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
- bool IsStrongestEnemy(Permanent permanent)
- => CardEffectCommons.IsMaxLevel(permanent, card.Owner.Enemy);
- bool CanSelectCardCondition(CardSource cardSource)
- => cardSource.EqualsTraits("Three Musketeers");
- bool CanSelectPermamentCondition(Permanent permanent)
- => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsStrongestEnemy))
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: IsStrongestEnemy,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- if(CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermamentCondition))
- {
- bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
- bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
- if (canSelectHand || canSelectTrash)
- {
- #region Setup Location Selection
- List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
- if (canSelectHand)
- {
- selectionElements.Add(new(message: $"From hand", value: 1, spriteIndex: 0));
- }
- if (canSelectTrash)
- {
- selectionElements.Add(new(message: $"From trash", value: 2, spriteIndex: 0));
- }
- selectionElements.Add(new(message: $"Do not place a card", value: 3, spriteIndex: 1));
- string selectPlayerMessage = "From which area will you place a card to digivolution cards?";
- string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
- GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
- #endregion
- bool doPlace = GManager.instance.userSelectionManager.SelectedIntValue != 3;
- bool fromHand = GManager.instance.userSelectionManager.SelectedIntValue == 1;
- if (doPlace)
- {
- 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 a [Three Musketeers] card to place under 1 of your Digimon.", "Opponent is selecting a card to place.");
- 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 place.",
- 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 a [Three Musketeers] card to place under 1 of your Digimon.", "Opponent is selecting a card to place.");
- yield return StartCoroutine(selectCardEffect.Activate());
- }
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermamentCondition,
- 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 digimon to place card underneath", "The opponent is selecting 1 digimon to place card underneath");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- if (permanent != null)
- {
- yield return ContinuousController.instance.StartCoroutine(permanent.AddDigivolutionCardsBottom(new List<CardSource>() { cardSource }, activateClass));
- }
- }
- }
- }
- }
- }
- }
- }
- #endregion
- #region Arts Digivolution
- if (timing == EffectTiming.None)
- {
- cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
- }
- #endregion
- #endregion
- return cardEffects;
- }
- }
- }
|