BT15_068.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT15
  4. {
  5. public class BT15_068 : 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 gains effects", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Play] Until the end of your opponent's turn, 1 of your opponent's Digimon gains \"[On Deletion] Lose 1 memory.\"";
  19. }
  20. bool CanSelectPermanentCondition(Permanent permanent)
  21. {
  22. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  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. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  42. {
  43. int maxCount = 1;
  44. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  45. selectPermanentEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: CanSelectPermanentCondition,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. maxCount: maxCount,
  51. canNoSelect: false,
  52. canEndNotMax: false,
  53. selectPermanentCoroutine: SelectPermanentCoroutine,
  54. afterSelectPermanentCoroutine: null,
  55. mode: SelectPermanentEffect.Mode.Custom,
  56. cardEffect: activateClass);
  57. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  58. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  59. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  60. {
  61. Permanent selectedPermanent = permanent;
  62. if (selectedPermanent != null)
  63. {
  64. CardSource _topCard = selectedPermanent.TopCard;
  65. ActivateClass activateClass1 = new ActivateClass();
  66. activateClass1.SetUpICardEffect("Memory -1", CanUseCondition1, selectedPermanent.TopCard);
  67. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  68. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  69. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
  70. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  73. }
  74. string EffectDiscription1()
  75. {
  76. return "[On Deletion] Lose 1 memory.";
  77. }
  78. bool CanUseCondition1(Hashtable hashtable1)
  79. {
  80. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  81. {
  82. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable1, (permanent) => permanent == selectedPermanent, activateClass))
  83. {
  84. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  85. {
  86. return true;
  87. }
  88. }
  89. }
  90. return false;
  91. }
  92. bool CanActivateCondition1(Hashtable hashtable1)
  93. {
  94. if (CardEffectCommons.IsTopCardInTrashOnDeletion(hashtable1))
  95. {
  96. return true;
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(_topCard.Owner.AddMemory(-1, activateClass1));
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }
  109. if (timing == EffectTiming.OnEnterFieldAnyone)
  110. {
  111. ActivateClass activateClass = new ActivateClass();
  112. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  113. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  114. activateClass.SetHashString("Memory1_BT15_068");
  115. activateClass.SetIsInheritedEffect(true);
  116. cardEffects.Add(activateClass);
  117. string EffectDiscription()
  118. {
  119. return "[All Turns] [Once Per Turn] When an effect plays an opponent's Digimon, gain 1 memory.";
  120. }
  121. bool PermanentCondition(Permanent permanent)
  122. {
  123. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. if (CardEffectCommons.IsExistOnBattleArea(card))
  128. {
  129. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  130. {
  131. if (CardEffectCommons.IsByEffect(hashtable, null))
  132. {
  133. return true;
  134. }
  135. }
  136. }
  137. return false;
  138. }
  139. bool CanActivateCondition(Hashtable hashtable)
  140. {
  141. if (CardEffectCommons.IsExistOnBattleArea(card))
  142. {
  143. return true;
  144. }
  145. return false;
  146. }
  147. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  148. {
  149. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  150. }
  151. }
  152. return cardEffects;
  153. }
  154. }
  155. }