BT21_029.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Medusamon
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_029 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Progress
  14. if (timing == EffectTiming.None)
  15. {
  16. cardEffects.Add(CardEffectFactory.ProgressSelfStaticEffect(false, card, null));
  17. }
  18. #endregion
  19. #region Sec +1
  20. if (timing == EffectTiming.None)
  21. {
  22. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(
  23. changeValue: 1,
  24. isInheritedEffect: false,
  25. card: card,
  26. condition: null));
  27. }
  28. #endregion
  29. #endregion
  30. #region When Digivolving/End of Attack Shared
  31. bool CanSelectPermanentCondition(Permanent permanent)
  32. {
  33. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  34. {
  35. if (CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. IEnumerator WDAndEoAActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  43. {
  44. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  45. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  46. selectPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: CanSelectPermanentCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: maxCount,
  52. canNoSelect: false,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: null,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Destroy,
  57. cardEffect: activateClass);
  58. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  59. }
  60. #endregion
  61. #region When Digivolving
  62. if (timing == EffectTiming.OnEnterFieldAnyone)
  63. {
  64. ActivateClass activateClass = new ActivateClass();
  65. activateClass.SetUpICardEffect("Delete lowest DP Digimon", CanUseCondition, card);
  66. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => WDAndEoAActivateCoroutine(hashtable, activateClass), 1, true, EffectDiscription());
  67. activateClass.SetHashString("Delete_BT21_029");
  68. cardEffects.Add(activateClass);
  69. string EffectDiscription()
  70. => "[When Digivolving] [Once Per Turn] You may delete 1 of your opponent's lowest DP Digimon.";
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  74. {
  75. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  76. {
  77. return true;
  78. }
  79. }
  80. return false;
  81. }
  82. bool CanActivateCondition(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  85. {
  86. return true;
  87. }
  88. return false;
  89. }
  90. }
  91. #endregion
  92. #region End of Attack
  93. if (timing == EffectTiming.OnEndAttack)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("Delete lowest DP Digimon", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => WDAndEoAActivateCoroutine(hashtable, activateClass), 1, true, EffectDiscription());
  98. activateClass.SetHashString("Delete_BT21_029");
  99. cardEffects.Add(activateClass);
  100. string EffectDiscription()
  101. => "[End of Attack] [Once Per Turn] You may delete 1 of your opponent's lowest DP Digimon.";
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  105. {
  106. if (CardEffectCommons.CanTriggerOnEndAttack(hashtable, card))
  107. {
  108. return true;
  109. }
  110. }
  111. return false;
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  116. {
  117. return true;
  118. }
  119. return false;
  120. }
  121. }
  122. #endregion
  123. #region All Turns Shared
  124. IEnumerator AllTurnsSharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPetrificationToken(activateClass));
  127. }
  128. #endregion
  129. #region All Turns - When Opponent Digimon Deleted
  130. if (timing == EffectTiming.OnDestroyedAnyone)
  131. {
  132. ActivateClass activateClass = new ActivateClass();
  133. activateClass.SetUpICardEffect("Play 1 [Petrification Token]", CanUseCondition, card);
  134. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => AllTurnsSharedActivateCoroutine(hashtable, activateClass), 1, false, EffectDiscription());
  135. activateClass.SetHashString("PlayToken_BT21_029");
  136. cardEffects.Add(activateClass);
  137. string EffectDiscription()
  138. {
  139. return "[All Turns] [Once Per Turn] When any of your opponent's Digimon are deleted, they play 1 [Petrification] Token";
  140. }
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  144. {
  145. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  146. {
  147. return true;
  148. }
  149. }
  150. return false;
  151. }
  152. bool CanActivateCondition(Hashtable hashtable)
  153. {
  154. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  155. {
  156. return true;
  157. }
  158. return false;
  159. }
  160. bool PermanentCondition(Permanent permanent)
  161. {
  162. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  163. {
  164. return true;
  165. }
  166. return false;
  167. }
  168. }
  169. #endregion
  170. #region All Turns - When Opponent Security Stack Removed
  171. if (timing == EffectTiming.OnLoseSecurity)
  172. {
  173. ActivateClass activateClass = new ActivateClass();
  174. activateClass.SetUpICardEffect("Play 1 [Petrification Token]", CanUseCondition, card);
  175. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => AllTurnsSharedActivateCoroutine(hashtable, activateClass), 1, false, EffectDiscription());
  176. activateClass.SetHashString("PlayToken_BT21_029");
  177. cardEffects.Add(activateClass);
  178. string EffectDiscription()
  179. {
  180. return "[All Turns] [Once Per Turn] When opponents security stack is removed from, they play 1 [Petrification] Token";
  181. }
  182. bool CanUseCondition(Hashtable hashtable)
  183. {
  184. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  185. {
  186. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, PlayerCondition))
  187. {
  188. return true;
  189. }
  190. }
  191. return false;
  192. }
  193. bool CanActivateCondition(Hashtable hashtable)
  194. {
  195. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  196. {
  197. return true;
  198. }
  199. return false;
  200. }
  201. bool PlayerCondition(Player player)
  202. {
  203. if (player == card.Owner.Enemy)
  204. {
  205. return true;
  206. }
  207. return false;
  208. }
  209. }
  210. #endregion
  211. return cardEffects;
  212. }
  213. }
  214. }