EX11_056.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Ryutaro Williams
  6. namespace DCGO.CardEffects.EX11
  7. {
  8. public class EX11_056 : 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 Turn
  14. if (timing == EffectTiming.OnStartTurn)
  15. {
  16. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  17. }
  18. #endregion
  19. #region Your turns
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Hatch and digivolve in breeding", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  25. cardEffects.Add(activateClass);
  26. string EffectDescription()
  27. {
  28. return "[All Turns] When any of your Digimon digivolve into a level 5 or higher Digimon with [Tyrannomon] in its name or the [Dinosaur] trait, by suspending this Tamer, you may hatch in your breeding area. After, 1 of your Digimon in the breeding area may digivolve into a Digimon card with [Tyrannomon] in its name or the [Reptile] or [Dinosaur] trait in the hand without paying the cost.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.IsExistOnBattleArea(card)
  33. && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition);
  34. }
  35. bool CanActivateCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.IsExistOnBattleArea(card)
  38. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  39. }
  40. bool PermanentCondition(Permanent permanent)
  41. {
  42. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  43. && permanent.TopCard.HasLevel
  44. && permanent.TopCard.Level >= 5
  45. && (permanent.TopCard.ContainsCardName("Tyrannomon")
  46. || permanent.TopCard.EqualsTraits("Dinosaur"));
  47. }
  48. bool DigivolveToCardCondition(CardSource cardSource)
  49. {
  50. return cardSource.IsDigimon
  51. && (cardSource.ContainsCardName("Tyrannomon")
  52. || cardSource.EqualsTraits("Dinosaur")
  53. || cardSource.EqualsTraits("Reptile"))
  54. && cardSource.CanPlayCardTargetFrame(
  55. frame: card.Owner.GetBreedingAreaPermanents()[0].PermanentFrame,
  56. PayCost: false,
  57. cardEffect: activateClass,
  58. root: SelectCardEffect.Root.Hand,
  59. isBreedingArea: true);
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable hashtable)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  64. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  65. if (card.Owner.CanHatch)
  66. {
  67. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  68. {
  69. new SelectionElement<bool>(message: $"Hatch", value : true, spriteIndex: 0),
  70. new SelectionElement<bool>(message: $"Not hatch", value : false, spriteIndex: 1),
  71. };
  72. string selectPlayerMessage = "Will you hatch in Breeding Area?";
  73. string notSelectPlayerMessage = "The opponent is selecting whether to hatch in Breeding Area.";
  74. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  75. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  76. bool doHatch = GManager.instance.userSelectionManager.SelectedBoolValue;
  77. if (doHatch)
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(new HatchDigiEggClass(player: card.Owner, hashtable: CardEffectCommons.CardEffectHashtable(activateClass)).Hatch());
  80. }
  81. }
  82. if (card.Owner.GetBreedingAreaPermanents().Count >= 1)
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  85. targetPermanent: card.Owner.GetBreedingAreaPermanents()[0],
  86. cardCondition: DigivolveToCardCondition,
  87. payCost: false,
  88. reduceCostTuple: null,
  89. fixedCostTuple: null,
  90. ignoreDigivolutionRequirementFixedCost: -1,
  91. isHand: true,
  92. activateClass: activateClass,
  93. successProcess: null));
  94. }
  95. }
  96. }
  97. #endregion
  98. #region Security
  99. if (timing == EffectTiming.SecuritySkill)
  100. {
  101. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  102. }
  103. #endregion
  104. return cardEffects;
  105. }
  106. }
  107. }