| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // Machinedramon
- namespace DCGO.CardEffects.EX9
- {
- public class EX9_073 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alternative Digivolution Condition
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.EqualsTraits("DM");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
- permanentCondition: PermanentCondition,
- digivolutionCost: 3,
- ignoreDigivolutionRequirement: false,
- card: card,
- condition: null)
- );
- }
- #endregion
- #region Assembly
- if (timing == EffectTiming.None)
- {
- // TODO Implement Assembly
- }
- #endregion
- #region On Play/ When Digivolving/ When Attacking Shared
- bool CanSelectCardConditionShared(CardSource cardSource)
- {
- return cardSource.HasLevel && cardSource.IsLevel5 &&
- (cardSource.EqualsTraits("Cyborg") || cardSource.EqualsTraits("Ver.5"));
- }
- bool CanActivateConditionShared(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardConditionShared) ||
- CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardConditionShared));
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place 1 card in hand or trash as source, to activate its [On Play] effect",
- CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, 1, true, EffectDescription());
- activateClass.SetHashString("AddSource_EX9_073");
- cardEffects.Add(activateClass);
- string EffectDescription() =>
- "[On Play] [Once Per Turn] By placing 1 level 5 [Cyborg] or [Ver.5] trait card from your hand or trash as this Digimon's top digivolution card, active 1 [On Play] effect on the placed card as an effect of this Digimon.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardConditionShared);
- bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardConditionShared);
- 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 choose a card?";
- string notSelectPlayerMessage = "The opponent is choosing from which area to choose 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;
- CardSource selectedCard = null;
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- if (fromHand)
- {
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardConditionShared,
- 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 place on top of digivolution cards.",
- "The opponent is selecting 1 card to place on top of digivolution cards.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Placed Card");
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- }
- else
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardConditionShared,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to place on top 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 top of digivolution cards.",
- "The opponent is selecting 1 card to place on top of digivolution cards.");
- selectCardEffect.SetUpCustomMessage_ShowCard("Placed Card");
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- }
- if (selectedCard)
- {
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
- .AddDigivolutionCardsTop(new List<CardSource>() { selectedCard }, activateClass));
- List<ICardEffect> candidateEffects = selectedCard.EffectList_ForCard(EffectTiming.OnEnterFieldAnyone, card)
- .Clone()
- .Filter(cardEffect =>
- cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect &&
- cardEffect.IsOnPlay);
- if (candidateEffects.Count >= 1)
- {
- ICardEffect selectedEffect = null;
- if (candidateEffects.Count == 1)
- {
- selectedEffect = candidateEffects[0];
- }
- else
- {
- List<SkillInfo> skillInfos = candidateEffects
- .Map(cardEffect => new SkillInfo(cardEffect, null, EffectTiming.None));
- List<CardSource> cardSources = candidateEffects
- .Map(cardEffect => cardEffect.EffectSourceCard);
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: _ => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => false,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: null,
- message: "Select 1 effect to activate.",
- maxCount: 1,
- canEndNotMax: false,
- isShowOpponent: false,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Custom,
- customRootCardList: cardSources,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetNotShowCard();
- selectCardEffect.SetUpSkillInfos(skillInfos);
- selectCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator AfterSelectIndexCoroutine(List<int> selectedIndexes)
- {
- if (selectedIndexes.Count == 1)
- {
- selectedEffect = candidateEffects[selectedIndexes[0]];
- yield return null;
- }
- }
- }
- if (selectedEffect != null &&
- selectedEffect.EffectSourceCard &&
- selectedEffect.EffectSourceCard.PermanentOfThisCard() != null)
- {
- Hashtable effectHashtable = CardEffectCommons.OnPlayCheckHashtableOfCard(card);
- if (selectedEffect.CanUse(effectHashtable))
- {
- yield return ContinuousController.instance.StartCoroutine(
- ((ActivateICardEffect)selectedEffect)
- .Activate_Optional_Effect_Execute(effectHashtable));
- }
- }
- }
- }
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place 1 card in hand or trash as source, to activate its [On Play] effect",
- CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, 1, true,
- EffectDescription());
- activateClass.SetHashString("AddSource_EX9_073");
- cardEffects.Add(activateClass);
- string EffectDescription() =>
- "[When Digivolving] [Once Per Turn] By placing 1 level 5 [Cyborg] or [Ver.5] trait card from your hand or trash as this Digimon's top digivolution card, active 1 [On Play] effect on the placed card as an effect of this Digimon.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardConditionShared);
- bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardConditionShared);
- 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 choose a card?";
- string notSelectPlayerMessage = "The opponent is choosing from which area to choose 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;
- CardSource selectedCard = null;
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- if (fromHand)
- {
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardConditionShared,
- 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 place on top of digivolution cards.",
- "The opponent is selecting 1 card to place on top of digivolution cards.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Placed Card");
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- }
- else
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardConditionShared,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to place on top 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 top of digivolution cards.",
- "The opponent is selecting 1 card to place on top of digivolution cards.");
- selectCardEffect.SetUpCustomMessage_ShowCard("Placed Card");
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- }
- if (selectedCard)
- {
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
- .AddDigivolutionCardsTop(new List<CardSource>() { selectedCard }, activateClass));
- List<ICardEffect> candidateEffects = selectedCard.EffectList_ForCard(EffectTiming.OnEnterFieldAnyone, card)
- .Clone()
- .Filter(cardEffect =>
- cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect &&
- cardEffect.IsOnPlay);
- if (candidateEffects.Count >= 1)
- {
- ICardEffect selectedEffect = null;
- if (candidateEffects.Count == 1)
- {
- selectedEffect = candidateEffects[0];
- }
- else
- {
- List<SkillInfo> skillInfos = candidateEffects
- .Map(cardEffect => new SkillInfo(cardEffect, null, EffectTiming.None));
- List<CardSource> cardSources = candidateEffects
- .Map(cardEffect => cardEffect.EffectSourceCard);
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: _ => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => false,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: null,
- message: "Select 1 effect to activate.",
- maxCount: 1,
- canEndNotMax: false,
- isShowOpponent: false,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Custom,
- customRootCardList: cardSources,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetNotShowCard();
- selectCardEffect.SetUpSkillInfos(skillInfos);
- selectCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator AfterSelectIndexCoroutine(List<int> selectedIndexes)
- {
- if (selectedIndexes.Count == 1)
- {
- selectedEffect = candidateEffects[selectedIndexes[0]];
- yield return null;
- }
- }
- }
- if (selectedEffect != null &&
- selectedEffect.EffectSourceCard &&
- selectedEffect.EffectSourceCard.PermanentOfThisCard() != null)
- {
- Hashtable effectHashtable = CardEffectCommons.OnPlayCheckHashtableOfCard(card);
- if (selectedEffect.CanUse(effectHashtable))
- {
- yield return ContinuousController.instance.StartCoroutine(
- ((ActivateICardEffect)selectedEffect)
- .Activate_Optional_Effect_Execute(effectHashtable));
- }
- }
- }
- }
- }
- }
- #endregion
- #region When Attacking
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place 1 card in hand or trash as source, to activate its [On Play] effect",
- CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, 1, true,
- EffectDescription());
- activateClass.SetHashString("AddSource_EX9_073");
- cardEffects.Add(activateClass);
- string EffectDescription() =>
- "[When Attacking] [Once Per Turn] By placing 1 level 5 [Cyborg] or [Ver.5] trait card from your hand or trash as this Digimon's top digivolution card, active 1 [On Play] effect on the placed card as an effect of this Digimon.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardConditionShared);
- bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardConditionShared);
- 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 choose a card?";
- string notSelectPlayerMessage = "The opponent is choosing from which area to choose 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;
- CardSource selectedCard = null;
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- if (fromHand)
- {
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardConditionShared,
- 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 place on top of digivolution cards.",
- "The opponent is selecting 1 card to place on top of digivolution cards.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Placed Card");
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- }
- else
- {
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardConditionShared,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to place on top 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 top of digivolution cards.",
- "The opponent is selecting 1 card to place on top of digivolution cards.");
- selectCardEffect.SetUpCustomMessage_ShowCard("Placed Card");
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- }
- if (selectedCard)
- {
- yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
- .AddDigivolutionCardsTop(new List<CardSource>() { selectedCard }, activateClass));
- List<ICardEffect> candidateEffects = selectedCard.EffectList_ForCard(EffectTiming.OnEnterFieldAnyone, card)
- .Clone()
- .Filter(cardEffect =>
- cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect &&
- cardEffect.IsOnPlay);
- if (candidateEffects.Count >= 1)
- {
- ICardEffect selectedEffect = null;
- if (candidateEffects.Count == 1)
- {
- selectedEffect = candidateEffects[0];
- }
- else
- {
- List<SkillInfo> skillInfos = candidateEffects
- .Map(cardEffect => new SkillInfo(cardEffect, null, EffectTiming.None));
- List<CardSource> cardSources = candidateEffects
- .Map(cardEffect => cardEffect.EffectSourceCard);
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: _ => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => false,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: null,
- message: "Select 1 effect to activate.",
- maxCount: 1,
- canEndNotMax: false,
- isShowOpponent: false,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Custom,
- customRootCardList: cardSources,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetNotShowCard();
- selectCardEffect.SetUpSkillInfos(skillInfos);
- selectCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator AfterSelectIndexCoroutine(List<int> selectedIndexes)
- {
- if (selectedIndexes.Count == 1)
- {
- selectedEffect = candidateEffects[selectedIndexes[0]];
- yield return null;
- }
- }
- }
- if (selectedEffect != null &&
- selectedEffect.EffectSourceCard &&
- selectedEffect.EffectSourceCard.PermanentOfThisCard() != null)
- {
- Hashtable effectHashtable = CardEffectCommons.OnPlayCheckHashtableOfCard(card);
- if (selectedEffect.CanUse(effectHashtable))
- {
- yield return ContinuousController.instance.StartCoroutine(
- ((ActivateICardEffect)selectedEffect)
- .Activate_Optional_Effect_Execute(effectHashtable));
- }
- }
- }
- }
- }
- }
- #endregion
- #region All Turns
- if (timing == EffectTiming.WhenRemoveField)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(
- "Trash 2 bottom digivolution cards to prevent this Digimon from leaving the battle area", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription() =>
- "[All Turns] When this Digimon would leave the battle area, by trashing its bottom 2 face-down or [Cyborg] trait digivolution cards, it doesn't leave.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card);
- }
- bool CanSelectTrashSourceCardCondition(CardSource cardSource)
- {
- return (cardSource.IsFlipped || cardSource.EqualsTraits("Cyborg")) &&
- !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectTrashSourceCardCondition) >= 2;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- Permanent thisPermanent = card.PermanentOfThisCard();
- List<CardSource> selectedCards = thisPermanent.DigivolutionCards.Filter(CanSelectTrashSourceCardCondition)
- .GetRange(thisPermanent.DigivolutionCards.Count - 2, 2);
- if (selectedCards.Count == 2)
- {
- yield return ContinuousController.instance.StartCoroutine(
- new ITrashDigivolutionCards(thisPermanent, selectedCards, activateClass).TrashDigivolutionCards());
- thisPermanent.willBeRemoveField = false;
- thisPermanent.HideDeleteEffect();
- thisPermanent.HideHandBounceEffect();
- thisPermanent.HideDeckBounceEffect();
- thisPermanent.HideWillRemoveFieldEffect();
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|