BT7_041.cs 3.1 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 BT7_041 : 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("Memory +2 or Recovery (Deck)", 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 3 or more security cards, gain 2 memory. If you have 2 or fewer security cards, you may <Recovery +1 (Deck)> until there are 3 cards in your security stack. (Place the top card of your deck on top of your security stack.)";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  36. {
  37. if (isExistOnField(card))
  38. {
  39. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  40. {
  41. if (card.Owner.SecurityCards.Count >= 3)
  42. {
  43. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  44. }
  45. else
  46. {
  47. int count = 3 - card.Owner.SecurityCards.Count;
  48. if (count >= 1)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, count, activateClass).Recovery());
  51. }
  52. }
  53. }
  54. }
  55. }
  56. }
  57. if (timing == EffectTiming.None)
  58. {
  59. bool Condition()
  60. {
  61. if (CardEffectCommons.IsExistOnBattleArea(card))
  62. {
  63. if (CardEffectCommons.IsOwnerTurn(card))
  64. {
  65. if (card.Owner.SecurityCards.Count >= 3)
  66. {
  67. return true;
  68. }
  69. }
  70. }
  71. return false;
  72. }
  73. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: Condition));
  74. }
  75. return cardEffects;
  76. }
  77. }