BT17_063.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT17
  4. {
  5. public class BT17_063 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsCardName("HippoGryphonmon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false,
  19. card: card, condition: null));
  20. }
  21. #endregion
  22. #region Retaliation
  23. if (timing == EffectTiming.OnDestroyedAnyone)
  24. {
  25. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region When Digivolving
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Draw 1 and Trash 1, then digivolve into [Murmukusmon]", CanUseCondition,
  33. card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  35. cardEffects.Add(activateClass);
  36. string EffectDescription()
  37. {
  38. return
  39. "[When Digivolving] <Draw 1> and trash 1 card in your hand. Then, if [HippoGryphonmon] is in this Digimon's digivolution cards, this Digimon may digivolve into [Murmukusmon] in the hand for a digivolution cost of 2, ignoring its digivolution requirements.";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  44. }
  45. bool IsHippoGryphonmonCardCondition(CardSource cardSource)
  46. {
  47. return cardSource.IsDigimon &&
  48. cardSource.EqualsCardName("HippoGryphonmon");
  49. }
  50. bool IsMurmukusmonCardCondition(CardSource cardSource)
  51. {
  52. return cardSource.IsDigimon &&
  53. cardSource.EqualsCardName("Murmukusmon");
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.IsExistOnBattleArea(card) &&
  58. (card.Owner.LibraryCards.Count >= 1 ||
  59. card.Owner.HandCards.Count >= 1 ||
  60. (card.PermanentOfThisCard().DigivolutionCards.Some(IsHippoGryphonmonCardCondition) &&
  61. card.Owner.HandCards.Some(IsMurmukusmonCardCondition)));
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable hashtable)
  64. {
  65. if (card.Owner.LibraryCards.Count >= 1)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(
  68. new DrawClass(card.Owner, 1, activateClass).Draw());
  69. }
  70. if (card.Owner.HandCards.Count >= 1)
  71. {
  72. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  73. selectHandEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: _ => true,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: 1,
  79. canNoSelect: true,
  80. canEndNotMax: false,
  81. isShowOpponent: true,
  82. selectCardCoroutine: null,
  83. afterSelectCardCoroutine: null,
  84. mode: SelectHandEffect.Mode.Discard,
  85. cardEffect: activateClass);
  86. yield return StartCoroutine(selectHandEffect.Activate());
  87. }
  88. if (card.PermanentOfThisCard().DigivolutionCards.Some(IsHippoGryphonmonCardCondition) &&
  89. card.Owner.HandCards.Some(IsMurmukusmonCardCondition))
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(
  92. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  93. targetPermanent: card.PermanentOfThisCard(),
  94. cardCondition: IsMurmukusmonCardCondition,
  95. payCost: true,
  96. reduceCostTuple: null,
  97. fixedCostTuple: null,
  98. ignoreDigivolutionRequirementFixedCost: 2,
  99. isHand: true,
  100. activateClass: activateClass,
  101. successProcess: null));
  102. }
  103. }
  104. }
  105. #endregion
  106. #region Retaliation - ESS
  107. if (timing == EffectTiming.OnDestroyedAnyone)
  108. {
  109. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  110. }
  111. #endregion
  112. return cardEffects;
  113. }
  114. }
  115. }