BT25_103.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // GraceNovamon
  5. namespace DCGO.CardEffects.BT25
  6. {
  7. public class BT25_103 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolve Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasTSTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 6, permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region DNA
  23. if (timing == EffectTiming.None)
  24. {
  25. cardEffects.Add(CardEffectFactory.GetJogressConditionClass(
  26. PermanentCondition1,
  27. "a level 6 Red Digimon",
  28. PermanentCondition2,
  29. "a level 6 Blue Digimon",
  30. card
  31. ));
  32. bool PermanentCondition1(Permanent permanent)
  33. {
  34. return permanent.TopCard.CardColors.Contains(CardColor.Red)
  35. && permanent.Levels_ForJogress(card).Contains(6);
  36. }
  37. bool PermanentCondition2(Permanent permanent)
  38. {
  39. return permanent.TopCard.CardColors.Contains(CardColor.Blue)
  40. && permanent.Levels_ForJogress(card).Contains(6);
  41. }
  42. }
  43. #endregion
  44. #region Security +1
  45. if (timing == EffectTiming.None)
  46. {
  47. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  48. }
  49. #endregion
  50. #region Iceclad
  51. if (timing == EffectTiming.None)
  52. {
  53. cardEffects.Add(CardEffectFactory.IcecladSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  54. }
  55. #endregion
  56. #region Partition
  57. if (timing == EffectTiming.WhenRemoveField)
  58. {
  59. List<PartitionCondition> partitionConditions = new List<PartitionCondition>
  60. {
  61. new PartitionCondition("Apollomon"),
  62. new PartitionCondition("Dianamon")
  63. };
  64. cardEffects.Add(CardEffectFactory.PartitionSelfEffect
  65. (isInheritedEffect: false,
  66. card: card,
  67. condition: null,
  68. cardSourceConditions: partitionConditions));
  69. }
  70. #endregion
  71. #region Shared OP / WA
  72. string BounceEffectName = "Bottom deck 1 enemy Digimon with equal or fewer digivolution cards than this";
  73. string BounceEffectDescription(string tag)
  74. => $"[{tag}] Return 1 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the bottom of the deck.";
  75. bool IsEnemyWithLessSources(Permanent permanent)
  76. {
  77. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  78. && permanent.DigivolutionCards.Count() <= card.PermanentOfThisCard().DigivolutionCards.Count;
  79. }
  80. IEnumerator BounceActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  81. {
  82. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsEnemyWithLessSources))
  83. {
  84. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  85. selectPermanentEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: IsEnemyWithLessSources,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: 1,
  91. canNoSelect: false,
  92. canEndNotMax: false,
  93. selectPermanentCoroutine: null,
  94. afterSelectPermanentCoroutine: null,
  95. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  96. cardEffect: activateClass);
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. }
  99. }
  100. CardEffectFactory.ActivateClassesForSharedEffects
  101. (ref cardEffects, timing, card,
  102. BounceEffectName,
  103. BounceActivateCoroutine,
  104. BounceEffectDescription,
  105. optional: false,
  106. whenDigivolving: true,
  107. whenAttacking: true);
  108. #endregion
  109. #region Shared WA / Counter
  110. string AttackingHashString = "BT25_103_WA_COUNTER";
  111. string AttackingEffectName = "May trash a digivolution card per this digimon's digivolution cards, then may end the attack.";
  112. string AttackingEffectDescription(string tag)
  113. => $"[{tag}] [Once Per Turn] For each of this Digimon's Digivolution cards, you may trash any 1 digivolution card from your opponent's Digimon. Then, you may end this attack.";
  114. bool IsEnemyDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  115. IEnumerator AttackingActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  116. {
  117. bool used = false;
  118. if (CardEffectCommons.HasMatchConditionPermanent(IsEnemyDigimon))
  119. {
  120. int count = card.PermanentOfThisCard().DigivolutionCards.Count;
  121. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  122. permanentCondition: IsEnemyDigimon,
  123. cardCondition: null,
  124. maxCount: count,//SelectTrashDigivolutionCards takes care of Math.Min possible cards
  125. canNoTrash: true,
  126. isFromOnly1Permanent: false,
  127. activateClass: activateClass,
  128. canEndNotMax: false,
  129. afterSelectionCoroutine: AfterSelectCoroutine
  130. ));
  131. IEnumerator AfterSelectCoroutine(Permanent permanent, List<CardSource> cardSources)
  132. {
  133. if (cardSources.Count > 0)
  134. used = true;
  135. yield return null;
  136. }
  137. List<SelectionElement<bool>> selectionElements1 = new List<SelectionElement<bool>>()
  138. {
  139. new SelectionElement<bool>(message: $"Yes", value : true, spriteIndex: 0),
  140. new SelectionElement<bool>(message: $"No", value : false, spriteIndex: 1),
  141. };
  142. string selectPlayerMessage1 = "Will you end the attack?";
  143. string notSelectPlayerMessage1 = "The opponent is choosing if they will end the attack.";
  144. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  145. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  146. if (GManager.instance.userSelectionManager.SelectedBoolValue)
  147. {
  148. used = true;
  149. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.EndAttack());
  150. }
  151. }
  152. if (!used) activateClass.RemoveUse();
  153. }
  154. CardEffectFactory.ActivateClassesForSharedEffects
  155. (ref cardEffects, timing, card,
  156. AttackingEffectName,
  157. AttackingActivateCoroutine,
  158. AttackingEffectDescription,
  159. optional: false,
  160. isSkippable: true,
  161. maxCountPerTurn: 1,
  162. hashValue: AttackingHashString,
  163. whenAttacking: true,
  164. counter: true);
  165. #endregion
  166. return cardEffects;
  167. }
  168. }
  169. }