BT16_063.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_063 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
  12. partitionConditions.Add(new PartitionCondition(4, CardColor.Black));
  13. partitionConditions.Add(new PartitionCondition(4, CardColor.Yellow));
  14. #region DNA Digivolution - Black Lv.4 + Yellow Lv.4: Cost 0
  15. if (timing == EffectTiming.None)
  16. {
  17. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  18. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  19. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  20. addJogressConditionClass.SetNotShowUI(true);
  21. cardEffects.Add(addJogressConditionClass);
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return true;
  25. }
  26. JogressCondition GetJogress(CardSource cardSource)
  27. {
  28. if (cardSource == card)
  29. {
  30. bool PermanentCondition1(Permanent permanent)
  31. {
  32. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  33. {
  34. if (permanent.TopCard.CardColors.Contains(CardColor.Black))
  35. {
  36. if (permanent.Levels_ForJogress(card).Contains(4))
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. bool PermanentCondition2(Permanent permanent)
  45. {
  46. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  47. {
  48. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  49. {
  50. if (permanent.Levels_ForJogress(card).Contains(4))
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. return false;
  57. }
  58. JogressConditionElement[] elements = new JogressConditionElement[]
  59. {
  60. new JogressConditionElement(PermanentCondition1, "a level 4 black Digimon"),
  61. new JogressConditionElement(PermanentCondition2, "a level 4 yellow Digimon"),
  62. };
  63. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  64. return jogressCondition;
  65. }
  66. return null;
  67. }
  68. }
  69. #endregion
  70. #region When Digivolved
  71. if (timing == EffectTiming.OnEnterFieldAnyone)
  72. {
  73. int SelectedCardCount = Math.Max(card.Owner.Enemy.SecurityCards.Count, card.Owner.SecurityCards.Count);
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect("Unaffected by effects of your opponent's Digimon", CanUseCondition, card);
  76. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  77. cardEffects.Add(activateClass);
  78. string EffectDiscription()
  79. {
  80. return "[When Digivolving] This Digimon isn't affected by the effects of your opponent's Digimon until the end of their turn. Then, if DNA digivolving, place 1 of your opponent's Digimon whose level is less than or equal to the number of cards in yours or your opponent's security stack at the bottom of your opponent's security stack.";
  81. }
  82. bool CanSelectPermanentCondition(Permanent permanent)
  83. {
  84. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  85. {
  86. if (permanent.TopCard.HasLevel)
  87. {
  88. if (permanent.Level <= SelectedCardCount)
  89. {
  90. return true;
  91. }
  92. }
  93. }
  94. return false;
  95. }
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  99. }
  100. bool CanActivateCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable hashtable)
  105. {
  106. Permanent selectedPermanent = card.PermanentOfThisCard();
  107. if (selectedPermanent != null)
  108. {
  109. #region Give Digimon Effect Immunity
  110. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => PermanentEffectFactory.DigimonEffectImmunity(selectedPermanent));
  111. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  112. #endregion
  113. }
  114. if (CardEffectCommons.IsJogress(hashtable))
  115. {
  116. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  117. selectPermanentEffect.SetUp(
  118. selectPlayer: card.Owner,
  119. canTargetCondition: CanSelectPermanentCondition,
  120. canTargetCondition_ByPreSelecetedList: null,
  121. canEndSelectCondition: null,
  122. maxCount: 1,
  123. canNoSelect: false,
  124. canEndNotMax: false,
  125. selectPermanentCoroutine: SelectPermanentCoroutine,
  126. afterSelectPermanentCoroutine: null,
  127. mode: SelectPermanentEffect.Mode.Custom,
  128. cardEffect: activateClass);
  129. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to place to security.", "The opponent is selecting 1 Digimon to place to security.");
  130. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  131. }
  132. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  133. {
  134. if (permanent != null)
  135. {
  136. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  137. {
  138. yield return ContinuousController.instance.StartCoroutine(new IPutSecurityPermanent(
  139. permanent,
  140. CardEffectCommons.CardEffectHashtable(activateClass),
  141. false).PutSecurity());
  142. }
  143. }
  144. }
  145. }
  146. }
  147. #endregion
  148. #region Partition
  149. if (timing == EffectTiming.WhenRemoveField)
  150. {
  151. cardEffects.Add(CardEffectFactory.PartitionSelfEffect(
  152. isInheritedEffect: false,
  153. card: card,
  154. condition: null,
  155. cardSourceConditions: partitionConditions)
  156. );
  157. }
  158. #endregion
  159. #region Partition - Inherited
  160. if (timing == EffectTiming.WhenRemoveField)
  161. {
  162. cardEffects.Add(CardEffectFactory.PartitionSelfEffect(
  163. isInheritedEffect: true,
  164. card: card,
  165. condition: null,
  166. cardSourceConditions: partitionConditions)
  167. );
  168. }
  169. #endregion
  170. return cardEffects;
  171. }
  172. }
  173. }