RB1_008.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.RB1
  5. {
  6. public class RB1_008 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Gammamon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnAllyAttack)
  20. {
  21. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  22. }
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Play 1 [Hiro Amanokawa] from hand", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[When Digivolving] If you don't have a [Hiro Amanokawa] in play, you may play one from your hand without paying its memory cost.";
  32. }
  33. bool CanSelectCardCondition(CardSource cardSource)
  34. {
  35. if (cardSource.CardNames.Contains("Hiro Amanokawa") || cardSource.CardNames.Contains("HiroAmanokawa"))
  36. {
  37. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (card.Owner.HandCards.Count >= 1)
  53. {
  54. if (card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.TopCard.CardNames.Contains("Hiro Amanokawa") || permanent.TopCard.CardNames.Contains("HiroAmanokawa")) == 0)
  55. {
  56. return true;
  57. }
  58. }
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. List<CardSource> selectedCards = new List<CardSource>();
  65. int maxCount = 1;
  66. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  67. selectHandEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectCardCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: true,
  74. canEndNotMax: false,
  75. isShowOpponent: true,
  76. selectCardCoroutine: SelectCardCoroutine,
  77. afterSelectCardCoroutine: null,
  78. mode: SelectHandEffect.Mode.Custom,
  79. cardEffect: activateClass);
  80. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  81. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  82. yield return StartCoroutine(selectHandEffect.Activate());
  83. IEnumerator SelectCardCoroutine(CardSource cardSource)
  84. {
  85. selectedCards.Add(cardSource);
  86. yield return null;
  87. }
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  89. }
  90. }
  91. return cardEffects;
  92. }
  93. }
  94. }