P_165_token.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.Tokens
  4. {
  5. public class P_165_token : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Deletion
  11. if (timing == EffectTiming.OnDestroyedAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("DP -3000", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  16. cardEffects.Add(activateClass);
  17. string EffectDescription()
  18. {
  19. return "[On Deletion] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  32. }
  33. IEnumerator ActivateCoroutine(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  36. {
  37. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  38. selectPermanentEffect.SetUp(
  39. selectPlayer: card.Owner,
  40. canTargetCondition: CanSelectPermanentCondition,
  41. canTargetCondition_ByPreSelecetedList: null,
  42. canEndSelectCondition: null,
  43. maxCount: 1,
  44. canNoSelect: false,
  45. canEndNotMax: false,
  46. selectPermanentCoroutine: SelectPermanentCoroutine,
  47. afterSelectPermanentCoroutine: null,
  48. mode: SelectPermanentEffect.Mode.Custom,
  49. cardEffect: activateClass);
  50. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  51. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  54. targetPermanent: permanent,
  55. changeValue: -3000,
  56. effectDuration: EffectDuration.UntilEachTurnEnd,
  57. activateClass: activateClass));
  58. }
  59. }
  60. }
  61. }
  62. #endregion
  63. #region End of Opponents Turn
  64. if (timing == EffectTiming.OnEndTurn)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("Delete this Digimon.", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  69. cardEffects.Add(activateClass);
  70. string EffectDescription()
  71. {
  72. return "[End of Opponent's Turn] Delete this Digimon.";
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  77. {
  78. if (CardEffectCommons.IsOpponentTurn(card))
  79. {
  80. return true;
  81. }
  82. }
  83. return false;
  84. }
  85. bool CanActivateCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(
  92. new DestroyPermanentsClass(
  93. new List<Permanent>() { card.PermanentOfThisCard() },
  94. CardEffectCommons.CardEffectHashtable(activateClass)
  95. ).Destroy());
  96. }
  97. }
  98. #endregion
  99. return cardEffects;
  100. }
  101. }
  102. }