EX6_072.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using Photon.Pun;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using UnityEngine;
  7. namespace DCGO.CardEffects.EX6
  8. {
  9. public class EX6_072 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. #region Ignore Color Condition
  15. if (timing == EffectTiming.None)
  16. {
  17. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  18. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  19. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  20. cardEffects.Add(ignoreColorConditionClass);
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. if (card.Owner.Enemy.GetBattleAreaDigimons().Count((permanent) => permanent.TopCard.HasLevel && permanent.TopCard.Level >= 6) >= 1)
  24. {
  25. return true;
  26. }
  27. return false;
  28. }
  29. bool CardCondition(CardSource cardSource)
  30. {
  31. if (cardSource == card)
  32. {
  33. return true;
  34. }
  35. return false;
  36. }
  37. }
  38. #endregion
  39. #region Main
  40. if (timing == EffectTiming.OptionSkill)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("DNA Digivolve", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  45. cardEffects.Add(activateClass);
  46. string EffectDescription() => "[Main] 1 of your level 6 Digimon and 1 card in the hand may DNA digivolve into a level 7 Digimon card in the hand.";
  47. bool IsLevel7Card(CardSource cardSource)
  48. {
  49. return cardSource.IsDigimon
  50. && cardSource.HasLevel
  51. && cardSource.Level == 7;
  52. }
  53. bool IsCardInHand(CardSource cardSource)
  54. {
  55. return true;
  56. }
  57. bool IsLevel6Permanent(Permanent permanent)
  58. {
  59. return permanent.IsDigimon
  60. && permanent.TopCard.IsLevel6;
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DNADigivolveWithHandOrTrashCardIntoHandOrTrash(
  69. IsLevel7Card,
  70. IsLevel6Permanent,
  71. IsCardInHand,
  72. true,
  73. true,
  74. true,
  75. activateClass,
  76. null
  77. ));
  78. }
  79. }
  80. #endregion
  81. #region Security
  82. if(timing == EffectTiming.SecuritySkill)
  83. {
  84. ActivateClass activateClass = new ActivateClass();
  85. activateClass.SetUpICardEffect("Return 1 Digimon from trash to hand then add this card to hand", CanUseCondition, card);
  86. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  87. cardEffects.Add(activateClass);
  88. string EffectDiscription()
  89. {
  90. return "[Security] Return 1 level 6 or higher Digimon card from your trash to the hand. Then, add this card to the hand.";
  91. }
  92. bool CanSelectCardCondition(CardSource cardSource)
  93. {
  94. if (cardSource.IsDigimon)
  95. {
  96. if (cardSource.HasLevel && cardSource.Level >= 6)
  97. {
  98. return true;
  99. }
  100. }
  101. return false;
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  106. }
  107. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  108. {
  109. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  110. {
  111. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  112. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  113. selectCardEffect.SetUp(
  114. canTargetCondition: CanSelectCardCondition,
  115. canTargetCondition_ByPreSelecetedList: null,
  116. canEndSelectCondition: null,
  117. canNoSelect: () => false,
  118. selectCardCoroutine: null,
  119. afterSelectCardCoroutine: null,
  120. message: "Select 1 Digimon to add to your hand.",
  121. maxCount: maxCount,
  122. canEndNotMax: false,
  123. isShowOpponent: true,
  124. mode: SelectCardEffect.Mode.AddHand,
  125. root: SelectCardEffect.Root.Trash,
  126. customRootCardList: null,
  127. canLookReverseCard: true,
  128. selectPlayer: card.Owner,
  129. cardEffect: activateClass);
  130. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  131. }
  132. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  133. }
  134. }
  135. #endregion
  136. return cardEffects;
  137. }
  138. }
  139. }