BT13_079.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_079 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Your 1 Digimon gains Retaliation", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] 1 of your purple Digimon gains <Retaliation> until the end of your opponent's turn.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent.TopCard.CardColors.Contains(CardColor.Purple))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. if (isExistOnField(card))
  50. {
  51. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  54. {
  55. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectPermanentCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: maxCount,
  63. canNoSelect: false,
  64. canEndNotMax: false,
  65. selectPermanentCoroutine: SelectPermanentCoroutine,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.Custom,
  68. cardEffect: activateClass);
  69. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Retaliation.", "The opponent is selecting 1 Digimon that will get Retaliation.");
  70. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  71. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRetaliation(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. if (timing == EffectTiming.OnDestroyedAnyone)
  81. {
  82. ActivateClass activateClass = new ActivateClass();
  83. activateClass.SetUpICardEffect("Opponent trashes 1 card from hand", CanUseCondition, card);
  84. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  85. activateClass.SetIsInheritedEffect(true);
  86. cardEffects.Add(activateClass);
  87. string EffectDiscription()
  88. {
  89. return "[On Deletion] If deleted outside of a battle, your opponent trashes 1 card in their hand.";
  90. }
  91. bool CanUseCondition(Hashtable hashtable)
  92. {
  93. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  94. }
  95. bool CanActivateCondition(Hashtable hashtable)
  96. {
  97. if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
  98. {
  99. if (!CardEffectCommons.IsByBattle(hashtable))
  100. {
  101. if (card.Owner.Enemy.HandCards.Count >= 1)
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. return false;
  108. }
  109. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  110. {
  111. if (card.Owner.Enemy.HandCards.Count >= 1)
  112. {
  113. int discardCount = Math.Min(1, card.Owner.HandCards.Count);
  114. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  115. selectHandEffect.SetUp(
  116. selectPlayer: card.Owner.Enemy,
  117. canTargetCondition: (cardSource) => true,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: discardCount,
  121. canNoSelect: false,
  122. canEndNotMax: false,
  123. isShowOpponent: true,
  124. selectCardCoroutine: null,
  125. afterSelectCardCoroutine: null,
  126. mode: SelectHandEffect.Mode.Discard,
  127. cardEffect: activateClass);
  128. yield return StartCoroutine(selectHandEffect.Activate());
  129. }
  130. }
  131. }
  132. return cardEffects;
  133. }
  134. }
  135. }