P_141.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. namespace DCGO.CardEffects.P
  5. {
  6. public class P_141 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Rule - Name
  12. if (timing == EffectTiming.None)
  13. {
  14. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  15. changeCardNamesClass.SetUpICardEffect("Treated as having [Mamemon]/[Tyrannomon] in its name", CanUseCondition, card);
  16. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  17. cardEffects.Add(changeCardNamesClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  23. {
  24. if (cardSource == card)
  25. {
  26. CardNames.Add("Mamemon");
  27. CardNames.Add("Tyrannomon");
  28. }
  29. return CardNames;
  30. }
  31. }
  32. #endregion
  33. #region Digivolution Condition
  34. if (timing == EffectTiming.None)
  35. {
  36. bool PermanentCondition(Permanent targetPermanent)
  37. {
  38. if ((targetPermanent.TopCard.ContainsCardName("Mamemon") && targetPermanent.Level == 4) || (targetPermanent.TopCard.ContainsCardName("Tyrannomon") && targetPermanent.Level == 4))
  39. {
  40. return true;
  41. }
  42. return false;
  43. }
  44. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  45. }
  46. #endregion
  47. #region Blocker
  48. if (timing == EffectTiming.None)
  49. {
  50. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  51. isInheritedEffect: false,
  52. card: card,
  53. condition: null));
  54. }
  55. #endregion
  56. #region Collision
  57. if (timing == EffectTiming.OnCounterTiming)
  58. {
  59. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(false, card, null));
  60. }
  61. #endregion
  62. #region All turns
  63. if (timing == EffectTiming.OnTappedAnyone)
  64. {
  65. ActivateClass activateClass = new ActivateClass();
  66. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  67. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  68. activateClass.SetHashString("Unsuspend_P_141");
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[All Turns] [Once Per Turn] When an opponent's Digimon becomes suspended, you may unsuspend this Digimon.";
  73. }
  74. bool PermanentCondition(Permanent permanent)
  75. {
  76. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  77. {
  78. if (permanent.IsDigimon)
  79. {
  80. return true;
  81. }
  82. }
  83. return false;
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. if (CardEffectCommons.IsExistOnBattleArea(card))
  88. {
  89. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  90. {
  91. return true;
  92. }
  93. }
  94. return false;
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. if (CardEffectCommons.IsExistOnBattleArea(card))
  99. {
  100. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  101. {
  102. return true;
  103. }
  104. }
  105. return false;
  106. }
  107. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  108. {
  109. Permanent selectedPermanent = card.PermanentOfThisCard();
  110. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  111. }
  112. }
  113. #endregion
  114. #region Inherit
  115. if (timing == EffectTiming.OnTappedAnyone)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  119. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  120. activateClass.SetHashString("UnsuspendESS_P_141");
  121. activateClass.SetIsInheritedEffect(true);
  122. cardEffects.Add(activateClass);
  123. string EffectDiscription()
  124. {
  125. return "[All Turns] [Once Per Turn] When an opponent's Digimon becomes suspended, you may unsuspend this Digimon.";
  126. }
  127. bool PermanentCondition(Permanent permanent)
  128. {
  129. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  130. {
  131. if (permanent.IsDigimon)
  132. {
  133. return true;
  134. }
  135. }
  136. return false;
  137. }
  138. bool CanUseCondition(Hashtable hashtable)
  139. {
  140. if (CardEffectCommons.IsExistOnBattleArea(card))
  141. {
  142. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  143. {
  144. return true;
  145. }
  146. }
  147. return false;
  148. }
  149. bool CanActivateCondition(Hashtable hashtable)
  150. {
  151. if (CardEffectCommons.IsExistOnBattleArea(card))
  152. {
  153. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  154. {
  155. return true;
  156. }
  157. }
  158. return false;
  159. }
  160. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  161. {
  162. Permanent selectedPermanent = card.PermanentOfThisCard();
  163. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  164. }
  165. }
  166. #endregion
  167. return cardEffects;
  168. }
  169. }
  170. }