EX12_061.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Hanimon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_061 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("Shambala");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 0,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null,
  24. level: 2)
  25. );
  26. }
  27. #endregion
  28. #region On Play
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("By trashing 1 [Puppet]/[TB] card, <Draw 2>", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  34. cardEffects.Add(activateClass);
  35. string EffectDescription()
  36. {
  37. return "[On Play] By trashing 1 card with the [Puppet] or [TB] trait from your hand, <Draw 2>.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  42. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  47. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  48. }
  49. bool CanSelectCardCondition(CardSource cardSource)
  50. {
  51. return cardSource.EqualsTraits("Puppet")
  52. || cardSource.EqualsTraits("TB");
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  55. {
  56. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  57. selectHandEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectCardCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: 1,
  63. canNoSelect: true,
  64. canEndNotMax: false,
  65. isShowOpponent: true,
  66. selectCardCoroutine: null,
  67. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  68. mode: SelectHandEffect.Mode.Discard,
  69. cardEffect: activateClass);
  70. selectHandEffect.SetUpCustomMessage("Select 1 card to trash.", "The opponent is selecting 1 card to trash from their hand.");
  71. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  72. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  73. {
  74. if (cardSources.Count >= 1)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  77. }
  78. }
  79. }
  80. }
  81. #endregion
  82. #region Inherited
  83. if (timing == EffectTiming.OnAllyAttack)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("<Draw 1> and trash 1>", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  88. activateClass.SetHashString("EX12_061_Inherited");
  89. activateClass.SetIsInheritedEffect(true);
  90. cardEffects.Add(activateClass);
  91. string EffectDescription()
  92. {
  93. return "[When Attacking] [Once Per Turn] <Draw 1> and trash 1 card in your hand.";
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  98. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  99. }
  100. bool CanActivateCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass);
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable hashtable)
  105. {
  106. if (card.Owner.LibraryCards.Count >= 1)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  109. }
  110. if (card.Owner.HandCards.Count >= 1)
  111. {
  112. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  113. selectHandEffect.SetUp(
  114. selectPlayer: card.Owner,
  115. canTargetCondition: (cardSource) => true,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. maxCount: 1,
  119. canNoSelect: false,
  120. canEndNotMax: false,
  121. isShowOpponent: true,
  122. selectCardCoroutine: null,
  123. afterSelectCardCoroutine: null,
  124. mode: SelectHandEffect.Mode.Discard,
  125. cardEffect: activateClass);
  126. yield return StartCoroutine(selectHandEffect.Activate());
  127. }
  128. }
  129. }
  130. #endregion
  131. return cardEffects;
  132. }
  133. }
  134. }