BT4_035.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_035 : 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. int count()
  16. {
  17. return card.Owner.Enemy.HandCards.Count / 4;
  18. }
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect($"Gain Memory", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "[When Digivolving] Gain 1 memory for every 4 cards in your opponent's hand.";
  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 (card.Owner.CanAddMemory(activateClass))
  36. {
  37. if (count() >= 1)
  38. {
  39. activateClass.SetEffectName($"Memory +{count()}");
  40. return true;
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  47. {
  48. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(count(), activateClass));
  49. }
  50. }
  51. if (timing == EffectTiming.None)
  52. {
  53. bool Condition()
  54. {
  55. return CardEffectCommons.IsOwnerTurn(card);
  56. }
  57. cardEffects.Add(CardEffectFactory.CanNotBeBlockedStaticSelfEffect(
  58. defenderCondition: null,
  59. isInheritedEffect: false,
  60. card: card, condition:
  61. Condition,
  62. effectName: "Unblockable"));
  63. }
  64. return cardEffects;
  65. }
  66. }