EX10_065.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Yukio Oikawa
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_065 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Your Turn
  13. if (timing == EffectTiming.OnStartTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  16. }
  17. #endregion
  18. #region All Turns
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. List<Permanent> playedPermanents = new List<Permanent>();
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Delete this tamer, give one of your played digimon Rush, then gain 1 memory", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[All Turns] When any of your Digimon with [Myotismon] in their names are played, by deleting this Tamer, 1 of those Digimon gains <Rush> for the turn. (This Digimon can attack the turn it comes into play.) Then, gain 1 memory.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.IsExistOnField(card) &&
  33. CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, CanTriggerCondition);
  34. }
  35. bool CanActivateCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.IsExistOnField(card);
  38. }
  39. bool CanTriggerCondition(Permanent permanent)
  40. {
  41. if (PermamentCondition(permanent))
  42. {
  43. playedPermanents.Add(permanent);
  44. return true;
  45. }
  46. return false;
  47. }
  48. bool PermamentCondition(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  51. && permanent.TopCard.ContainsCardName("Myotismon");
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable hashtable)
  54. {
  55. if (playedPermanents != null)
  56. {
  57. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  58. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  59. activateClass: activateClass,
  60. successProcess: SuccessProcess,
  61. failureProcess: null
  62. ));
  63. IEnumerator SuccessProcess(List<Permanent> permanents)
  64. {
  65. Permanent selectedPermanent = null;
  66. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(playedPermanents.Contains));
  67. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: playedPermanents.Contains,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: SelectPermanentCoroutine,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Custom,
  79. cardEffect: activateClass);
  80. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  81. {
  82. selectedPermanent = permanent;
  83. yield return null;
  84. }
  85. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain rush.", "The opponent is selecting 1 Digimon to gain rush.");
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  88. targetPermanent: selectedPermanent,
  89. effectDuration: EffectDuration.UntilEachTurnEnd,
  90. activateClass: activateClass));
  91. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  92. }
  93. }
  94. }
  95. }
  96. #endregion
  97. #region Security
  98. if (timing == EffectTiming.SecuritySkill)
  99. {
  100. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  101. }
  102. #endregion
  103. return cardEffects;
  104. }
  105. }
  106. }