EX4_056.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_056 : 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.OnAllyAttack)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Digivolve this Digimon into [Ravemon]", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Attacking] If you have a purple Tamer in play, this Digimon may digivolve into [Ravemon] in your hand for the digivolution cost.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. return cardSource.CardNames.Contains("Ravemon");
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. if (card.Owner.HandCards.Count >= 1)
  34. {
  35. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardColors.Contains(CardColor.Purple) && permanent.IsTamer))
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. return false;
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  44. {
  45. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  46. targetPermanent: card.PermanentOfThisCard(),
  47. cardCondition: CanSelectCardCondition,
  48. payCost: true,
  49. reduceCostTuple: null,
  50. fixedCostTuple: null,
  51. ignoreDigivolutionRequirementFixedCost: -1,
  52. isHand: true,
  53. activateClass: activateClass,
  54. successProcess: null));
  55. }
  56. }
  57. if (timing == EffectTiming.OnDestroyedAnyone)
  58. {
  59. ActivateClass activateClass = new ActivateClass();
  60. activateClass.SetUpICardEffect("Delete 1 level 5 or lower Digimon", CanUseCondition, card);
  61. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  62. activateClass.SetIsInheritedEffect(true);
  63. cardEffects.Add(activateClass);
  64. string EffectDiscription()
  65. {
  66. return "[On Deletion] If deleted outside of a battle, delete 1 of your opponent's level 5 or lower Digimon.";
  67. }
  68. bool CanSelectPermanentCondition(Permanent permanent)
  69. {
  70. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  71. {
  72. if (permanent.Level <= 5)
  73. {
  74. if (permanent.TopCard.HasLevel)
  75. {
  76. return true;
  77. }
  78. }
  79. }
  80. return false;
  81. }
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  89. {
  90. if (!CardEffectCommons.IsByBattle(hashtable))
  91. {
  92. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  101. {
  102. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  103. {
  104. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  105. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  106. selectPermanentEffect.SetUp(
  107. selectPlayer: card.Owner,
  108. canTargetCondition: CanSelectPermanentCondition,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: null,
  111. maxCount: maxCount,
  112. canNoSelect: false,
  113. canEndNotMax: false,
  114. selectPermanentCoroutine: null,
  115. afterSelectPermanentCoroutine: null,
  116. mode: SelectPermanentEffect.Mode.Destroy,
  117. cardEffect: activateClass);
  118. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  119. }
  120. }
  121. }
  122. return cardEffects;
  123. }
  124. }
  125. }