EX5_030.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class EX5_030 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Liollmon") || targetPermanent.TopCard.CardNames.Contains("Elecmon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.None)
  22. {
  23. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  24. changeCardNamesClass.SetUpICardEffect("Also treated as having [Leomon] in its name", CanUseCondition, card);
  25. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  26. cardEffects.Add(changeCardNamesClass);
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return true;
  30. }
  31. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  32. {
  33. if (cardSource == card)
  34. {
  35. CardNames.Add("Leomon_EX5_030");
  36. }
  37. return CardNames;
  38. }
  39. }
  40. if (timing == EffectTiming.OnAllyAttack)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("This Digimon digivolves", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  45. cardEffects.Add(activateClass);
  46. string EffectDiscription()
  47. {
  48. return "[When Attacking] This Digimon may digivolve into a Digimon card with [Leomon] in its name in your hand with the digivolution cost reduced by 1.";
  49. }
  50. bool CanSelectCardCondition(CardSource cardSource)
  51. {
  52. return cardSource.IsDigimon && cardSource.ContainsCardName("Leomon");
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (card.Owner.HandCards.Count >= 1)
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  72. targetPermanent: card.PermanentOfThisCard(),
  73. cardCondition: CanSelectCardCondition,
  74. payCost: true,
  75. reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
  76. fixedCostTuple: null,
  77. ignoreDigivolutionRequirementFixedCost: -1,
  78. isHand: true,
  79. activateClass: activateClass,
  80. successProcess: null));
  81. }
  82. }
  83. if (timing == EffectTiming.OnDestroyedAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  88. activateClass.SetIsInheritedEffect(true);
  89. cardEffects.Add(activateClass);
  90. string EffectDiscription()
  91. {
  92. return "[On Deletion] 1 of your opponent's Digimon gets -2000 DP until the end of their turn.";
  93. }
  94. bool CanSelectPermanentCondition(Permanent permanent)
  95. {
  96. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  105. {
  106. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  107. {
  108. return true;
  109. }
  110. }
  111. return false;
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  114. {
  115. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  116. {
  117. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  118. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  119. selectPermanentEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: CanSelectPermanentCondition,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: maxCount,
  125. canNoSelect: false,
  126. canEndNotMax: false,
  127. selectPermanentCoroutine: SelectPermanentCoroutine,
  128. afterSelectPermanentCoroutine: null,
  129. mode: SelectPermanentEffect.Mode.Custom,
  130. cardEffect: activateClass);
  131. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  136. targetPermanent: permanent,
  137. changeValue: -2000,
  138. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  139. activateClass: activateClass));
  140. }
  141. }
  142. }
  143. }
  144. return cardEffects;
  145. }
  146. }