P_055.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class P_055 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] If you have a Tamer in play, suspend 1 of your opponent's Digimon.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  36. {
  37. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  46. {
  47. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  48. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  49. selectPermanentEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: CanSelectPermanentCondition,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: maxCount,
  55. canNoSelect: false,
  56. canEndNotMax: false,
  57. selectPermanentCoroutine: null,
  58. afterSelectPermanentCoroutine: null,
  59. mode: SelectPermanentEffect.Mode.Tap,
  60. cardEffect: activateClass);
  61. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  62. }
  63. }
  64. if (timing == EffectTiming.OnEndBattle)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[Your Turn] When this Digimon deletes an opponent's Digimon in battle and survives, gain 1 memory.";
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. if (CardEffectCommons.IsExistOnBattleArea(card))
  77. {
  78. if (CardEffectCommons.IsOwnerTurn(card))
  79. {
  80. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  81. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  82. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: true))
  83. {
  84. return true;
  85. }
  86. }
  87. }
  88. return false;
  89. }
  90. bool CanActivateCondition(Hashtable hashtable)
  91. {
  92. if (CardEffectCommons.IsExistOnBattleArea(card))
  93. {
  94. if (card.Owner.CanAddMemory(activateClass))
  95. {
  96. return true;
  97. }
  98. }
  99. return false;
  100. }
  101. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  104. }
  105. }
  106. return cardEffects;
  107. }
  108. }