| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace DCGO.CardEffects.BT13
- {
- public class BT13_012 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- if (timing == EffectTiming.None)
- {
- bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.ContainsCardName("Agumon") && targetPermanent.TopCard.CardTraits.Contains("Dinosaur") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
- }
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Play 1 Tamer from security", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[When Digivolving] Search your security stack, and you may play 1 red or yellow Tamer card among it without paying the cost. If you did, <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.) Then, shuffle your security stack.";
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- if (cardSource.IsTamer)
- {
- if (cardSource.HasCardColor(CardColor.Red) || cardSource.HasCardColor(CardColor.Yellow))
- {
- if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return 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)
- {
- bool played = false;
- int maxCount = Math.Min(1, card.Owner.SecurityCards.Count(CanSelectCardCondition));
- List<CardSource> selectedCards = new List<CardSource>();
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- message: "Select 1 Tamer to play.",
- 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)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
- {
- if (cardSources.Count >= 1)
- {
- yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
- player: card.Owner,
- refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
- activateClass).ReduceSecurity());
- }
- yield return null;
- }
- if (selectedCards.Count(selectedCard => CardEffectCommons.CanPlayAsNewPermanent(cardSource: selectedCard, payCost: false, cardEffect: activateClass)) >= 1)
- {
- played = true;
- }
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Security, activateETB: true));
- if (played)
- {
- yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
- }
- if (card.Owner.SecurityCards.Count >= 1)
- {
- ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE);
- card.Owner.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.SecurityCards);
- }
- }
- }
- }
- if (timing == EffectTiming.OnTappedAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Delete 1 Digimon with 3000 DP or less", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
- activateClass.SetIsInheritedEffect(true);
- activateClass.SetHashString("Delete_BT13_012");
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Your Turn][Once Per Turn] When one of your red or yellow Tamers becomes suspended, you may delete 1 of your opponent's Digimon with 3000 DP or less.";
- }
- bool PermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
- {
- if (permanent.IsTamer)
- {
- if (permanent.TopCard.CardColors.Contains(CardColor.Red))
- {
- return true;
- }
- if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
- {
- if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
- {
- return true;
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.IsOwnerTurn(card))
- {
- if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- if (CardEffectCommons.IsExistOnBattleArea(card))
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- return true;
- }
- }
- return false;
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
- {
- 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;
- }
- }
- }
|