EX8_016.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX8
  5. {
  6. public class EX8_016 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.ContainsTraits("Dinosaur") || targetPermanent.TopCard.ContainsCardName("Tyrannomon"))
  17. {
  18. if (targetPermanent.TopCard.HasLevel)
  19. {
  20. if (targetPermanent.Level == 5)
  21. {
  22. return true;
  23. }
  24. }
  25. }
  26. return false;
  27. }
  28. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  29. }
  30. #endregion
  31. #region Security Attack +1
  32. if (timing == EffectTiming.None)
  33. {
  34. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  35. }
  36. #endregion
  37. #region Fortitude
  38. if (timing == EffectTiming.OnDestroyedAnyone)
  39. {
  40. cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  41. }
  42. #endregion
  43. #region On Play/When Digivolving Shared
  44. bool CanSelectPermanentForSuspendCondition(Permanent permanent)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent) && permanent.IsDigimon;
  47. }
  48. bool CanSelectLowestDPSuspendedCondition(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy, (permanent) => permanent.IsSuspended);
  51. }
  52. bool CanActivateOnPlayWhenDigivolvingCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  55. }
  56. #endregion
  57. #region On Play
  58. if (timing == EffectTiming.OnEnterFieldAnyone)
  59. {
  60. ActivateClass activateClass = new ActivateClass();
  61. activateClass.SetUpICardEffect("Suspend and delete an opponent's Digimon", CanUseCondition, card);
  62. activateClass.SetUpActivateClass(CanActivateOnPlayWhenDigivolvingCondition, ActivateCoroutine, -1, false, EffectDiscription());
  63. cardEffects.Add(activateClass);
  64. string EffectDiscription()
  65. {
  66. return "[On Play] You may suspend 1 Digimon. Then, delete 1 of your opponent's suspended Digimon with the lowest DP.";
  67. }
  68. bool CanUseCondition(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.CanTriggerOnPlay(hashtable, card) &&
  71. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable hashtable)
  74. {
  75. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentForSuspendCondition))
  76. {
  77. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  78. selectPermanentEffect.SetUp(
  79. selectPlayer: card.Owner,
  80. canTargetCondition: CanSelectPermanentForSuspendCondition,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. maxCount: 1,
  84. canNoSelect: true,
  85. canEndNotMax: false,
  86. selectPermanentCoroutine: null,
  87. afterSelectPermanentCoroutine: null,
  88. mode: SelectPermanentEffect.Mode.Tap,
  89. cardEffect: activateClass);
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. }
  92. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLowestDPSuspendedCondition))
  93. {
  94. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLowestDPSuspendedCondition));
  95. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  96. selectPermanentEffect.SetUp(
  97. selectPlayer: card.Owner,
  98. canTargetCondition: CanSelectLowestDPSuspendedCondition,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. maxCount: maxCount,
  102. canNoSelect: false,
  103. canEndNotMax: false,
  104. selectPermanentCoroutine: null,
  105. afterSelectPermanentCoroutine: null,
  106. mode: SelectPermanentEffect.Mode.Destroy,
  107. cardEffect: activateClass);
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. }
  110. }
  111. }
  112. #endregion
  113. #region When Digivolving
  114. if (timing == EffectTiming.OnEnterFieldAnyone)
  115. {
  116. ActivateClass activateClass = new ActivateClass();
  117. activateClass.SetUpICardEffect("Suspend and delete an opponent's Digimon", CanUseCondition, card);
  118. activateClass.SetUpActivateClass(CanActivateOnPlayWhenDigivolvingCondition, ActivateCoroutine, -1, false,
  119. EffectDiscription());
  120. cardEffects.Add(activateClass);
  121. string EffectDiscription()
  122. {
  123. return
  124. "[When Digivolving] You may suspend 1 Digimon. Then, delete 1 of your opponent's suspended Digimon with the lowest DP.";
  125. }
  126. bool CanUseCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) &&
  129. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable hashtable)
  132. {
  133. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentForSuspendCondition))
  134. {
  135. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  136. selectPermanentEffect.SetUp(
  137. selectPlayer: card.Owner,
  138. canTargetCondition: CanSelectPermanentForSuspendCondition,
  139. canTargetCondition_ByPreSelecetedList: null,
  140. canEndSelectCondition: null,
  141. maxCount: 1,
  142. canNoSelect: true,
  143. canEndNotMax: false,
  144. selectPermanentCoroutine: null,
  145. afterSelectPermanentCoroutine: null,
  146. mode: SelectPermanentEffect.Mode.Tap,
  147. cardEffect: activateClass);
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. }
  150. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLowestDPSuspendedCondition))
  151. {
  152. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectLowestDPSuspendedCondition));
  153. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  154. selectPermanentEffect.SetUp(
  155. selectPlayer: card.Owner,
  156. canTargetCondition: CanSelectLowestDPSuspendedCondition,
  157. canTargetCondition_ByPreSelecetedList: null,
  158. canEndSelectCondition: null,
  159. maxCount: maxCount,
  160. canNoSelect: false,
  161. canEndNotMax: false,
  162. selectPermanentCoroutine: null,
  163. afterSelectPermanentCoroutine: null,
  164. mode: SelectPermanentEffect.Mode.Destroy,
  165. cardEffect: activateClass);
  166. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  167. }
  168. }
  169. }
  170. #endregion
  171. #region Opponent's Turn
  172. if (timing == EffectTiming.None)
  173. {
  174. bool AttackerCondition(Permanent permanent)
  175. {
  176. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  177. {
  178. return true;
  179. }
  180. return false;
  181. }
  182. bool DefenderCondition(Permanent permanent)
  183. {
  184. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  185. {
  186. if (permanent.IsSuspended)
  187. {
  188. return false;
  189. }
  190. }
  191. return true;
  192. }
  193. bool Condition()
  194. {
  195. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  196. {
  197. if (CardEffectCommons.IsOpponentTurn(card))
  198. {
  199. if (card.PermanentOfThisCard().IsSuspended)
  200. {
  201. return true;
  202. }
  203. }
  204. }
  205. return false;
  206. }
  207. string effectName = "While this Digimon is suspended, all of your opponent's Digimon can only attack suspended Digimon.";
  208. cardEffects.Add(CardEffectFactory.CanNotAttackStaticEffect(
  209. attackerCondition: AttackerCondition,
  210. defenderCondition: DefenderCondition,
  211. isInheritedEffect: false,
  212. card: card,
  213. condition: Condition,
  214. effectName: effectName
  215. ));
  216. }
  217. #endregion
  218. return cardEffects;
  219. }
  220. }
  221. }