Submarimon_BT8_023.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 Submarimon_BT8_023 : 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("Armadillomon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  22. {
  23. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  24. }
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Trash digivolution cards and DP -3000", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[When Digivolving] Trash the bottom digivolution card of 1 of your opponent's Digimon. Then, 1 of your opponent's Digimon with no digivolution cards gets -3000 DP for the turn.";
  34. }
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  38. {
  39. return true;
  40. }
  41. return false;
  42. }
  43. bool CanSelectPermanentCondition1(Permanent permanent)
  44. {
  45. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  46. {
  47. if (permanent.HasNoDigivolutionCards)
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. return true;
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (isExistOnField(card))
  69. {
  70. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  71. {
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  73. {
  74. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  75. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: CanSelectPermanentCondition,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: maxCount,
  82. canNoSelect: false,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: SelectPermanentCoroutine,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Custom,
  87. cardEffect: activateClass);
  88. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  89. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  90. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  91. {
  92. Permanent selectedPermanent = permanent;
  93. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 1, isFromTop: false, activateClass: activateClass));
  94. }
  95. }
  96. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  97. {
  98. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  99. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  100. selectPermanentEffect.SetUp(
  101. selectPlayer: card.Owner,
  102. canTargetCondition: CanSelectPermanentCondition1,
  103. canTargetCondition_ByPreSelecetedList: null,
  104. canEndSelectCondition: null,
  105. maxCount: maxCount,
  106. canNoSelect: false,
  107. canEndNotMax: false,
  108. selectPermanentCoroutine: SelectPermanentCoroutine,
  109. afterSelectPermanentCoroutine: null,
  110. mode: SelectPermanentEffect.Mode.Custom,
  111. cardEffect: activateClass);
  112. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -3000.");
  113. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  114. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  117. }
  118. }
  119. }
  120. }
  121. }
  122. }
  123. return cardEffects;
  124. }
  125. }