EX4_018.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX4
  4. {
  5. public class EX4_018 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnEnterFieldAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Opponent's 1 Digimon gets effects", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Play] 1 of your opponent's Digimon with the lowest level gains \"[When Attacking] Lose 2 memory\" until the end of your opponent's turn.";
  19. }
  20. bool CanSelectPermanentCondition(Permanent permanent)
  21. {
  22. return CardEffectCommons.IsMinLevel(permanent, card.Owner.Enemy);
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnBattleArea(card))
  31. {
  32. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  40. {
  41. int maxCount = 1;
  42. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  43. selectPermanentEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: CanSelectPermanentCondition,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: maxCount,
  49. canNoSelect: false,
  50. canEndNotMax: false,
  51. selectPermanentCoroutine: SelectPermanentCoroutine,
  52. afterSelectPermanentCoroutine: null,
  53. mode: SelectPermanentEffect.Mode.Custom,
  54. cardEffect: activateClass);
  55. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  56. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  57. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  58. {
  59. Permanent selectedPermanent = permanent;
  60. CardSource topCard = selectedPermanent.TopCard;
  61. if (selectedPermanent != null)
  62. {
  63. ActivateClass activateClass1 = new ActivateClass();
  64. activateClass1.SetUpICardEffect("Memory -2", CanUseCondition1, selectedPermanent.TopCard);
  65. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  66. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  67. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  68. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  69. {
  70. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  71. }
  72. string EffectDiscription1()
  73. {
  74. return "[When Attacking] Lose 2 memory.";
  75. }
  76. bool CanUseCondition1(Hashtable hashtable1)
  77. {
  78. if (selectedPermanent.TopCard != null)
  79. {
  80. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  81. {
  82. if (GManager.instance.attackProcess.AttackingPermanent == selectedPermanent)
  83. {
  84. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  85. {
  86. return true;
  87. }
  88. }
  89. }
  90. }
  91. return false;
  92. }
  93. bool CanActivateCondition1(Hashtable hashtable1)
  94. {
  95. if (selectedPermanent.TopCard != null)
  96. {
  97. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  98. {
  99. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  100. {
  101. return true;
  102. }
  103. }
  104. }
  105. return false;
  106. }
  107. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  108. {
  109. if (topCard != null)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(topCard.Owner.AddMemory(-2, activateClass1));
  112. }
  113. }
  114. ICardEffect GetCardEffect(EffectTiming _timing)
  115. {
  116. if (_timing == EffectTiming.OnAllyAttack)
  117. {
  118. return activateClass1;
  119. }
  120. return null;
  121. }
  122. }
  123. }
  124. }
  125. }
  126. if (timing == EffectTiming.OnDestroyedAnyone)
  127. {
  128. cardEffects.Add(CardEffectFactory.SaveEffect(card: card));
  129. }
  130. if (timing == EffectTiming.None)
  131. {
  132. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  133. }
  134. return cardEffects;
  135. }
  136. }
  137. }