|
@@ -0,0 +1,193 @@
|
|
|
|
|
+using System;
|
|
|
|
|
+using System.Collections;
|
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
+using System.Linq;
|
|
|
|
|
+
|
|
|
|
|
+//BT21_082 Takuya
|
|
|
|
|
+namespace DCGO.CardEffects.BT21
|
|
|
|
|
+{
|
|
|
|
|
+ public class BT21_082 : CEntity_Effect
|
|
|
|
|
+ {
|
|
|
|
|
+ public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
|
|
|
|
|
+ {
|
|
|
|
|
+ List<ICardEffect> cardEffects = new List<ICardEffect>();
|
|
|
|
|
+
|
|
|
|
|
+ #region Start of main
|
|
|
|
|
+ if(timing == EffectTiming.OnStartMainPhase)
|
|
|
|
|
+ {
|
|
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
|
|
+ activateClass.SetUpICardEffect("Digivolve for reduced cost to hybrid or hero", CanUseCondition, card);
|
|
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
|
|
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
|
|
+
|
|
|
|
|
+ string EffectDescription()
|
|
|
|
|
+ {
|
|
|
|
|
+ return "[Start of Your Main Phase] 1 of your Digimon or Tamers may digivolve into a Digimon card with the [Hybrid] or [Hero] trait in the hand. For each of your red Tamers with different names, reduce this effect's digivolution cost by 1.";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
|
|
+ {
|
|
|
|
|
+ return CardEffectCommons.IsExistOnBattleArea(card);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
|
|
+ {
|
|
|
|
|
+ return CardEffectCommons.IsExistOnBattleArea(card);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool CanSelectDigivolvePermanent(Permanent permanent)
|
|
|
|
|
+ {
|
|
|
|
|
+ return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && (permanent.IsTamer || permanent.IsDigimon);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool CanSelectCardCondition(CardSource digivolveTarget, Permanent digivolvingTarget)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (digivolveTarget.EqualsTraits("Hybrid") || digivolveTarget.EqualsTraits("Hero"))
|
|
|
|
|
+ {
|
|
|
|
|
+ if (digivolveTarget.CanPlayCardTargetFrame(digivolvingTarget.PermanentFrame, true, activateClass))
|
|
|
|
|
+ {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int costReduction()
|
|
|
|
|
+ {
|
|
|
|
|
+ List<Permanent> cards = new List<Permanent>();
|
|
|
|
|
+
|
|
|
|
|
+ foreach (Permanent selection in card.Owner.GetBattleAreaPermanents().Filter<Permanent>(permanent=>permanent.TopCard.CardColors.Contains(CardColor.Red) && permanent.IsTamer))
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!cards.Some(permanent => permanent.TopCard.HasSameCardName(selection.TopCard)))
|
|
|
|
|
+ cards.Add(selection);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return cards.Count;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
|
|
+ {
|
|
|
|
|
+ Permanent selectedPermanent = null;
|
|
|
|
|
+ int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigivolvePermanent));
|
|
|
|
|
+ SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
|
|
|
|
|
+
|
|
|
|
|
+ selectPermanentEffect.SetUp(
|
|
|
|
|
+ selectPlayer: card.Owner,
|
|
|
|
|
+ canTargetCondition: CanSelectDigivolvePermanent,
|
|
|
|
|
+ canTargetCondition_ByPreSelecetedList: null,
|
|
|
|
|
+ canEndSelectCondition: null,
|
|
|
|
|
+ maxCount: maxCount,
|
|
|
|
|
+ canNoSelect: true,
|
|
|
|
|
+ canEndNotMax: false,
|
|
|
|
|
+ selectPermanentCoroutine: SelectPermanentCoroutine,
|
|
|
|
|
+ afterSelectPermanentCoroutine: null,
|
|
|
|
|
+ mode: SelectPermanentEffect.Mode.Custom,
|
|
|
|
|
+ cardEffect: activateClass);
|
|
|
|
|
+
|
|
|
|
|
+ selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to digivolve", "The opponent is selecting 1 digimon to digivolve");
|
|
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerator SelectPermanentCoroutine(Permanent permanent)
|
|
|
|
|
+ {
|
|
|
|
|
+ selectedPermanent = permanent;
|
|
|
|
|
+ yield return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (selectedPermanent != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
|
|
|
|
|
+ targetPermanent: selectedPermanent,
|
|
|
|
|
+ cardCondition: (cardSource) => CanSelectCardCondition(cardSource, selectedPermanent),
|
|
|
|
|
+ payCost: true,
|
|
|
|
|
+ reduceCostTuple: (reduceCost: costReduction(), reduceCostCardCondition: null),
|
|
|
|
|
+ fixedCostTuple: null,
|
|
|
|
|
+ ignoreDigivolutionRequirementFixedCost: -1,
|
|
|
|
|
+ isHand: true,
|
|
|
|
|
+ activateClass: activateClass,
|
|
|
|
|
+ successProcess: null));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region Security
|
|
|
|
|
+ if (timing == EffectTiming.SecuritySkill)
|
|
|
|
|
+ {
|
|
|
|
|
+ cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ #region Inherit
|
|
|
|
|
+ if(timing == EffectTiming.OnLoseSecurity)
|
|
|
|
|
+ {
|
|
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
|
|
+ activateClass.SetUpICardEffect("Play tamer on remove security", CanUseCondition, card);
|
|
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
|
|
|
|
|
+ activateClass.SetHashString("BT21_082Play");
|
|
|
|
|
+ activateClass.SetIsInheritedEffect(true);
|
|
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
|
|
+
|
|
|
|
|
+ string EffectDescription()
|
|
|
|
|
+ {
|
|
|
|
|
+ return "[Your Turn] [Once Per Turn] When your opponent's security stack is removed from, you may play 1 red Tamer card from your hand without paying the cost.";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
|
|
+ {
|
|
|
|
|
+ return CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner.Enemy) && CardEffectCommons.IsExistOnBattleAreaDigimon(card);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
|
|
+ {
|
|
|
|
|
+ return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool CanPlayCondition(CardSource cardSource)
|
|
|
|
|
+ {
|
|
|
|
|
+ return cardSource.IsTamer && cardSource.CardColors.Contains(CardColor.Red) && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
|
|
+ {
|
|
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
|
|
+
|
|
|
|
|
+ SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
|
|
|
|
|
+
|
|
|
|
|
+ selectHandEffect.SetUp(
|
|
|
|
|
+ selectPlayer: card.Owner,
|
|
|
|
|
+ canTargetCondition: CanPlayCondition,
|
|
|
|
|
+ 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 Tamer card to play.",
|
|
|
|
|
+ "The opponent is selecting 1 Tamer 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));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+ return cardEffects;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|