P_185.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. int count()
  121. {
  122. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  123. {
  124. List<CardSource> cards = card.PermanentOfThisCard().DigivolutionCards;
  125. var colourCount = Combinations.GetDifferenetColorCardCount(cards);
  126. var newDP = colourCount * 1000;
  127. return newDP;
  128. }
  129. return 0;
  130. }
  131. bool Condition()
  132. {
  133. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  134. }
  135. bool PermanentCondition(Permanent permanent)
  136. {
  137. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  138. {
  139. if (permanent == card.PermanentOfThisCard())
  140. {
  141. return true;
  142. }
  143. }
  144. return false;
  145. }
  146. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  147. permanentCondition: PermanentCondition,
  148. changeValue: count(),
  149. isInheritedEffect: false,
  150. card: card,
  151. condition: Condition,
  152. effectName: EffectDiscription));
  153. string EffectDiscription()
  154. {
  155. return "[All Turns] This Digimon gets +1000 DP for each color in its digivolution cards.";
  156. }
  157. }
  158. #endregion
  159. #region End of your turn OPT
  160. if (timing == EffectTiming.OnEndTurn)
  161. {
  162. ActivateClass activateClass = new ActivateClass();
  163. activateClass.SetUpICardEffect("", CanUseCondition, card);
  164. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  165. activateClass.SetHashString("Unsuspend_P_185");
  166. cardEffects.Add(activateClass);
  167. string EffectDiscription()
  168. {
  169. return "[End of Your Turn] [Once Per Turn] This Digimon unsuspends.";
  170. }
  171. bool CanUseCondition(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  174. {
  175. if (CardEffectCommons.IsOwnerTurn(card))
  176. {
  177. return true;
  178. }
  179. }
  180. return false;
  181. }
  182. bool CanActivateCondition(Hashtable hashtable)
  183. {
  184. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  185. {
  186. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  187. {
  188. return true;
  189. }
  190. }
  191. return false;
  192. }
  193. IEnumerator ActivateCoroutine(Hashtable hashtable)
  194. {
  195. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent> { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  196. }
  197. }
  198. #endregion
  199. return cardEffects;
  200. }
  201. }
  202. }