BT19_091.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT19
  6. {
  7. public class BT19_091 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Color Requirements
  13. if (timing == EffectTiming.None)
  14. {
  15. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level == 5))
  22. {
  23. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.EqualsCardName("WarGrowlmon") || permanent.TopCard.EqualsCardName("Taomon") || permanent.TopCard.EqualsCardName("Rapidmon")))
  24. {
  25. return true;
  26. }
  27. }
  28. return false;
  29. }
  30. bool CardCondition(CardSource cardSource)
  31. {
  32. if (cardSource == card)
  33. {
  34. return true;
  35. }
  36. return false;
  37. }
  38. }
  39. #endregion
  40. #region Main
  41. if (timing == EffectTiming.OptionSkill)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect("Play tokens, give alliance and attack", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. 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.";
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card) &&
  54. card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()) >= 1;
  55. }
  56. bool CanSelectPermanentCondition(Permanent permanent)
  57. {
  58. if(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  59. {
  60. if(permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level == 5)
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. bool CanPlayTokens(string cardName)
  68. {
  69. return !card.Owner.GetBattleAreaPermanents().Some(permanent => permanent.TopCard.EqualsCardName(cardName));
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  72. {
  73. if (CanPlayTokens("WarGrowlmon"))
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayWarGrowlmonToken(activateClass));
  75. if (CanPlayTokens("Taomon"))
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayTaomonToken(activateClass));
  77. if (CanPlayTokens("Rapidmon"))
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayRapidmonToken(activateClass));
  79. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  80. {
  81. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  82. Permanent selectedPermanent = null;
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectPermanentCondition,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: maxCount,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Alliance twice.", "The opponent is selecting 1 Digimon.");
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. selectedPermanent = permanent;
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  103. }
  104. if (selectedPermanent != null)
  105. {
  106. if (selectedPermanent.CanAttack(activateClass))
  107. {
  108. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  109. selectAttackEffect.SetUp(
  110. attacker: selectedPermanent,
  111. canAttackPlayerCondition: () => true,
  112. defenderCondition: (permanent) => true,
  113. cardEffect: activateClass);
  114. selectAttackEffect.SetCanNotSelectNotAttack();
  115. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  116. }
  117. }
  118. }
  119. }
  120. }
  121. #endregion
  122. #region Security
  123. if (timing == EffectTiming.SecuritySkill)
  124. {
  125. ActivateClass activateClass = new ActivateClass();
  126. activateClass.SetUpICardEffect($"Play 1 [WarGrowlmon]/[Taomon]/[Rapidmon] Digimon card from hand", CanUseCondition, card);
  127. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  128. activateClass.SetIsSecurityEffect(true);
  129. cardEffects.Add(activateClass);
  130. string EffectDescription()
  131. {
  132. return "[Security] You may play 1 level 5 [WarGrowlmon]/[Taomon]/[Rapidmon] from your hand without paying the cost.";
  133. }
  134. bool CanUseCondition(Hashtable hashtable)
  135. {
  136. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  137. }
  138. bool CanSelectCardCondition(CardSource cardSource)
  139. {
  140. if(cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level == 5 && cardSource.EqualsCardName("WarGrowlmon") && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  141. {
  142. return true;
  143. }
  144. if (cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level == 5 && cardSource.EqualsCardName("Taomon") && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  145. {
  146. return true;
  147. }
  148. if(cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level == 5 && cardSource.EqualsCardName("Rapidmon") && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  149. {
  150. return true;
  151. }
  152. return false;
  153. }
  154. IEnumerator ActivateCoroutine(Hashtable hashtable)
  155. {
  156. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  157. {
  158. List<CardSource> selectedCards = new List<CardSource>();
  159. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  160. selectHandEffect.SetUp(
  161. selectPlayer: card.Owner,
  162. canTargetCondition: CanSelectCardCondition,
  163. canTargetCondition_ByPreSelecetedList: null,
  164. canEndSelectCondition: null,
  165. maxCount: 1,
  166. canNoSelect: true,
  167. canEndNotMax: false,
  168. isShowOpponent: true,
  169. selectCardCoroutine: SelectCardCoroutine,
  170. afterSelectCardCoroutine: null,
  171. mode: SelectHandEffect.Mode.Custom,
  172. cardEffect: activateClass);
  173. selectHandEffect.SetUpCustomMessage("Select 1 level 5 [WarGrowlmon]/[Taomon]/[Rapidmon card to play.", "The opponent is selecting 1 card to play.");
  174. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  175. yield return StartCoroutine(selectHandEffect.Activate());
  176. IEnumerator SelectCardCoroutine(CardSource cardSource)
  177. {
  178. selectedCards.Add(cardSource);
  179. yield return null;
  180. }
  181. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  182. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  183. root: SelectCardEffect.Root.Hand, activateETB: true));
  184. }
  185. }
  186. }
  187. #endregion
  188. return cardEffects;
  189. }
  190. }
  191. }