BT11_076.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_076 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return (targetPermanent.TopCard.CardTraits.Contains("Xros Heart") || targetPermanent.TopCard.CardTraits.Contains("XrosHeart")) && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 2;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnAllyAttack)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Delete your 1 Digimon and delete 1 unsuspended Digimon", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[When Attacking] By deleting 1 of your other Digimon, delete 1 of your opponent's unsuspended Digimon with a level less than or equal to the deleted Digimon's level.";
  28. }
  29. bool CanSelectPermanentCondition(Permanent permanent)
  30. {
  31. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  32. {
  33. if (permanent != card.PermanentOfThisCard())
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  58. {
  59. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  60. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  61. selectPermanentEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: CanSelectPermanentCondition,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: maxCount,
  67. canNoSelect: true,
  68. canEndNotMax: false,
  69. selectPermanentCoroutine: SelectPermanentCoroutine,
  70. afterSelectPermanentCoroutine: null,
  71. mode: SelectPermanentEffect.Mode.Custom,
  72. cardEffect: activateClass);
  73. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  76. {
  77. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  78. IEnumerator SuccessProcess()
  79. {
  80. bool CanSelectPermanentCondition1(Permanent permanent1)
  81. {
  82. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent1, card))
  83. {
  84. if (permanent.LevelJustBeforeRemoveField > 0)
  85. {
  86. if (permanent1.Level <= permanent.LevelJustBeforeRemoveField)
  87. {
  88. if (permanent1.TopCard.HasLevel)
  89. {
  90. if (!permanent1.IsSuspended)
  91. {
  92. return true;
  93. }
  94. }
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  101. {
  102. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  103. selectPermanentEffect.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectPermanentCondition1,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: maxCount,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: null,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.Destroy,
  114. cardEffect: activateClass);
  115. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  116. }
  117. }
  118. }
  119. }
  120. }
  121. }
  122. if (timing == EffectTiming.OnEnterFieldAnyone)
  123. {
  124. ActivateClass activateClass = new ActivateClass();
  125. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  126. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  127. activateClass.SetIsInheritedEffect(true);
  128. activateClass.SetHashString("Memory+1_BT11_076");
  129. cardEffects.Add(activateClass);
  130. string EffectDiscription()
  131. {
  132. return "[All Turns][Once Per Turn] When you play a Digimon by an effect, gain 1 memory.";
  133. }
  134. bool PermanentCondition(Permanent permanent)
  135. {
  136. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  137. }
  138. bool CanUseCondition(Hashtable hashtable)
  139. {
  140. if (CardEffectCommons.IsExistOnBattleArea(card))
  141. {
  142. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  143. {
  144. if (CardEffectCommons.IsByEffect(hashtable, null))
  145. {
  146. return true;
  147. }
  148. }
  149. }
  150. return false;
  151. }
  152. bool CanActivateCondition(Hashtable hashtable)
  153. {
  154. if (CardEffectCommons.IsExistOnBattleArea(card))
  155. {
  156. return true;
  157. }
  158. return false;
  159. }
  160. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  161. {
  162. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  163. }
  164. }
  165. return cardEffects;
  166. }
  167. }
  168. }