| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // Trial of the Four Great Dragons
- namespace DCGO.CardEffects.EX3
- {
- public class EX3_069 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Main
- if (timing == EffectTiming.OptionSkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[Main] <Draw 1>. Then, place this card in your battle area.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(
- card: card,
- cardEffect: activateClass));
- }
- }
- #endregion
- #region Delay
- if (timing == EffectTiming.OnDeclaration)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Play 1 Digimon from hand", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return "[Main] <Delay> (By trashing this card in your battle area, activate the effect below. You can't activate this effect the turn this card enters play.) - Play 1 Digimon card with [Four Great Dragons] in its traits from your hand without paying the cost. The Digimon played by this effect can't digivolve to level 7, and at the end of your opponent's turn, delete that Digimon.";
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.EqualsTraits("Four Great Dragons")
- && cardSource.IsDigimon
- && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanDeclareOptionDelayEffect(card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- bool deleted = false;
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
- IEnumerator SuccessProcess()
- {
- deleted = true;
- yield return null;
- }
- if (deleted)
- {
- if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
- {
- Permanent selectedPermanent = null;
- List<CardSource> selectedCards = new List<CardSource>();
- int maxCount = 1;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardCondition,
- 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 play.", "The opponent is selecting 1 card to play.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
- cardSources: selectedCards,
- activateClass: activateClass,
- payCost: false,
- isTapped: false,
- root: SelectCardEffect.Root.Hand,
- activateETB: true));
- foreach (CardSource cardSource in selectedCards)
- {
- selectedPermanent = cardSource.PermanentOfThisCard();
- if (selectedPermanent != null)
- {
- CanNotDigivolveClass canNotPutFieldClass = new CanNotDigivolveClass();
- canNotPutFieldClass.SetUpICardEffect("Can't Digivolve to level 7", CanUseCondition1, card);
- canNotPutFieldClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
- selectedPermanent.PermanentEffects.Add((_timing) => canNotPutFieldClass);
- bool CanUseCondition1(Hashtable hashtable)
- {
- return true;
- }
- bool PermanentCondition(Permanent permanent)
- {
- return permanent == selectedPermanent;
- }
- bool CardCondition(CardSource cardSource)
- {
- return cardSource.HasLevel
- && cardSource.Level == 7;
- }
- }
- if (selectedPermanent != null)
- {
- ActivateClass activateClass1 = new ActivateClass();
- activateClass1.SetUpICardEffect("Delete the Digimon", CanUseCondition1, card);
- activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, 1, false, "");
- activateClass1.SetHashString("EX3_069_EoOT");
- card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect);
- bool CanUseCondition1(Hashtable hashtable)
- {
- return CardEffectCommons.IsOpponentTurn(card);
- }
- bool CanActivateCondition1(Hashtable hashtable)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent)
- && selectedPermanent.CanBeDestroyedBySkill(activateClass1)
- && !selectedPermanent.TopCard.CanNotBeAffected(activateClass1);
- }
- IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
- {
- yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { selectedPermanent }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
- }
- ICardEffect GetCardEffect(EffectTiming _timing)
- {
- if (_timing == EffectTiming.OnEndTurn)
- {
- return activateClass1;
- }
- return null;
- }
- }
- }
- }
- }
- }
- }
- #endregion
- #region Security
- if (timing == EffectTiming.SecuritySkill)
- {
- cardEffects.Add(CardEffectFactory.PlaceSelfDelayOptionSecurityEffect(card));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|