|
|
@@ -0,0 +1,246 @@
|
|
|
+using System;
|
|
|
+using System.Collections;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+
|
|
|
+namespace DCGO.CardEffects.BT19
|
|
|
+{
|
|
|
+ public class BT19_091 : CEntity_Effect
|
|
|
+ {
|
|
|
+ public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
|
|
|
+ {
|
|
|
+ List<ICardEffect> cardEffects = new List<ICardEffect>();
|
|
|
+
|
|
|
+ #region Color Requirements
|
|
|
+ if (timing == EffectTiming.None)
|
|
|
+ {
|
|
|
+ IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
|
|
|
+ ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
|
|
|
+ ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
|
|
|
+
|
|
|
+ cardEffects.Add(ignoreColorConditionClass);
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level == 5))
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.EqualsCardName("WarGrowlmon") || permanent.TopCard.EqualsCardName("Taomon") || permanent.TopCard.EqualsCardName("Rapidmon")))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if (cardSource == card)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Main
|
|
|
+ if (timing == EffectTiming.OptionSkill)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect("Play tokens, give alliance and attack", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDiscription()
|
|
|
+ {
|
|
|
+ return "[Main] Play 1 [WarGrowlmon] Token (Digimon/Red/6000 DP), [Taomon] Token (Digimon/Yellow/6000 DP), and 1 [Rapidmon] Token (Digimon/Green/6000 DP). This effect can't play tokens with the same names as your Digimon. Then, 1 of your level 5 Digimon gains <Alliance> twice for the turn and attacks.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectPermanentCondition(Permanent permanent)
|
|
|
+ {
|
|
|
+ if(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
|
|
|
+ {
|
|
|
+ if(permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level == 5)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanPlayTokens(string cardName)
|
|
|
+ {
|
|
|
+ return !card.Owner.GetBattleAreaPermanents().Some(permanent => permanent.TopCard.EqualsCardName(cardName));
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanActivateCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.IsExistOnBattleArea(card))
|
|
|
+ {
|
|
|
+ if (card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable _hashtable)
|
|
|
+ {
|
|
|
+ if (CanPlayTokens("WarGrowlmon"))
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayWarGrowlmonToken(activateClass));
|
|
|
+
|
|
|
+ if (CanPlayTokens("Taomon"))
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayTaomonToken(activateClass));
|
|
|
+
|
|
|
+ if (CanPlayTokens("Rapidmon"))
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayRapidmonToken(activateClass));
|
|
|
+
|
|
|
+ if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
|
|
|
+ {
|
|
|
+ int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
|
|
|
+ Permanent selectedPermanent = null;
|
|
|
+
|
|
|
+ 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 Digimon that will get Alliance twice.", "The opponent is selecting 1 Digimon.");
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
|
|
|
+
|
|
|
+ IEnumerator SelectPermanentCoroutine(Permanent permanent)
|
|
|
+ {
|
|
|
+ selectedPermanent = permanent;
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (selectedPermanent != null)
|
|
|
+ {
|
|
|
+ if (selectedPermanent.CanAttack(activateClass))
|
|
|
+ {
|
|
|
+ SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
|
|
|
+
|
|
|
+ selectAttackEffect.SetUp(
|
|
|
+ attacker: selectedPermanent,
|
|
|
+ canAttackPlayerCondition: () => true,
|
|
|
+ defenderCondition: (permanent) => true,
|
|
|
+ cardEffect: activateClass);
|
|
|
+
|
|
|
+ selectAttackEffect.SetCanNotSelectNotAttack();
|
|
|
+
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region Security
|
|
|
+ if (timing == EffectTiming.SecuritySkill)
|
|
|
+ {
|
|
|
+ ActivateClass activateClass = new ActivateClass();
|
|
|
+ activateClass.SetUpICardEffect($"Play 1 [WarGrowlmon]/[Taomon]/[Rapidmon] Digimon card from hand", CanUseCondition, card);
|
|
|
+ activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
|
|
|
+ activateClass.SetIsSecurityEffect(true);
|
|
|
+ cardEffects.Add(activateClass);
|
|
|
+
|
|
|
+ string EffectDescription()
|
|
|
+ {
|
|
|
+ return "[Security] You may play 1 level 5 [WarGrowlmon]/[Taomon]/[Rapidmon] from your hand without paying the cost.";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanUseCondition(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool CanSelectCardCondition(CardSource cardSource)
|
|
|
+ {
|
|
|
+ if(cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level == 5 && cardSource.EqualsCardName("WarGrowlmon") && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level == 5 && cardSource.EqualsCardName("Taomon") && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level == 5 && cardSource.EqualsCardName("Rapidmon") && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ IEnumerator ActivateCoroutine(Hashtable hashtable)
|
|
|
+ {
|
|
|
+ if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
|
|
|
+ {
|
|
|
+ List<CardSource> selectedCards = new List<CardSource>();
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ selectHandEffect.SetUpCustomMessage("Select 1 level 5 [WarGrowlmon]/[Taomon]/[Rapidmon card to play.", "The opponent is selecting 1 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|