| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Linq;
- using Photon;
- using System;
- using Photon.Pun;
- namespace DCGO.CardEffects
- {
- public class BT20_074 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
-
- #region DNA Digivolve
- if (timing == EffectTiming.None)
- {
- AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
- addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
- addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
- addJogressConditionClass.SetNotShowUI(true);
- cardEffects.Add(addJogressConditionClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return true;
- }
- JogressCondition GetJogress(CardSource cardSource)
- {
- if (cardSource == card)
- {
- bool PermanentCondition1(Permanent permanent)
- {
- if (permanent != null)
- {
- if (permanent.TopCard != null)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- if (permanent.TopCard.CardColors.Contains(CardColor.Purple))
- {
- if (permanent.Levels_ForJogress(card).Contains(4))
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- bool PermanentCondition2(Permanent permanent)
- {
- if (permanent != null)
- {
- if (permanent.TopCard != null)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- if (permanent.TopCard.CardColors.Contains(CardColor.Red))
- {
- if (permanent.Levels_ForJogress(card).Contains(4))
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- JogressConditionElement[] elements = new JogressConditionElement[]
- {
- new JogressConditionElement(PermanentCondition1, "a level 4 purple Digimon"),
- new JogressConditionElement(PermanentCondition2, "a level 4 red Digimon"),
- };
- JogressCondition jogressCondition = new JogressCondition(elements, 0);
- return jogressCondition;
- }
- return null;
- }
- }
-
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Return a card, DNA Digivolve into Imperialdramon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[On Play] You may return 1 Digimon card with [Imperialdramon] in its name or the [Free] trait from your trash to the hand.";
- }
- bool CanSelectCardCondition(CardSource cardSource){
- if (cardSource.EqualsTraits("Free") || cardSource.ContainsCardName("Imperialdramon")){
- return true;
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable,card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
- {
- int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to add to your hand.",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.AddHand,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- }
- }
- }
- #endregion
- #region When Digivolving
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Return a card, DNA Digivolve into Imperialdramon", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Digivolving] You may return 1 Digimon card with [Imperialdramon] in its name or the [Free] trait from your trash to the hand.";
- }
- bool CanSelectCardCondition(CardSource cardSource){
- if (cardSource.EqualsTraits("Free") || cardSource.ContainsCardName("Imperialdramon")){
- return true;
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnPlay(hashtable,card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
- {
- int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to add to your hand.",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.AddHand,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- }
- }
- }
- #endregion
-
- #region All Turns
- if(timing == EffectTiming.WhenReturntoLibraryAnyone || timing == EffectTiming.WhenReturntoHandAnyone ){
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("If returned, DNA Digivolve", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine, -1, true, EffectDiscription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("Dna Digivolve into Imperialdramon");
- cardEffects.Add(activateClass);
- string EffectDiscription(){
- return "[All Turns] When any of your [Dinobeemon]/[Paildramon] would be returned to hands or decks, 2 of your Digimon may DNA digivolve into [Imperialdramon: Dragon Mode] in the hand.";
- }
- bool isPaildramonOrDinoBeemon(Permanent permanent){
-
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- if(permanent.TopCard.EqualsCardName("Dinobeemon") || permanent.TopCard.EqualsCardName("Paildramon"))
- {
- return true;
- }
- }
- return false;
- }
-
-
- bool CanSelectDNACardCondition(CardSource cardSource)
- {
- if (cardSource.IsDigimon)
- {
- if (cardSource.CanPlayJogress(true))
- {
- if (cardSource.EqualsCardName("Imperialdramon: Dragon Mode"))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
- }
- bool CanActivateCondition1(Hashtable hashtable)
- {
- if(CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, isPaildramonOrDinoBeemon)){
- if (CardEffectCommons.MatchConditionPermanentCount(isPaildramonOrDinoBeemon)>=2){
- return true;
- }
- return false;
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
-
- List<CardSource> selectedCards = new List<CardSource>();
- int maxCount = 1;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectDNACardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage("Select 1 card to DNA digivolve.", "The opponent is selecting 1 card to DNA digivolve.");
- selectHandEffect.SetNotShowCard();
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- if (selectedCards.Count >= 1)
- {
- foreach (CardSource selectedCard in selectedCards)
- {
- if (selectedCard.CanPlayJogress(true))
- {
- _jogressEvoRootsFrameIDs = new int[0];
- yield return GManager.instance.photonWaitController.StartWait("Dinobeemon_BT20_074");
- if (card.Owner.isYou || GManager.instance.IsAI)
- {
- GManager.instance.selectJogressEffect.SetUp_SelectDigivolutionRoots
- (card: selectedCard,
- isLocal: true,
- isPayCost: true,
- canNoSelect: true,
- endSelectCoroutine_SelectDigivolutionRoots: EndSelectCoroutine_SelectDigivolutionRoots,
- noSelectCoroutine: null);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.selectJogressEffect.SelectDigivolutionRoots());
- IEnumerator EndSelectCoroutine_SelectDigivolutionRoots(List<Permanent> permanents)
- {
- if (permanents.Count == 2)
- {
- _jogressEvoRootsFrameIDs = permanents.Distinct().ToArray().Map(permanent => permanent.PermanentFrame.FrameID);
- }
- yield return null;
- }
- photonView.RPC("SetJogressEvoRootsFrameIDs", RpcTarget.All, _jogressEvoRootsFrameIDs);
- }
- else
- {
- GManager.instance.commandText.OpenCommandText("The opponent is choosing a card to DNA digivolve.");
- }
- yield return new WaitWhile(() => !_endSelect);
- _endSelect = false;
- GManager.instance.commandText.CloseCommandText();
- yield return new WaitWhile(() => GManager.instance.commandText.gameObject.activeSelf);
- if (_jogressEvoRootsFrameIDs.Length == 2)
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { selectedCard }, "Played Card", true, true));
- PlayCardClass playCard = new PlayCardClass(
- cardSources: new List<CardSource>() { selectedCard },
- hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
- payCost: true,
- targetPermanent: null,
- isTapped: false,
- root: SelectCardEffect.Root.Hand,
- activateETB: true);
- playCard.SetJogress(_jogressEvoRootsFrameIDs);
- yield return ContinuousController.instance.StartCoroutine(playCard.PlayCard());
- }
- }
- }
- }
- }
-
-
-
-
- }
- #endregion
- #region Inherited Effect
- if (timing == EffectTiming.None)
- {
- DisableEffectClass invalidationClass = new DisableEffectClass();
- invalidationClass.SetUpICardEffect("Ignore Security Effect", CanUseCondition, card);
- invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
- invalidationClass.SetIsInheritedEffect(true);
- cardEffects.Add(invalidationClass);
- bool CanUseCondition(Hashtable hashtable)
- {
- return true;
- }
- bool InvalidateCondition(ICardEffect cardEffect)
- {
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card) && cardEffect.EffectSourceCard != null && cardEffect.EffectSourceCard.IsOption && cardEffect.IsSecurityEffect && GManager.instance.attackProcess.AttackingPermanent == card.PermanentOfThisCard())
- {
- return true;
- }
- return false;
- }
- }
- #endregion
- return cardEffects;
- }
- private bool _endSelect = false;
- private int[] _jogressEvoRootsFrameIDs = new int[0];
- [PunRPC]
- public void SetJogressEvoRootsFrameIDs(int[] JogressEvoRootsFrameIDs)
- {
- this._jogressEvoRootsFrameIDs = JogressEvoRootsFrameIDs;
- _endSelect = true;
- }
- }
- }
|