EX10_010.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. //Wargreymon ACE
  6. namespace DCGO.CardEffects.EX10
  7. {
  8. public class EX10_010 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Blast Digivolve
  14. if (timing == EffectTiming.OnCounterTiming)
  15. {
  16. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  17. }
  18. #endregion
  19. #region Static Effects
  20. //Raid
  21. if (timing == EffectTiming.OnAllyAttack)
  22. {
  23. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  24. }
  25. //Reboot/Blocker
  26. if (timing == EffectTiming.None)
  27. {
  28. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  29. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  30. }
  31. #endregion
  32. #region On Play/When Digivolving Shared
  33. string EffectDescription(string tag)
  34. {
  35. return $"[{tag}] Delete 1 of your opponent's play cost 7 or lower Digimon or Tamers.";
  36. }
  37. bool CanSelectPermanentCondition(Permanent permanent)
  38. {
  39. return (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) || CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaTamer(permanent, card))
  40. && permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 7;
  41. }
  42. bool CanActivateSharedCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleArea(card) &&
  45. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  46. }
  47. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  48. {
  49. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  50. {
  51. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanSelectPermanentCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: 1,
  58. canNoSelect: false,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: null,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Destroy,
  63. cardEffect: activateClass);
  64. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  65. }
  66. }
  67. #endregion
  68. #region On Play
  69. if (timing == EffectTiming.OnEnterFieldAnyone)
  70. {
  71. ActivateClass activateClass = new ActivateClass();
  72. activateClass.SetUpICardEffect("Delete 1 Digimon/Tamer", CanUseCondition, card);
  73. activateClass.SetUpActivateClass(CanActivateSharedCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, EffectDescription("On Play"));
  74. cardEffects.Add(activateClass);
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  78. }
  79. }
  80. #endregion
  81. #region When Digivolving
  82. if (timing == EffectTiming.OnEnterFieldAnyone)
  83. {
  84. ActivateClass activateClass = new ActivateClass();
  85. activateClass.SetUpICardEffect("Delete 1 Digimon/Tamer", CanUseCondition, card);
  86. activateClass.SetUpActivateClass(CanActivateSharedCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, EffectDescription("When Digivolving"));
  87. cardEffects.Add(activateClass);
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  91. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  92. }
  93. }
  94. #endregion
  95. #region All Turns
  96. #region All Turns - Immunity
  97. if (timing == EffectTiming.None)
  98. {
  99. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  100. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects", CanUseCondition, card);
  101. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  102. cardEffects.Add(canNotAffectedClass);
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  106. CardEffectCommons.HasMatchConditionPermanent(OpponentsPermanent);
  107. }
  108. bool CardCondition(CardSource cardSource)
  109. {
  110. if (cardSource == card)
  111. {
  112. if (CardEffectCommons.IsExistOnBattleArea(card))
  113. {
  114. if (cardSource == card.PermanentOfThisCard().TopCard)
  115. {
  116. return true;
  117. }
  118. }
  119. }
  120. return false;
  121. }
  122. bool SkillCondition(ICardEffect cardEffect)
  123. {
  124. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  125. {
  126. if (cardEffect.IsDigimonEffect)
  127. {
  128. return true;
  129. }
  130. }
  131. return false;
  132. }
  133. bool OpponentsPermanent(Permanent permanent)
  134. {
  135. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  136. card.PermanentOfThisCard().Boosts.Exists(x => x.ID == "AT_EX10-010");
  137. }
  138. }
  139. #endregion
  140. #region All Turns - DP
  141. if (timing == EffectTiming.OnRemovedField || timing == EffectTiming.OnEnterFieldAnyone || timing == EffectTiming.WhenTopCardTrashed)
  142. {
  143. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  144. {
  145. Permanent thisPermanent = card.PermanentOfThisCard();
  146. bool OpponentsPermanent(Permanent permanent)
  147. {
  148. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  149. permanent.DP >= 13000;
  150. }
  151. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  152. {
  153. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsPermanent))
  154. thisPermanent.AddBoost(new Permanent.DPBoost("AT_EX10-010", 3000, null));
  155. else
  156. {
  157. if (thisPermanent.Boosts.Exists(x => x.ID == "AT_EX10-010"))
  158. thisPermanent.RemoveBoost("AT_EX10-010");
  159. }
  160. }
  161. else
  162. {
  163. if (thisPermanent.Boosts.Exists(x => x.ID == "AT_EX10-010"))
  164. thisPermanent.RemoveBoost("AT_EX10-010");
  165. }
  166. }
  167. }
  168. #endregion
  169. #endregion
  170. return cardEffects;
  171. }
  172. }
  173. }