BT12_027.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_027 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Place 1 Digimon under this Digimon's digivolution cards to gain Memory +2", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] By placing another blue Digimon under this Digimon as its bottom digivolution card, gain 2 memory.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent != card.PermanentOfThisCard())
  26. {
  27. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  28. {
  29. return true;
  30. }
  31. }
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (!card.PermanentOfThisCard().IsToken)
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleArea(card))
  56. {
  57. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectPermanentCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: true,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: SelectPermanentCoroutine,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to place in digivolution cards.", "The opponent is selecting 1 Digimon to place in digivolution cards.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. IEnumerator SelectPermanentCoroutine(Permanent selectedPermanent)
  74. {
  75. CardSource topCard = selectedPermanent.TopCard;
  76. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { selectedPermanent, card.PermanentOfThisCard() } }, false, activateClass).PlacePermanentToDigivolutionCards());
  77. if (selectedPermanent.TopCard == null && CardEffectCommons.IsExistOnBattleArea(card))
  78. {
  79. if (card.PermanentOfThisCard().DigivolutionCards.Contains(topCard))
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  82. }
  83. }
  84. }
  85. }
  86. }
  87. }
  88. if (timing == EffectTiming.OnEnterFieldAnyone)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect("Place 1 Digimon under this Digimon's digivolution cards to gain Memory +2", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  93. cardEffects.Add(activateClass);
  94. string EffectDiscription()
  95. {
  96. return "[When Digivolving] By placing another blue Digimon under this Digimon as its bottom digivolution card, gain 2 memory.";
  97. }
  98. bool CanSelectPermanentCondition(Permanent permanent)
  99. {
  100. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  101. {
  102. if (permanent != card.PermanentOfThisCard())
  103. {
  104. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  105. {
  106. return true;
  107. }
  108. }
  109. }
  110. return false;
  111. }
  112. bool CanUseCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (!card.PermanentOfThisCard().IsToken)
  121. {
  122. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  123. {
  124. return true;
  125. }
  126. }
  127. }
  128. return false;
  129. }
  130. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  131. {
  132. if (CardEffectCommons.IsExistOnBattleArea(card))
  133. {
  134. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  135. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  136. selectPermanentEffect.SetUp(
  137. selectPlayer: card.Owner,
  138. canTargetCondition: CanSelectPermanentCondition,
  139. canTargetCondition_ByPreSelecetedList: null,
  140. canEndSelectCondition: null,
  141. maxCount: maxCount,
  142. canNoSelect: true,
  143. canEndNotMax: false,
  144. selectPermanentCoroutine: SelectPermanentCoroutine,
  145. afterSelectPermanentCoroutine: null,
  146. mode: SelectPermanentEffect.Mode.Custom,
  147. cardEffect: activateClass);
  148. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to place in digivolution cards.", "The opponent is selecting 1 Digimon to place in digivolution cards.");
  149. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  150. IEnumerator SelectPermanentCoroutine(Permanent selectedPermanent)
  151. {
  152. CardSource topCard = selectedPermanent.TopCard;
  153. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { selectedPermanent, card.PermanentOfThisCard() } }, false, activateClass).PlacePermanentToDigivolutionCards());
  154. if (selectedPermanent.TopCard == null && CardEffectCommons.IsExistOnBattleArea(card))
  155. {
  156. if (card.PermanentOfThisCard().DigivolutionCards.Contains(topCard))
  157. {
  158. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. return cardEffects;
  166. }
  167. }
  168. }