| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- 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_096 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- if (timing == EffectTiming.OptionSkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Main] Choose 1 of your level 4 or higher Digimon with [Shoutmon] in its name. Delete 1 of your opponent's Digimon with DP less than or equal to the chosen Digimon.";
- }
- bool CanSelectPermanentCondition(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
- {
- if (permanent.TopCard.ContainsCardName("Shoutmon"))
- {
- if (permanent.Level >= 4)
- {
- if (permanent.TopCard.HasLevel)
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
- }
- 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: false,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 level 4 or higher Digimon with [Shoutmon] in its name.", "The opponent is selecting 1 level 4 or higher Digimon with [Shoutmon] in its name.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null)
- {
- int maxDP = selectedPermanent.DP;
- bool CanSelectPermanentCondition1(Permanent permanent)
- {
- if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
- {
- if (permanent.DP <= maxDP)
- {
- return true;
- }
- }
- return false;
- }
- if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
- {
- maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: CanSelectPermanentCondition1,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: CanEndSelectCondition1,
- maxCount: maxCount,
- canNoSelect: false,
- canEndNotMax: false,
- selectPermanentCoroutine: null,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Destroy,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- bool CanEndSelectCondition1(List<Permanent> permanents)
- {
- if (permanents.Count <= 0)
- {
- return false;
- }
- return true;
- }
- }
- }
- }
- }
- }
- if (timing == EffectTiming.SecuritySkill)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect($"Reveal the top 3 cards of deck", CanUseCondition, card);
- activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
- activateClass.SetIsSecurityEffect(true);
- cardEffects.Add(activateClass);
- string EffectDiscription()
- {
- return "[Security] Reveal the top 3 cards of your deck. You may add 1 Digimon card with [Xros Heart] in its traits among them to your hand and play 1 [Taiki Kudo] among them without paying its memory cost. Place the rest at the bottom of your deck in any order.";
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- if (cardSource.IsDigimon)
- {
- if (cardSource.CardTraits.Contains("Xros Heart"))
- {
- return true;
- }
- if (cardSource.CardTraits.Contains("XrosHeart"))
- {
- return true;
- }
- }
- return false;
- }
- bool CanSelectCardCondition1(CardSource cardSource)
- {
- if (cardSource.CardNames.Contains("Taiki Kudo") || cardSource.CardNames.Contains("TaikiKudo"))
- {
- if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
- {
- return true;
- }
- }
- return false;
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
- }
- IEnumerator ActivateCoroutine(Hashtable _hashtable)
- {
- List<CardSource> selectedCards = new List<CardSource>();
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndSelect(
- revealCount: 3,
- selectCardConditions:
- new SelectCardConditionClass[]
- {
- new SelectCardConditionClass(
- canTargetCondition:CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList:null,
- canEndSelectCondition:null,
- canNoSelect:false,
- selectCardCoroutine: null,
- message: "Select 1 Digimon card with [Xros Heart] in its traits.",
- maxCount: 1,
- canEndNotMax:false,
- mode: SelectCardEffect.Mode.AddHand
- ),
- new SelectCardConditionClass(
- canTargetCondition:CanSelectCardCondition1,
- canTargetCondition_ByPreSelecetedList:null,
- canEndSelectCondition:null,
- canNoSelect:true,
- selectCardCoroutine: SelectCardCoroutine,
- message: "Select 1 [Taiki Kudo].",
- maxCount: 1,
- canEndNotMax:false,
- mode: SelectCardEffect.Mode.Custom
- ),
- },
- remainingCardsPlace: RemainingCardsPlace.DeckBottom,
- activateClass: activateClass,
- canNoAction: true
- ));
- 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.Library,
- activateETB: true));
- }
- }
- return cardEffects;
- }
- }
- }
|