BT4_092.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 BT4_092 : 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.OnStartTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  16. }
  17. if (timing == EffectTiming.OnAllyAttack)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "[Your Turn] When one of your Digimon with [Greymon] in its name attacks (other than [DoruGreymon],[BurningGreymon], or [DexDoruGreymon]), you may suspend this Tamer to gain 1 memory.";
  26. }
  27. bool PermanentCondition(Permanent permanent)
  28. {
  29. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  30. {
  31. if (permanent.TopCard.HasGreymonName)
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. if (CardEffectCommons.IsOwnerTurn(card))
  43. {
  44. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  66. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  67. }
  68. }
  69. if (timing == EffectTiming.SecuritySkill)
  70. {
  71. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  72. }
  73. return cardEffects;
  74. }
  75. }