EX6_032.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX6
  5. {
  6. public class EX6_032 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Kokomon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region On Play
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[On Play] You may suspend 1 Digimon.";
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  35. }
  36. bool PermanentCondition(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) || CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  39. {
  40. return true;
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. return true;
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  55. {
  56. new SelectionElement<bool>(message: $"Yes", value : true, spriteIndex: 0),
  57. new SelectionElement<bool>(message: $"No", value : false, spriteIndex: 1),
  58. };
  59. string selectPlayerMessage = "Will you suspend 1 Digimon?";
  60. string notSelectPlayerMessage = "The opponent is choosing whether or not to suspend a Digimon.";
  61. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  62. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  63. bool willSuspend = GManager.instance.userSelectionManager.SelectedBoolValue;
  64. if (willSuspend)
  65. {
  66. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  67. {
  68. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  69. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  70. selectPermanentEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: PermanentCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: maxCount,
  76. canNoSelect: false,
  77. canEndNotMax: false,
  78. selectPermanentCoroutine: null,
  79. afterSelectPermanentCoroutine: null,
  80. mode: SelectPermanentEffect.Mode.Tap,
  81. cardEffect: activateClass);
  82. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. }
  85. }
  86. }
  87. }
  88. #endregion
  89. #region Inherit
  90. if (timing == EffectTiming.OnAllyAttack)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  95. activateClass.SetIsInheritedEffect(true);
  96. activateClass.SetHashString("DP-2000_EX6_032");
  97. cardEffects.Add(activateClass);
  98. string EffectDiscription()
  99. {
  100. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  101. }
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  105. }
  106. bool CanSelectPermanentCondition(Permanent permanent)
  107. {
  108. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  117. {
  118. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  119. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  120. selectPermanentEffect.SetUp(
  121. selectPlayer: card.Owner,
  122. canTargetCondition: CanSelectPermanentCondition,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. maxCount: maxCount,
  126. canNoSelect: false,
  127. canEndNotMax: false,
  128. selectPermanentCoroutine: SelectPermanentCoroutine,
  129. afterSelectPermanentCoroutine: null,
  130. mode: SelectPermanentEffect.Mode.Custom,
  131. cardEffect: activateClass);
  132. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  133. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  134. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  135. {
  136. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  137. targetPermanent: permanent,
  138. changeValue: -2000,
  139. effectDuration: EffectDuration.UntilEachTurnEnd,
  140. activateClass: activateClass));
  141. }
  142. }
  143. }
  144. }
  145. #endregion
  146. return cardEffects;
  147. }
  148. }
  149. }