P_185.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. //EmperorGreymon
  6. namespace DCGO.CardEffects.P
  7. {
  8. public class P_185 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Static Effects
  14. #region Alternative Digivolution Condition
  15. if (timing == EffectTiming.None)
  16. {
  17. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. if (targetPermanent.TopCard.IsTamer)
  20. {
  21. if (targetPermanent.TopCard.EqualsCardName("Takuya Kanbara"))
  22. {
  23. if (targetPermanent.cardSources.Filter(x => x.EqualsTraits("Hybrid")).Count >= 5)
  24. {
  25. return true;
  26. }
  27. }
  28. }
  29. return false;
  30. }
  31. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  32. permanentCondition: PermanentCondition,
  33. digivolutionCost: 3,
  34. ignoreDigivolutionRequirement: false,
  35. card: card,
  36. condition: null)
  37. );
  38. }
  39. #endregion
  40. #region Blocker
  41. if (timing == EffectTiming.None)
  42. {
  43. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  44. isInheritedEffect: false,
  45. card: card,
  46. condition: null));
  47. }
  48. #endregion
  49. #endregion
  50. #region When Digivolving
  51. if (timing == EffectTiming.OnEnterFieldAnyone)
  52. {
  53. ActivateClass activateClass = new ActivateClass();
  54. activateClass.SetUpICardEffect("Delete 1 digimon", CanUseCondition, card);
  55. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  56. cardEffects.Add(activateClass);
  57. string EffectDiscription()
  58. {
  59. return "[When Digivolving] Delete 1 of your opponent's Digimon with as much or less DP as this Digimon.";
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  64. {
  65. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  66. {
  67. return true;
  68. }
  69. }
  70. return false;
  71. }
  72. bool CanActivateCondition(Hashtable hashtable)
  73. {
  74. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  75. {
  76. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  77. {
  78. return true;
  79. }
  80. }
  81. return false;
  82. }
  83. bool CanSelectPermanentCondition(Permanent permanent)
  84. {
  85. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  86. {
  87. if (permanent.DP <= card.PermanentOfThisCard().DP)
  88. {
  89. return true;
  90. }
  91. }
  92. return false;
  93. }
  94. IEnumerator ActivateCoroutine(Hashtable hashtable)
  95. {
  96. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  97. {
  98. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  99. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  100. selectPermanentEffect.SetUp(
  101. selectPlayer: card.Owner,
  102. canTargetCondition: CanSelectPermanentCondition,
  103. canTargetCondition_ByPreSelecetedList: null,
  104. canEndSelectCondition: null,
  105. maxCount: maxCount,
  106. canNoSelect: false,
  107. canEndNotMax: false,
  108. selectPermanentCoroutine: null,
  109. afterSelectPermanentCoroutine: null,
  110. mode: SelectPermanentEffect.Mode.Destroy,
  111. cardEffect: activateClass);
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. }
  114. }
  115. }
  116. #endregion
  117. #region All Turns
  118. if (timing == EffectTiming.None)
  119. {
  120. List<CardSource> cards = card.PermanentOfThisCard().cardSources;
  121. var colourCount = Combinations.GetDifferenetColorCardCount(cards);
  122. var newDP = colourCount * 1000;
  123. bool Condition()
  124. {
  125. return CardEffectCommons.IsExistOnBattleArea(card);
  126. }
  127. bool PermanentCondition(Permanent permanent)
  128. {
  129. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  130. {
  131. if (permanent == card.PermanentOfThisCard())
  132. {
  133. return true;
  134. }
  135. }
  136. return false;
  137. }
  138. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  139. permanentCondition: PermanentCondition,
  140. changeValue: newDP,
  141. isInheritedEffect: false,
  142. card: card,
  143. condition: Condition,
  144. effectName: EffectDiscription));
  145. string EffectDiscription()
  146. {
  147. return "[All Turns] This Digimon gets +1000 DP for each color in its digivolution cards.";
  148. }
  149. }
  150. #endregion
  151. #region End of your turn OPT
  152. if (timing == EffectTiming.OnEndTurn)
  153. {
  154. ActivateClass activateClass = new ActivateClass();
  155. activateClass.SetUpICardEffect("", CanUseCondition, card);
  156. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  157. activateClass.SetHashString("Unsuspend_P_185");
  158. cardEffects.Add(activateClass);
  159. string EffectDiscription()
  160. {
  161. return "[End of Your Turn] [Once Per Turn] This Digimon unsuspends.";
  162. }
  163. bool CanUseCondition(Hashtable hashtable)
  164. {
  165. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  166. {
  167. if (CardEffectCommons.IsOwnerTurn(card))
  168. {
  169. return true;
  170. }
  171. }
  172. return false;
  173. }
  174. bool CanActivateCondition(Hashtable hashtable)
  175. {
  176. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  177. {
  178. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  179. {
  180. return true;
  181. }
  182. }
  183. return false;
  184. }
  185. IEnumerator ActivateCoroutine(Hashtable hashtable)
  186. {
  187. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent> { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  188. }
  189. }
  190. #endregion
  191. return cardEffects;
  192. }
  193. }
  194. }