| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Linq;
- using Photon;
- using System;
- using Photon.Pun;
- namespace DCGO.CardEffects.BT10
- {
- public class BT10_080 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- if (timing == EffectTiming.OnDiscardHand)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Your Digimon can digivolve to trash cards", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "When one of your effects trashes this card in your hand, if it's your turn, 1 of your Digimon may digivolve into 1 purple Digimon card with [Undead] or [Dark Animal] in its traits from your trash for its digivolution cost.";
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- foreach (CardSource cardSource in card.Owner.TrashCards)
- {
- if (CanSelectCardCondition(cardSource))
- {
- if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, true, activateClass))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- if (cardSource.IsDigimon)
- {
- if (cardSource.HasCardColor(CardColor.Purple))
- {
- if (cardSource.CardTraits.Contains("Undead"))
- {
- return true;
- }
- if (cardSource.CardTraits.Contains("Dark Animal"))
- {
- return true;
- }
- if (cardSource.CardTraits.Contains("DarkAnimal"))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- bool SkillCondition(ICardEffect cardEffect)
- {
- if (cardEffect != null)
- {
- if (cardEffect.EffectSourceCard != null)
- {
- if (cardEffect.EffectSourceCard.Owner == card.Owner)
- {
- return true;
- }
- }
- }
- return false;
- }
- if (CardEffectCommons.CanTriggerOnTrashSelfHand(hashtable, SkillCondition, card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- return true;
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnTrash(card))
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- Permanent selectedPermanent = null;
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve.", "The opponent is selecting 1 Digimon to 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(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- targetPermanent: selectedPermanent,
- cardCondition: CanSelectCardCondition,
- payCost: true,
- reduceCostTuple: null,
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: false,
- activateClass: activateClass,
- successProcess: null));
- }
- }
- }
- }
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("This Digimon gets effects", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Digivolving] If digivolving from the trash, this Digimon gains \"[On Deletion] Delete 1 of your opponent's Digimon.\" until the end of your opponent's turn.";
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
- }
- bool RootCondition(SelectCardEffect.Root root)
- {
- return root == SelectCardEffect.Root.Trash;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card, RootCondition);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- return true;
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- Permanent selectedPermanent = card.PermanentOfThisCard();
- if (selectedPermanent != null)
- {
- ActivateClass activateClass1 = new ActivateClass();
- activateClass1.SetUpICardEffect("Delete 1 Digimon", CanUseCondition1, selectedPermanent.TopCard);
- activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
- activateClass1.SetEffectSourcePermanent(selectedPermanent);
- CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
- string EffectDiscription1()
- {
- return "[On Deletion] Delete 1 of your opponent's Digimon.";
- }
- bool CanUseCondition1(Hashtable hashtable1)
- {
- return CardEffectCommons.CanTriggerOnDeletion(hashtable1, card, activateClass1);
- }
- bool CanActivateCondition1(Hashtable hashtable1)
- {
- if (CardEffectCommons.CanActivateOnDeletion(card, activateClass1))
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
- {
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- }
- }
- }
- }
- }
- return cardEffects;
- }
- }
- }
|