RB1_010.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class RB1_010 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasText("Gammamon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Place 1 card to digivolution cards to Delete Digimon", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[When Digivolving] By placing 1 Digimon card with [Gammamon] in its text from your hand as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with DP less than or equal to this Digimon's DP.";
  30. }
  31. bool CanSelectCardCondition(CardSource cardSource)
  32. {
  33. if (cardSource.IsDigimon)
  34. {
  35. if (cardSource.HasText("Gammamon"))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanSelectPermanentCondition(Permanent permanent)
  43. {
  44. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (permanent.DP <= card.PermanentOfThisCard().DP)
  49. {
  50. return true;
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  59. }
  60. bool CanActivateCondition(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.IsExistOnBattleArea(card))
  63. {
  64. if (card.Owner.HandCards.Count >= 1)
  65. {
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  72. {
  73. if (CardEffectCommons.IsExistOnBattleArea(card))
  74. {
  75. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  76. {
  77. List<CardSource> selectedCards = new List<CardSource>();
  78. int maxCount = 1;
  79. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  80. selectHandEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectCardCondition,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: maxCount,
  86. canNoSelect: true,
  87. canEndNotMax: false,
  88. isShowOpponent: true,
  89. selectCardCoroutine: SelectCardCoroutine,
  90. afterSelectCardCoroutine: null,
  91. mode: SelectHandEffect.Mode.Custom,
  92. cardEffect: activateClass);
  93. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  94. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  95. yield return StartCoroutine(selectHandEffect.Activate());
  96. IEnumerator SelectCardCoroutine(CardSource cardSource)
  97. {
  98. selectedCards.Add(cardSource);
  99. yield return null;
  100. }
  101. if (selectedCards.Count >= 1)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  104. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  105. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  106. selectPermanentEffect.SetUp(
  107. selectPlayer: card.Owner,
  108. canTargetCondition: CanSelectPermanentCondition,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: null,
  111. maxCount: maxCount,
  112. canNoSelect: false,
  113. canEndNotMax: false,
  114. selectPermanentCoroutine: null,
  115. afterSelectPermanentCoroutine: null,
  116. mode: SelectPermanentEffect.Mode.Destroy,
  117. cardEffect: activateClass);
  118. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  119. }
  120. }
  121. }
  122. }
  123. }
  124. if (timing == EffectTiming.OnDestroyedAnyone)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  129. activateClass.SetHashString("Unsuspend_RB1_010");
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. {
  133. return "[Your Turn][Once Per Turn] When an opponent's Digimon is deleted, you may unsuspend this Digimon.";
  134. }
  135. bool PermanentCondition(Permanent permanent)
  136. {
  137. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  138. }
  139. bool CanUseCondition(Hashtable hashtable)
  140. {
  141. if (CardEffectCommons.IsExistOnBattleArea(card))
  142. {
  143. if (CardEffectCommons.IsOwnerTurn(card))
  144. {
  145. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  146. {
  147. return true;
  148. }
  149. }
  150. }
  151. return false;
  152. }
  153. bool CanActivateCondition(Hashtable hashtable)
  154. {
  155. if (CardEffectCommons.IsExistOnBattleArea(card))
  156. {
  157. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  158. {
  159. return true;
  160. }
  161. }
  162. return false;
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  165. {
  166. Permanent selectedPermanent = card.PermanentOfThisCard();
  167. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  168. }
  169. }
  170. return cardEffects;
  171. }
  172. }