| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace DCGO.CardEffects.BT16
- {
- public class BT16_024 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- var cardEffects = new List<ICardEffect>();
- #region Alternate Digivolution Requirement
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.CardNames.Contains("Angemon");
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
- permanentCondition: PermanentCondition,
- digivolutionCost: 3,
- ignoreDigivolutionRequirement: false,
- card: card,
- condition: null)
- );
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("This Digimon digivolves into a Digimon card from security", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- activateClass.SetHashString("MagnaAngemon_BT16_024_OnPlay_WhenDigivolving");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return
- "[On Play] If it's your turn, search your security stack. This Digimon may digivolve into a Digimon card with the [Angel] " +
- "or [Three Great Angels] trait among them with the digivolution cost reduced by 2. Then, shuffle your security stack. If this effect digivolved, " +
- "you may place 1 Digimon card with the [Angel], [Archangel] or [Three Great Angels] trait from your hand at the bottom of your security stack.";
- }
- bool CanSelectCardDigivolutionCondition(CardSource cardSource)
- {
- if (cardSource.CardTraits.Contains("Angel") || cardSource.CardTraits.Contains("Three Great Angels") || cardSource.CardTraits.Contains("ThreeGreatAngels"))
- {
- if (cardSource.IsDigimon)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- bool CanSelectCardRecoverCondition(CardSource cardSource)
- {
- if (cardSource.IsDigimon)
- {
- if (cardSource.HasAngelTraitRestrictive)
- {
- return true;
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.Owner.SecurityCards.Count >= 1)
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (card.Owner.SecurityCards.Count >= 1)
- {
- int maxCount = Math.Min(1, card.Owner.SecurityCards.Count);
- CardSource selectedCard = null;
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardDigivolutionCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to digivolve.",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Security,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE);
- card.Owner.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.SecurityCards);
- if (selectedCard != null)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- GManager.instance.turnStateMachine.gameContext.IsSecurityLooking = true;
- if (selectedCard.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame,
- PayCost: false, activateClass, root: SelectCardEffect.Root.Security))
- {
- PlayCardClass playCardClass = new PlayCardClass(
- cardSources: new List<CardSource>() { selectedCard },
- hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
- payCost: true,
- targetPermanent: card.PermanentOfThisCard(),
- isTapped: false,
- root: SelectCardEffect.Root.Security,
- activateETB: true);
- playCardClass.SetReducedCost(2);
- yield return ContinuousController.instance.StartCoroutine(playCardClass.PlayCard());
- }
- GManager.instance.turnStateMachine.gameContext.IsSecurityLooking = false;
- if (CardEffectCommons.IsDigivolvedByTheEffect(card.PermanentOfThisCard(), selectedCard,
- activateClass))
- {
- if (card.Owner.CanAddSecurity(activateClass))
- {
- if (card.Owner.HandCards.Count(CanSelectCardRecoverCondition) >= 1)
- {
- List<CardSource> selectedCards = new List<CardSource>();
- maxCount = 1;
- SelectHandEffect selectHandEffect =
- GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardRecoverCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine1,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage(
- "Select 1 card to place at the bottom of security.",
- "The opponent is selecting 1 card to place at the bottom of security.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Security Bottom Card");
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine1(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- foreach (CardSource cardSource in selectedCards)
- {
- yield return ContinuousController.instance.StartCoroutine(
- CardObjectController.AddSecurityCard(cardSource, toTop: false));
- }
- }
- }
- }
- }
- }
- }
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("This Digimon digivolves into a Digimon card from security", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- activateClass.SetHashString("MagnaAngemon_BT16_024_OnPlay_WhenDigivolving");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return
- "[When Digivolving] If it's your turn, search your security stack. This Digimon may digivolve into a Digimon card with the [Angel] " +
- "or [Three Great Angels] trait among them with the digivolution cost reduced by 2. Then, shuffle your security stack. If this effect digivolved, " +
- "you may place 1 Digimon card with the [Angel], [Archangel] or [Three Great Angels] trait from your hand at the bottom of your security stack.";
- }
- bool CanSelectCardDigivolutionCondition(CardSource cardSource)
- {
- if (cardSource.CardTraits.Contains("Angel") || cardSource.CardTraits.Contains("Three Great Angels") || cardSource.CardTraits.Contains("ThreeGreatAngels"))
- {
- if (cardSource.IsDigimon)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- bool CanSelectCardRecoverCondition(CardSource cardSource)
- {
- if (cardSource.IsDigimon)
- {
- if (cardSource.HasAngelTraitRestrictive)
- {
- return true;
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (card.Owner.SecurityCards.Count >= 1)
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (card.Owner.SecurityCards.Count >= 1)
- {
- int maxCount = Math.Min(1, card.Owner.SecurityCards.Count);
- CardSource selectedCard = null;
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardDigivolutionCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to digivolve.",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.Custom,
- root: SelectCardEffect.Root.Security,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE);
- card.Owner.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.SecurityCards);
- if (selectedCard != null)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- GManager.instance.turnStateMachine.gameContext.IsSecurityLooking = true;
- if (selectedCard.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame,
- PayCost: false, activateClass, root: SelectCardEffect.Root.Security))
- {
- PlayCardClass playCardClass = new PlayCardClass(
- cardSources: new List<CardSource>() { selectedCard },
- hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
- payCost: true,
- targetPermanent: card.PermanentOfThisCard(),
- isTapped: false,
- root: SelectCardEffect.Root.Security,
- activateETB: true);
- playCardClass.SetReducedCost(2);
- yield return ContinuousController.instance.StartCoroutine(playCardClass.PlayCard());
- }
- GManager.instance.turnStateMachine.gameContext.IsSecurityLooking = false;
- if (CardEffectCommons.IsDigivolvedByTheEffect(card.PermanentOfThisCard(), selectedCard,
- activateClass))
- {
- if (card.Owner.CanAddSecurity(activateClass))
- {
- if (card.Owner.HandCards.Count(CanSelectCardRecoverCondition) >= 1)
- {
- List<CardSource> selectedCards = new List<CardSource>();
- maxCount = 1;
- SelectHandEffect selectHandEffect =
- GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardRecoverCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine1,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage(
- "Select 1 card to place at the bottom of security.",
- "The opponent is selecting 1 card to place at the bottom of security.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Security Bottom Card");
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine1(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- foreach (CardSource cardSource in selectedCards)
- {
- yield return ContinuousController.instance.StartCoroutine(
- CardObjectController.AddSecurityCard(cardSource, toTop: false));
- }
- }
- }
- }
- }
- }
- }
- }
- }
- #endregion
- #region Inherited Effect
- if (timing == EffectTiming.None)
- {
- bool CanUseCondition()
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOpponentTurn(card))
- {
- return true;
- }
- }
- return false;
- }
- bool PermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- return permanent.TopCard.HasAngelTraitRestrictive;
- }
- return false;
- }
- cardEffects.Add(CardEffectFactory.BlockerStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: true, card: card, condition: CanUseCondition));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|