AD1_019.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Matt Ishida & T.K. Takaishi
  6. namespace DCGO.CardEffects.AD1
  7. {
  8. public class AD1_019 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Start of Your Main Phase
  14. if (timing == EffectTiming.OnStartMainPhase)
  15. {
  16. cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOpponentDigimonEffect(card));
  17. }
  18. #endregion
  19. #region Your Turn
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ();
  23. activateClass.SetUpICardEffect("By suspending this tamer, you may play 1[ADVENTURE] Digimon for -1 cost per 2 colors on your Tamers.", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  25. cardEffects.Add(activateClass);
  26. string EffectDescription()
  27. => "[Your Turn] When any of your Digimon digivolve into an [ADVENTURE] trait Digimon, by suspending this Tamer, you may play 1 [ADVENTURE] trait card from your hand. For every 2 of your Tamers' colors, reduce this effect's play cost by 1.";
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleArea(card)
  31. && CardEffectCommons.IsOwnerTurn(card)
  32. && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition);
  33. }
  34. bool PermanentCondition(Permanent permanent)
  35. {
  36. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  37. && permanent.TopCard.EqualsTraits("ADVENTURE");
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleArea(card)
  42. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  43. }
  44. bool IsAdventureDigimon(CardSource cardSource)
  45. {
  46. return cardSource.HasPlayCost
  47. && cardSource.EqualsTraits("ADVENTURE");
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SuspendPeremanentAndProcessAccordingToResult(
  52. new List<Permanent>() { card.PermanentOfThisCard() },
  53. activateClass,
  54. SuccessProcess,
  55. null));
  56. IEnumerator SuccessProcess(List<Permanent> suspendedPermaments)
  57. {
  58. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsAdventureDigimon))
  59. {
  60. List<CardSource> tamerCards = new List<CardSource>();
  61. foreach (Permanent permanent in card.Owner.GetBattleAreaPermanents())
  62. {
  63. if (permanent.IsTamer)
  64. {
  65. tamerCards.Add(permanent.TopCard);
  66. }
  67. }
  68. int reduceCost = Combinations.GetUniqueColorCardCount(tamerCards) / 2;
  69. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  70. selectHandEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: IsAdventureDigimon,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: 1,
  76. canNoSelect: true,
  77. canEndNotMax: false,
  78. isShowOpponent: true,
  79. selectCardCoroutine: null,
  80. afterSelectCardCoroutine: null,
  81. mode: SelectHandEffect.Mode.PlayForCost,
  82. cardEffect: activateClass);
  83. selectHandEffect.SetReducedCostTuple((reduceCost, null));
  84. selectHandEffect.SetUpCustomMessage("Select 1 card to play", "The opponent is selecting 1 card to play");
  85. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  86. }
  87. }
  88. }
  89. }
  90. #endregion
  91. #region Security
  92. if (timing == EffectTiming.SecuritySkill)
  93. {
  94. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  95. }
  96. #endregion
  97. return cardEffects;
  98. }
  99. }
  100. }