P_092.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. using System.Net.Security;
  9. public class P_092 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.CardNames.Contains("Bebydomon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("This Digimon digivolves into [Wingdramon]", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[Your Turn] When you play a [Groundramon], this Digimon may digivolve into a [Wingdramon] from your hand for a cost of 3, ignoring its digivolution requirements.";
  31. }
  32. bool CanSelectCardCondition(CardSource cardSource)
  33. {
  34. return cardSource.CardNames.Contains("Wingdramon");
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (CardEffectCommons.IsOwnerTurn(card))
  41. {
  42. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, (permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && permanent.TopCard.CardNames.Contains("Groundramon")))
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (card.Owner.HandCards.Count >= 1)
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  64. targetPermanent: card.PermanentOfThisCard(),
  65. cardCondition: CanSelectCardCondition,
  66. payCost: true,
  67. reduceCostTuple: null,
  68. fixedCostTuple: null,
  69. ignoreDigivolutionRequirementFixedCost: 3,
  70. isHand: true,
  71. activateClass: activateClass,
  72. successProcess: null));
  73. }
  74. }
  75. if (timing == EffectTiming.OnEnterFieldAnyone)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("This Digimon digivolves into [Wingdramon]", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  80. activateClass.SetIsInheritedEffect(true);
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[Your Turn] When you play a [Groundramon], this Digimon may digivolve into a [Wingdramon] from your hand without paying its cost.";
  85. }
  86. bool CanSelectCardCondition(CardSource cardSource)
  87. {
  88. return cardSource.CardNames.Contains("Wingdramon");
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. if (CardEffectCommons.IsExistOnBattleArea(card))
  93. {
  94. if (CardEffectCommons.IsOwnerTurn(card))
  95. {
  96. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, (permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && permanent.TopCard.CardNames.Contains("Groundramon")))
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. return false;
  103. }
  104. bool CanActivateCondition(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.IsExistOnBattleArea(card))
  107. {
  108. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  116. {
  117. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  118. targetPermanent: card.PermanentOfThisCard(),
  119. cardCondition: CanSelectCardCondition,
  120. payCost: false,
  121. reduceCostTuple: null,
  122. fixedCostTuple: null,
  123. ignoreDigivolutionRequirementFixedCost: -1,
  124. isHand: true,
  125. activateClass: activateClass,
  126. successProcess: null));
  127. }
  128. }
  129. return cardEffects;
  130. }
  131. }