BT11_093.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT11
  4. {
  5. public class BT11_093 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnStartTurn)
  11. {
  12. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  13. }
  14. if (timing == EffectTiming.OnEnterFieldAnyone)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("The digivolved Digimon gets DP +2000 and effects", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Your Turn] When one of your Digimon digivolves into a Digimon with [Greymon] in its name, by suspending this Tamer, that Digimon gets +2000 DP until the end of your opponent's turn. If it digivolved into a Digimon with the same level, that Digimon isn't affected by your opponent's Option cards until the end of your opponent's turn.";
  23. }
  24. bool PermanentCondition(Permanent permanent)
  25. {
  26. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  27. {
  28. if (permanent.TopCard.HasGreymonName)
  29. {
  30. return true;
  31. }
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. if (CardEffectCommons.IsExistOnBattleArea(card))
  38. {
  39. if (CardEffectCommons.IsOwnerTurn(card))
  40. {
  41. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. if (CardEffectCommons.IsExistOnBattleArea(card))
  52. {
  53. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  63. List<Permanent> permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(
  64. hashtable: _hashtable,
  65. rootCondition: null);
  66. if (permanents != null)
  67. {
  68. foreach (Permanent selectedPermanent in permanents)
  69. {
  70. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: selectedPermanent, changeValue: 2000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  73. if (CardEffectCommons.IsDigivolvedFromSameLevelFromEnterFieldHashtable(_hashtable, selectedPermanent))
  74. {
  75. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  76. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's option", CanUseCondition1, card);
  77. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  78. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotAffectedClass);
  79. bool CanUseCondition1(Hashtable hashtable)
  80. {
  81. if (selectedPermanent.TopCard != null)
  82. {
  83. return true;
  84. }
  85. return false;
  86. }
  87. bool CardCondition(CardSource cardSource)
  88. {
  89. if (selectedPermanent.TopCard != null)
  90. {
  91. if (selectedPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(selectedPermanent))
  92. {
  93. if (cardSource == selectedPermanent.TopCard)
  94. {
  95. return true;
  96. }
  97. }
  98. }
  99. return false;
  100. }
  101. bool SkillCondition(ICardEffect cardEffect)
  102. {
  103. if (cardEffect != null)
  104. {
  105. if (cardEffect.EffectSourceCard != null)
  106. {
  107. if (cardEffect.EffectSourceCard.Owner == card.Owner.Enemy)
  108. {
  109. if (cardEffect.EffectSourceCard.IsOption)
  110. {
  111. return true;
  112. }
  113. }
  114. }
  115. }
  116. return false;
  117. }
  118. }
  119. }
  120. }
  121. }
  122. }
  123. }
  124. if (timing == EffectTiming.SecuritySkill)
  125. {
  126. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  127. }
  128. return cardEffects;
  129. }
  130. }
  131. }