| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- using System.Collections;
- using System.Collections.Generic;
- namespace DCGO.CardEffects.BT19
- {
- public class BT19_001 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region When Attacking
- if (timing == EffectTiming.OnAllyAttack)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Place 1 [Xros Heart]/[Blue Flare] card under 1 of your Tamers to <Draw 1>", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
- activateClass.SetIsInheritedEffect(true);
- cardEffects.Add(activateClass);
- string EffectDescription()
- {
- return
- "[When Attacking] (Once Per Turn) By placing 1 Digimon card with the [Xros Heart]/[Blue Flare] trait from your hand under any of your Tamers.";
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
- }
-
- bool IsOwnTamerCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
- permanent.IsTamer;
- }
- bool HasTraitCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon && (cardSource.EqualsTraits("Xros Heart") || cardSource.EqualsTraits("Blue Flare"));
- }
-
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- CardEffectCommons.HasMatchConditionOwnersHand(card, HasTraitCondition) &&
- CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwnTamerCondition);
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- List<CardSource> selectedCards = new List<CardSource>();
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: HasTraitCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: SelectCardCoroutine,
- afterSelectCardCoroutine: null,
- mode: SelectHandEffect.Mode.Custom,
- cardEffect: activateClass);
- selectHandEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
- "The opponent is selecting 1 card to play.");
- selectHandEffect.SetUpCustomMessage_ShowCard("Placed card");
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator SelectCardCoroutine(CardSource cardSource)
- {
- selectedCards.Add(cardSource);
- yield return null;
- }
- if (selectedCards.Count >= 1)
- {
- Permanent selectedPermanent = null;
- SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
- selectPermanentEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: IsOwnTamerCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- selectPermanentCoroutine: SelectPermanentCoroutine,
- afterSelectPermanentCoroutine: null,
- mode: SelectPermanentEffect.Mode.Custom,
- cardEffect: activateClass);
- selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen card under.",
- "The opponent is selecting 1 Tamer to place the chosen card under.");
- yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
- IEnumerator SelectPermanentCoroutine(Permanent permanent)
- {
- selectedPermanent = permanent;
- yield return null;
- }
- if (selectedPermanent != null)
- {
- yield return ContinuousController.instance.StartCoroutine(
- selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
- yield return ContinuousController.instance.StartCoroutine(
- new DrawClass(card.Owner, 1, activateClass).Draw());
- }
- }
- }
- }
- #endregion
- return cardEffects;
- }
- }
- }
|