BT16_018.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class BT16_018 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. var cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Veemon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 2,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. #endregion
  26. #region Inherited Effect
  27. if (timing == EffectTiming.None)
  28. {
  29. bool InheritedEffectCondition()
  30. {
  31. return CardEffectCommons.IsOwnerTurn(card);
  32. }
  33. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  34. changeValue: 2000,
  35. isInheritedEffect: true,
  36. card: card,
  37. condition: InheritedEffectCondition));
  38. }
  39. #endregion
  40. #region Raid
  41. if (timing == EffectTiming.OnAllyAttack)
  42. {
  43. cardEffects.Add(CardEffectFactory.RaidSelfEffect(
  44. isInheritedEffect: false,
  45. card: card,
  46. condition: null)
  47. );
  48. }
  49. #endregion
  50. #region On Play
  51. if (timing == EffectTiming.OnEnterFieldAnyone)
  52. {
  53. ActivateClass activatePlayClass = new ActivateClass();
  54. activatePlayClass.SetUpICardEffect("Select 1 of your Digimon to gain battle protection", CanUsePlayCondition, card);
  55. activatePlayClass.SetUpActivateClass(CanActivateCondition, ActivatePlayCoroutine, -1, false, EffectDiscription());
  56. cardEffects.Add(activatePlayClass);
  57. string EffectDiscription()
  58. {
  59. return "[On Play] 1 of your Digimon can't be deleted in battle until the end of your opponent's turn.";
  60. }
  61. bool CanSelectPermanentCondition(Permanent permanent)
  62. {
  63. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  64. }
  65. bool CanUsePlayCondition(Hashtable hashtable)
  66. {
  67. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  68. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  69. return false;
  70. }
  71. bool CanActivateCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  74. }
  75. IEnumerator ActivatePlayCoroutine(Hashtable hashtable)
  76. {
  77. var selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  78. selectPermanentEffect.SetUp(
  79. selectPlayer: card.Owner,
  80. canTargetCondition: CanSelectPermanentCondition,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. maxCount: 1,
  84. canNoSelect: false,
  85. canEndNotMax: false,
  86. selectPermanentCoroutine: SelectPermanentCoroutine,
  87. afterSelectPermanentCoroutine: null,
  88. mode: SelectPermanentEffect.Mode.Custom,
  89. cardEffect: activatePlayClass);
  90. selectPermanentEffect.SetUpCustomMessage(
  91. "Select 1 Digimon that will get effects.",
  92. "The opponent is selecting 1 Digimon that will get effects.");
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. yield break;
  95. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  96. {
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeDeletedByBattle(
  98. targetPermanent: permanent,
  99. canNotBeDestroyedByBattleCondition: CanNotBeDestroyedByBattleCondition,
  100. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  101. activateClass: activatePlayClass,
  102. effectName: "Can't be deleted in battle"));
  103. yield break;
  104. bool CanNotBeDestroyedByBattleCondition(Permanent permanent1, Permanent attackingPermanent, Permanent defendingPermanent, CardSource defendingCard)
  105. {
  106. return permanent1 == attackingPermanent || permanent1 == defendingPermanent;
  107. }
  108. }
  109. }
  110. }
  111. #endregion
  112. #region When Digivolving
  113. if (timing == EffectTiming.OnEnterFieldAnyone)
  114. {
  115. ActivateClass activateDigivolveClass = new ActivateClass();
  116. activateDigivolveClass.SetUpICardEffect("Select 1 of your Digimon to gain battle protection", CanUseDigivolveCondition, card);
  117. activateDigivolveClass.SetUpActivateClass(CanActivateCondition, ActivateDigivolveCoroutine, -1, false, EffectDiscription());
  118. cardEffects.Add(activateDigivolveClass);
  119. string EffectDiscription()
  120. {
  121. return "[When Digivolving] 1 of your Digimon can't be deleted in battle until the end of your opponent's turn.";
  122. }
  123. bool CanSelectPermanentCondition(Permanent permanent)
  124. {
  125. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  126. }
  127. bool CanUseDigivolveCondition(Hashtable hashtable)
  128. {
  129. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  130. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  131. return false;
  132. }
  133. bool CanActivateCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  136. }
  137. IEnumerator ActivateDigivolveCoroutine(Hashtable hashtable)
  138. {
  139. var selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  140. selectPermanentEffect.SetUp(
  141. selectPlayer: card.Owner,
  142. canTargetCondition: CanSelectPermanentCondition,
  143. canTargetCondition_ByPreSelecetedList: null,
  144. canEndSelectCondition: null,
  145. maxCount: 1,
  146. canNoSelect: false,
  147. canEndNotMax: false,
  148. selectPermanentCoroutine: SelectPermanentCoroutine,
  149. afterSelectPermanentCoroutine: null,
  150. mode: SelectPermanentEffect.Mode.Custom,
  151. cardEffect: activateDigivolveClass);
  152. selectPermanentEffect.SetUpCustomMessage(
  153. "Select 1 Digimon that will get effects.",
  154. "The opponent is selecting 1 Digimon that will get effects.");
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. yield break;
  157. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  158. {
  159. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeDeletedByBattle(
  160. targetPermanent: permanent,
  161. canNotBeDestroyedByBattleCondition: CanNotBeDestroyedByBattleCondition,
  162. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  163. activateClass: activateDigivolveClass,
  164. effectName: "Can't be deleted in battle"));
  165. yield break;
  166. bool CanNotBeDestroyedByBattleCondition(Permanent permanent1, Permanent attackingPermanent, Permanent defendingPermanent, CardSource defendingCard)
  167. {
  168. return permanent == attackingPermanent || permanent == defendingPermanent;
  169. }
  170. }
  171. }
  172. }
  173. #endregion
  174. return cardEffects;
  175. }
  176. }
  177. }