BT16_101.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_101 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Armor Purge
  12. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  13. {
  14. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  15. }
  16. #endregion
  17. #region Digivolution Condition
  18. if (timing == EffectTiming.None)
  19. {
  20. bool PermanentCondition(Permanent targetPermanent)
  21. {
  22. return targetPermanent.TopCard.CardNames.Contains("Rapidmon");
  23. }
  24. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  25. permanentCondition: PermanentCondition,
  26. digivolutionCost: 4,
  27. ignoreDigivolutionRequirement: true,
  28. card: card,
  29. condition: null));
  30. }
  31. #endregion
  32. #region When Digivolving
  33. if (timing == EffectTiming.OnEnterFieldAnyone)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("Suspend all opponent's Digimon and attack.", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[When Digivolving] Suspend all of your opponent's Digimon. Then, this Digimon may attack.";
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. return true;
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. List<Permanent> tappedPermanents = new List<Permanent>();
  58. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  59. {
  60. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  61. {
  62. tappedPermanents.Add(permanent);
  63. }
  64. }
  65. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(tappedPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  66. if (CardEffectCommons.IsExistOnBattleArea(card))
  67. {
  68. if (card.PermanentOfThisCard().CanAttack(activateClass))
  69. {
  70. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  71. selectAttackEffect.SetUp(
  72. attacker: card.PermanentOfThisCard(),
  73. canAttackPlayerCondition: () => true,
  74. defenderCondition: (permanent) => true,
  75. cardEffect: activateClass);
  76. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  77. }
  78. }
  79. }
  80. }
  81. #endregion
  82. #region All Turns - Once Per Turn
  83. if (timing == EffectTiming.OnDestroyedAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("Memory +2", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  88. activateClass.SetIsInheritedEffect(false);
  89. activateClass.SetHashString("Memory+2_BT16_101");
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[All Turns][Once Per Turn] When an opponent's Digimon is deleted in battle or by dropping to 0 DP, gain 2 memory.";
  94. }
  95. bool PermanentCondition(Permanent permanent)
  96. {
  97. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  104. {
  105. if (!CardEffectCommons.IsByEffect(hashtable, null))
  106. {
  107. return true;
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.IsExistOnBattleArea(card))
  116. {
  117. return true;
  118. }
  119. return false;
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  122. {
  123. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  124. }
  125. }
  126. if (timing == EffectTiming.OnEndBattle)
  127. {
  128. ActivateClass activateClass = new ActivateClass();
  129. activateClass.SetUpICardEffect("Memory +2", CanUseCondition, card);
  130. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  131. activateClass.SetIsInheritedEffect(false);
  132. activateClass.SetHashString("Memory+2_BT16_101");
  133. cardEffects.Add(activateClass);
  134. string EffectDiscription()
  135. {
  136. return "[All Turns][Once Per Turn] When an opponent's Digimon is deleted in battle or by dropping to 0 DP, gain 2 memory.";
  137. }
  138. bool PermanentCondition(Permanent permanent)
  139. {
  140. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  141. }
  142. bool CanUseCondition(Hashtable hashtable)
  143. {
  144. if (CardEffectCommons.IsExistOnBattleArea(card))
  145. {
  146. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  147. {
  148. bool WinnerCondition(Permanent permanent) => CardEffectCommons.IsOwnerPermanent(permanent, card);
  149. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  150. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: true))
  151. {
  152. return true;
  153. }
  154. }
  155. }
  156. return false;
  157. }
  158. bool CanActivateCondition(Hashtable hashtable)
  159. {
  160. if (CardEffectCommons.IsExistOnBattleArea(card))
  161. {
  162. return true;
  163. }
  164. return false;
  165. }
  166. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  167. {
  168. if (CardEffectCommons.IsExistOnBattleArea(card))
  169. {
  170. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  171. }
  172. }
  173. }
  174. #endregion
  175. #region All Turns
  176. if (timing == EffectTiming.None)
  177. {
  178. bool PermanentCondition(Permanent permanent)
  179. {
  180. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  181. {
  182. if (permanent.IsDigimon)
  183. {
  184. if (permanent.IsSuspended)
  185. {
  186. return true;
  187. }
  188. }
  189. }
  190. return false;
  191. }
  192. bool CanUseCondition()
  193. {
  194. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Rapidmon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  195. {
  196. if (CardEffectCommons.IsExistOnBattleArea(card))
  197. {
  198. return true;
  199. }
  200. }
  201. return false;
  202. }
  203. string effectName()
  204. {
  205. return "All opponent's suspended Digimon get -4000 DP.";
  206. }
  207. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  208. permanentCondition: PermanentCondition,
  209. changeValue: -4000,
  210. isInheritedEffect: false,
  211. card: card, condition: CanUseCondition,
  212. effectName: effectName));
  213. }
  214. #endregion
  215. return cardEffects;
  216. }
  217. }
  218. }