Gammamon_LM_016.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.LM
  4. {
  5. public class Gammamon_LM_016 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. //Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Gurimon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: true, card: card, condition: null));
  18. }
  19. #region All Turns
  20. if (timing == EffectTiming.OnDestroyedAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Digivolve from trash", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[All Turns] [Once Per Turn] When an effect deletes one of your other Digimon, this Digimon may digivolve into a Digimon card with [Gammamon] in its text in your trash without paying the cost.";
  29. }
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. if (cardSource.HasText("Gammamon"))
  33. {
  34. if (cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, true, activateClass))
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool PermanentCondition(Permanent permanent)
  42. {
  43. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  44. {
  45. if (permanent != card.PermanentOfThisCard())
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
  57. {
  58. if (CardEffectCommons.IsByEffect(hashtable, null))
  59. {
  60. return true;
  61. }
  62. }
  63. }
  64. return false;
  65. }
  66. bool CanActivateCondition(Hashtable hashtable)
  67. {
  68. return CardEffectCommons.IsExistOnBattleArea(card);
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  71. {
  72. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  73. {
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  75. targetPermanent: card.PermanentOfThisCard(),
  76. cardCondition: CanSelectCardCondition,
  77. payCost: false,
  78. reduceCostTuple: null,
  79. fixedCostTuple: null,
  80. ignoreDigivolutionRequirementFixedCost: -1,
  81. isHand: false,
  82. activateClass: activateClass,
  83. successProcess: null));
  84. }
  85. }
  86. }
  87. #endregion
  88. #region On Deletion - Inherited Effect
  89. if (timing == EffectTiming.OnDestroyedAnyone)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Play 1 [Hiro Amanokawa] from hand", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  94. activateClass.SetIsInheritedEffect(true);
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[On Deletion] You may play 1 [Hiro Amanokawa] from your hand without paying the cost.";
  99. }
  100. bool CanSelectCardCondition(CardSource cardSource)
  101. {
  102. if (cardSource.CardNames.Contains("Hiro Amanokawa") || cardSource.CardNames.Contains("HiroAmanokawa"))
  103. {
  104. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  114. }
  115. bool CanActivateCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.CanActivateOnDeletion(card))
  118. {
  119. if (card.Owner.HandCards.Count >= 1)
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  127. {
  128. List<CardSource> selectedCards = new List<CardSource>();
  129. int maxCount = 1;
  130. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  131. selectHandEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: CanSelectCardCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: maxCount,
  137. canNoSelect: true,
  138. canEndNotMax: false,
  139. isShowOpponent: true,
  140. selectCardCoroutine: SelectCardCoroutine,
  141. afterSelectCardCoroutine: null,
  142. mode: SelectHandEffect.Mode.Custom,
  143. cardEffect: activateClass);
  144. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  145. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  146. yield return StartCoroutine(selectHandEffect.Activate());
  147. IEnumerator SelectCardCoroutine(CardSource cardSource)
  148. {
  149. selectedCards.Add(cardSource);
  150. yield return null;
  151. }
  152. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  153. }
  154. }
  155. #endregion
  156. return cardEffects;
  157. }
  158. }
  159. }