| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438 |
- using System.Collections;
- using System.Collections.Generic;
- namespace DCGO.CardEffects.BT20
- {
- public class BT20_018 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Piercing
- if (timing == EffectTiming.OnDetermineDoSecurityCheck)
- {
- cardEffects.Add(CardEffectFactory.PierceSelfEffect(
- isInheritedEffect: false,
- card: card,
- condition: null));
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("<De-Digivolve 2> 1 of your opponent's Digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[On Play] <De-Digivolve 2> 1 of your opponent's Digimon. Then, if during an attack, 1 of your Digimon in the breeding area may digivolve into a level 6 or lower [Chronicle] trait Digimon card in the hand or trash without paying the cost.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- bool CanSelectDeDigiPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- bool CanSelectDigivolveCardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 6 &&
- cardSource.EqualsTraits("Chronicle") &&
- cardSource.CanPlayCardTargetFrame(
- card.Owner.GetBreedingAreaPermanents()[0].PermanentFrame,
- false, activateClass, isBreedingArea: true);
- }
- bool IsAttackingCondition()
- {
- return GManager.instance.attackProcess.IsAttacking &&
- card.Owner.GetBreedingAreaPermanents().Count > 0 &&
- (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectDigivolveCardCondition) ||
- CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectDigivolveCardCondition));
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeDigiPermanentCondition) ||
- IsAttackingCondition());
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeDigiPermanentCondition))
- {
- Permanent selectedPermanent = null;
- SelectPermanentEffect selectPermanentEffect =
- GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectDeDigiPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.",
- "The opponent is selecting 1 Digimon to De-Digivolve.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null)
- {
- yield return ContinuousController.instance.StartCoroutine(
- new IDegeneration(selectedPermanent, 2, activateClass).Degeneration());
- }
- }
- if (IsAttackingCondition())
- {
- List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
- {
- new(message: "Digivolve in the breeding area", value: true, spriteIndex: 0),
- new(message: "Do not digivolve", value: false, spriteIndex: 1),
- };
- string selectPlayerMessage = "Digivolve in the breeding area?";
- string notSelectPlayerMessage = "The opponent is choosing whether to digivolve in the breeding area or not.";
- GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
- selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
- notSelectPlayerMessage: notSelectPlayerMessage);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
- .WaitForEndSelect());
- if (GManager.instance.userSelectionManager.SelectedBoolValue)
- {
- bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectDigivolveCardCondition);
- bool canSelectTrash =
- CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectDigivolveCardCondition);
- if (canSelectHand || canSelectTrash)
- {
- if (canSelectHand && canSelectTrash)
- {
- selectionElements = new List<SelectionElement<bool>>()
- {
- new(message: "From hand", value: true, spriteIndex: 0),
- new(message: "From trash", value: false, spriteIndex: 1),
- };
- selectPlayerMessage = "From which area do you play a card?";
- 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());
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- targetPermanent: card.Owner.GetBreedingAreaPermanents()[0],
- cardCondition: CanSelectDigivolveCardCondition,
- payCost: false,
- reduceCostTuple: null,
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: GManager.instance.userSelectionManager.SelectedBoolValue,
- activateClass: activateClass,
- successProcess: null));
- }
- }
- }
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("<De-Digivolve 2> 1 of your opponent's Digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[When Digivolving] <De-Digivolve 2> 1 of your opponent's Digimon. Then, if during an attack, 1 of your Digimon in the breeding area may digivolve into a level 6 or lower [Chronicle] trait Digimon card in the hand or trash without paying the cost.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- bool CanSelectDeDigiPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- bool CanSelectDigivolveCardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 6 &&
- cardSource.EqualsTraits("Chronicle") &&
- cardSource.CanPlayCardTargetFrame(
- card.Owner.GetBreedingAreaPermanents()[0].PermanentFrame,
- false, activateClass, isBreedingArea: true);
- }
- bool IsAttackingCondition()
- {
- return GManager.instance.attackProcess.IsAttacking &&
- card.Owner.GetBreedingAreaPermanents().Count > 0 &&
- (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectDigivolveCardCondition) ||
- CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectDigivolveCardCondition));
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeDigiPermanentCondition) ||
- IsAttackingCondition());
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeDigiPermanentCondition))
- {
- Permanent selectedPermanent = null;
- SelectPermanentEffect selectPermanentEffect =
- GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectDeDigiPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.",
- "The opponent is selecting 1 Digimon to De-Digivolve.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null)
- {
- yield return ContinuousController.instance.StartCoroutine(
- new IDegeneration(selectedPermanent, 2, activateClass).Degeneration());
- }
- }
- if (IsAttackingCondition())
- {
- List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
- {
- new(message: "Digivolve in the breeding area", value: true, spriteIndex: 0),
- new(message: "Do not digivolve", value: false, spriteIndex: 1),
- };
- string selectPlayerMessage = "Digivolve in the breeding area?";
- string notSelectPlayerMessage = "The opponent is choosing whether to digivolve in the breeding area or not.";
- GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
- selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
- notSelectPlayerMessage: notSelectPlayerMessage);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
- .WaitForEndSelect());
- if (GManager.instance.userSelectionManager.SelectedBoolValue)
- {
- bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectDigivolveCardCondition);
- bool canSelectTrash =
- CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectDigivolveCardCondition);
- if (canSelectHand || canSelectTrash)
- {
- if (canSelectHand && canSelectTrash)
- {
- selectionElements = new List<SelectionElement<bool>>()
- {
- new(message: "From hand", value: true, spriteIndex: 0),
- new(message: "From trash", value: false, spriteIndex: 1),
- };
- selectPlayerMessage = "From which area do you play a card?";
- 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());
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- targetPermanent: card.Owner.GetBreedingAreaPermanents()[0],
- cardCondition: CanSelectDigivolveCardCondition,
- payCost: false,
- reduceCostTuple: null,
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: GManager.instance.userSelectionManager.SelectedBoolValue,
- activateClass: activateClass,
- successProcess: null));
- }
- }
- }
- }
- }
- #endregion
- #region All Turns
- if (timing == EffectTiming.OnLoseSecurity)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Delete 1 of your opponent's Digimon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetHashString("RemovedSec_BT20_018");
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[All Turns] (Once Per Turn) When security stacks are removed from, delete 1 of your opponent's Digimon with the lowest DP.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, _ => true);
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if(CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
-
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- 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());
- }
- }
- }
- #endregion
- #region When Attacking - ESS
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Trash your opponent's top security card", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("WhenAttacking_BT20_018");
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[When Attacking] (Once Per Turn) If this Digimon is [Alphamon: Ouryuken], trash your opponent's top security card.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- card.PermanentOfThisCard().TopCard.EqualsCardName("Alphamon: Ouryuken") &&
- card.Owner.Enemy.SecurityCards.Count > 0;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
- player: card.Owner.Enemy,
- destroySecurityCount: 1,
- cardEffect: activateClass,
- fromTop: true).DestroySecurity());
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|