LM_016.cs 7.8 KB

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