P_030.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 P_030 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("This Digimon digivolves into 1 [AncientGarurumon]", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] This Digimon can digivolve into an [AncientGarurumon] in your hand for a memory cost of 1, ignoring its digivolution requirements. If it does, delete this Digimon at the end of the turn.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. return cardSource.CardNames.Contains("AncientGarurumon");
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (card.Owner.HandCards.Count >= 1)
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. Permanent thisPermanent = card.PermanentOfThisCard();
  47. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  48. targetPermanent: card.PermanentOfThisCard(),
  49. cardCondition: CanSelectCardCondition,
  50. payCost: true,
  51. reduceCostTuple: null,
  52. fixedCostTuple: null,
  53. ignoreDigivolutionRequirementFixedCost: 1,
  54. isHand: true,
  55. activateClass: activateClass,
  56. successProcess: SuccessProcess()));
  57. IEnumerator SuccessProcess()
  58. {
  59. ActivateClass activateClass1 = new ActivateClass();
  60. activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition2, card);
  61. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, "");
  62. activateClass1.SetEffectSourcePermanent(thisPermanent);
  63. CardEffectCommons.AddEffectToPlayer(effectDuration: EffectDuration.UntilEachTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnEndTurn);
  64. bool CanUseCondition2(Hashtable hashtable)
  65. {
  66. return true;
  67. }
  68. bool CanActivateCondition1(Hashtable hashtable)
  69. {
  70. if (thisPermanent.TopCard != null)
  71. {
  72. if (thisPermanent.TopCard.IsDigimon)
  73. {
  74. if (thisPermanent.CanBeDestroyedBySkill(activateClass1))
  75. {
  76. if (!thisPermanent.TopCard.CanNotBeAffected(activateClass1))
  77. {
  78. return true;
  79. }
  80. }
  81. }
  82. }
  83. return false;
  84. }
  85. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { thisPermanent }, CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  88. }
  89. yield return null;
  90. }
  91. }
  92. }
  93. }
  94. if (timing == EffectTiming.None)
  95. {
  96. bool Condition()
  97. {
  98. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card);
  99. }
  100. bool PermanentCondition(Permanent targetPermanent)
  101. {
  102. return targetPermanent == card.PermanentOfThisCard();
  103. }
  104. bool CardSourceCondition(CardSource cardSource)
  105. {
  106. return cardSource.IsDigimon && cardSource.CardNames.Contains("AncientGarurumon") && cardSource.Owner.HandCards.Contains(cardSource);
  107. }
  108. bool RootCondition(SelectCardEffect.Root root)
  109. {
  110. return root == SelectCardEffect.Root.Hand;
  111. }
  112. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  113. changeValue: -2,
  114. permanentCondition: PermanentCondition,
  115. cardCondition: CardSourceCondition,
  116. rootCondition: RootCondition,
  117. isInheritedEffect: true,
  118. card: card,
  119. condition: Condition,
  120. setFixedCost: false));
  121. }
  122. return cardEffects;
  123. }
  124. }