| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // Betamon
- namespace DCGO.CardEffects.BT23
- {
- public class BT23_017 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alternative Digivolution Condition
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.HasCSTraits
- && targetPermanent.TopCard.HasLevel
- && targetPermanent.TopCard.IsLevel2;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
- permanentCondition: PermanentCondition,
- digivolutionCost: 0,
- ignoreDigivolutionRequirement: false,
- card: card,
- condition: null)
- );
- }
- #endregion
- #region On Play
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Trash 1 card, return 1 non digi-egg [CS] card from trash to hand", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[On Play] By trash 1 card in your hand, you may return 1 non-Digi-Egg card with the [CS] trait from your trash to the hand.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card);
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return !cardSource.IsDigiEgg
- && cardSource.HasCSTraits;
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, _ => true))
- {
- bool trashed = false;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: (cardSource) => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- mode: SelectHandEffect.Mode.Discard,
- cardEffect: activateClass);
- IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
- {
- if (cardSources.Any()) trashed = true;
- yield return null;
- }
- selectHandEffect.SetUpCustomMessage("Select 1 card to trash", "Your opponent is selecting 1 card to trash");
- selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- if (trashed && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
- {
- int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, 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 [CS] card to add to hand.",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.AddHand,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- selectCardEffect.SetUpCustomMessage("Select 1 [CS] card to add to hand.", "The opponent is selecting 1 card to add to hand.");
- selectCardEffect.SetUpCustomMessage_ShowCard("Selected Card");
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- }
- }
- }
- }
- #endregion
- #region ESS - When Attacking
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Play 1 5 cost or less [Hudie] digimon from hand", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("BT23_017_WA");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Attacking] [Once Per Turn] You may play 1 play cost 5 or lower Digimon card with the [Hudie] trait from your hand without paying the cost. The Digimon this effect played can't digivolve and is deleted at the end of your opponent's turn.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card);
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.IsDigiEgg
- && cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 5
- && cardSource.EqualsTraits("Hudie")
- && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
- {
- CardSource selectedCard = null;
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCard = cardSource;
- yield return null;
- }
- selectHandEffect.SetUpCustomMessage("Select 1 [Hudie] digimon to play", "Your opponent is selecting 1 card to play");
- selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
- yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
- if (selectedCard != null)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
- new List<CardSource>() { selectedCard },
- activateClass: activateClass,
- payCost: false,
- isTapped: false,
- root: SelectCardEffect.Root.Hand,
- activateETB: true));
- Permanent playedDigimon = selectedCard.PermanentOfThisCard();
- #region Can't Digivolve/Delete EoOT
- if (playedDigimon != null)
- {
- #region Can't Digivolve
- CanNotDigivolveClass canNotEvolveClass = new CanNotDigivolveClass();
- canNotEvolveClass.SetUpICardEffect("Can't digivolve", CanUseCantEvoCondition, card);
- canNotEvolveClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
- playedDigimon.PermanentEffects.Add((_timing) => canNotEvolveClass);
- bool CanUseCantEvoCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon);
- }
- bool PermanentCondition(Permanent permanent)
- {
- return permanent == playedDigimon;
- }
- bool CardCondition(CardSource cardSource)
- {
- return true;
- }
- #endregion
- #region Delete EoOT
- ActivateClass activateClass1 = new ActivateClass();
- activateClass1.SetUpICardEffect("Delete the Digimon", CanUseEndofOpponentTurnCondition, card);
- activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
- card.Owner.UntilOpponentTurnEndEffects.Add(GetCardEffect);
- bool CanUseEndofOpponentTurnCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
- {
- if (CardEffectCommons.IsOpponentTurn(card))
- {
- return true;
- }
- }
- return false;
- }
- bool CanActivateCondition1(Hashtable hashtable)
- {
- if (CardEffectCommons.IsPermanentExistsOnBattleArea(playedDigimon))
- {
- if (playedDigimon.CanBeDestroyedBySkill(activateClass1))
- {
- if (!playedDigimon.TopCard.CanNotBeAffected(activateClass1))
- {
- return true;
- }
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
- {
- yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { playedDigimon }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
- }
- ICardEffect GetCardEffect(EffectTiming _timing)
- {
- if (_timing == EffectTiming.OnEndTurn)
- {
- return activateClass1;
- }
- return null;
- }
- #endregion
- }
- #endregion
- }
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|