EX5_014.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class EX5_014 : CEntity_Effect
  5. {
  6. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  7. {
  8. List<ICardEffect> cardEffects = new List<ICardEffect>();
  9. if (timing == EffectTiming.None)
  10. {
  11. static bool PermanentCondition(Permanent targetPermanent)
  12. {
  13. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5)
  14. {
  15. if (targetPermanent.TopCard.CardTraits.Contains("Light Fang"))
  16. {
  17. return true;
  18. }
  19. if (targetPermanent.TopCard.CardTraits.Contains("LightFung"))
  20. {
  21. return true;
  22. }
  23. if (targetPermanent.TopCard.CardTraits.Contains("Night Claw"))
  24. {
  25. return true;
  26. }
  27. if (targetPermanent.TopCard.CardTraits.Contains("NightClaw"))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  35. }
  36. if (timing == EffectTiming.OnEnterFieldAnyone)
  37. {
  38. cardEffects.Add(CardEffectFactory.BlitzSelfEffect(isInheritedEffect: false, card: card, condition: null, isWhenDigivolving: true));
  39. }
  40. if (timing == EffectTiming.None)
  41. {
  42. int count()
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. return card.PermanentOfThisCard().DigivolutionCards.Count / 3;
  47. }
  48. return 0;
  49. }
  50. bool Condition()
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (CardEffectCommons.IsOwnerTurn(card))
  55. {
  56. if (count() >= 1)
  57. {
  58. return true;
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect<Func<int>>(changeValue: () => count(), isInheritedEffect: false, card: card, condition: Condition));
  65. }
  66. if (timing == EffectTiming.OnLoseSecurity)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("Delete 1 Digimon with DP less than or equal to this Digimon's DP", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  71. activateClass.SetHashString("Delete_EX5_014");
  72. cardEffects.Add(activateClass);
  73. string EffectDiscription()
  74. {
  75. return "[Your Turn] [Once Per Turn] When a card is removed from your opponent's security stack, delete 1 of your opponent's Digimon with DP less than or equal to this Digimon's DP.";
  76. }
  77. bool CanSelectPermanentCondition(Permanent permanent)
  78. {
  79. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(card))
  82. {
  83. if (card.PermanentOfThisCard().HasDP)
  84. {
  85. if (permanent.TopCard.HasDP)
  86. {
  87. if (permanent.DP <= card.PermanentOfThisCard().DP)
  88. {
  89. return true;
  90. }
  91. }
  92. }
  93. }
  94. }
  95. return false;
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.IsExistOnBattleArea(card))
  100. {
  101. if (CardEffectCommons.IsOwnerTurn(card))
  102. {
  103. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner.Enemy))
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanActivateCondition(Hashtable hashtable)
  112. {
  113. if (CardEffectCommons.IsExistOnBattleArea(card))
  114. {
  115. return true;
  116. }
  117. return false;
  118. }
  119. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  120. {
  121. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  122. {
  123. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  124. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  125. selectPermanentEffect.SetUp(
  126. selectPlayer: card.Owner,
  127. canTargetCondition: CanSelectPermanentCondition,
  128. canTargetCondition_ByPreSelecetedList: null,
  129. canEndSelectCondition: null,
  130. maxCount: maxCount,
  131. canNoSelect: false,
  132. canEndNotMax: false,
  133. selectPermanentCoroutine: null,
  134. afterSelectPermanentCoroutine: null,
  135. mode: SelectPermanentEffect.Mode.Destroy,
  136. cardEffect: activateClass);
  137. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  138. }
  139. }
  140. }
  141. return cardEffects;
  142. }
  143. }