ST13_13.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 ST13_13 : 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 permanent)
  16. {
  17. return permanent == card.PermanentOfThisCard();
  18. }
  19. bool CardEffectCondition(ICardEffect cardEffect)
  20. {
  21. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  22. }
  23. bool CanUseCondition()
  24. {
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. if (CardEffectCommons.IsOpponentTurn(card))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. string effectName = "Can't be deleted by opponent's effects";
  35. cardEffects.Add(CardEffectFactory.CanNotBeDestroyedBySkillStaticEffect(
  36. permanentCondition: PermanentCondition,
  37. cardEffectCondition: CardEffectCondition,
  38. isInheritedEffect: false,
  39. card: card,
  40. condition: CanUseCondition,
  41. effectName: effectName
  42. ));
  43. }
  44. if (timing == EffectTiming.OnEndTurn)
  45. {
  46. ActivateClass activateClass = new ActivateClass();
  47. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  48. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  49. activateClass.SetIsInheritedEffect(true);
  50. cardEffects.Add(activateClass);
  51. string EffectDiscription()
  52. {
  53. return "[End of Your Turn] You may DNA digivolve this Digimon and one of your other Digimon in play into a Digimon card in your hand by paying its DNA digivolve cost.";
  54. }
  55. bool CanSelectCardCondition(CardSource cardSource)
  56. {
  57. if (cardSource != null)
  58. {
  59. if (cardSource.IsDigimon)
  60. {
  61. if (cardSource.Owner == card.Owner)
  62. {
  63. if (cardSource.CanPlayJogress(true))
  64. {
  65. if (isExistOnField(card))
  66. {
  67. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. if (isExistOnField(card))
  81. {
  82. return true;
  83. }
  84. return false;
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.IsExistOnBattleArea(card))
  89. {
  90. if (CardEffectCommons.IsOwnerTurn(card))
  91. {
  92. if (card.Owner.HandCards.Count >= 1)
  93. {
  94. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  95. {
  96. return true;
  97. }
  98. }
  99. }
  100. }
  101. return false;
  102. }
  103. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  104. {
  105. if (isExistOnField(card))
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(
  108. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  109. CanSelectCardCondition,
  110. payCost: true,
  111. isHand: true,
  112. activateClass,
  113. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() }
  114. ));
  115. }
  116. }
  117. }
  118. return cardEffects;
  119. }
  120. }