| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using System.Collections;
- using System.Collections.Generic;
- using System;
- using System.Linq;
- using UnityEngine;
- public partial class CardEffectCommons
- {
- #region Can activate [Blitz]
- public static bool CanActivateBlitz(CardSource cardSource, ICardEffect activateClass)
- {
- if (IsExistOnBattleArea(cardSource))
- {
- if (cardSource.PermanentOfThisCard().CanAttack(activateClass))
- {
- if (cardSource.Owner.Enemy.MemoryForPlayer >= 1)
- {
- if (!GManager.instance.attackProcess.IsAttacking)
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- #endregion
- #region Effect process of [Blitz]
- public static IEnumerator BlitzProcess(CardSource cardSource, ICardEffect activateClass, Func<IEnumerator> beforeOnAttackCoroutine = null)
- {
- if (CanActivateBlitz(cardSource, activateClass))
- {
- SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
- selectAttackEffect.SetUp(
- attacker: cardSource.PermanentOfThisCard(),
- canAttackPlayerCondition: () => true,
- defenderCondition: (permanent) => true,
- cardEffect: activateClass);
- selectAttackEffect.SetBeforeOnAttackCoroutine(beforeOnAttackCoroutine);
- yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
- }
- }
- #endregion
- #region Target 1 Digimon gains [Blitz]
- public static IEnumerator GainBlitz(Permanent targetPermanent, EffectDuration effectDuration, ICardEffect activateClass, bool isWhenDigivolving)
- {
- if (targetPermanent == null) yield break;
- if (!IsPermanentExistsOnBattleArea(targetPermanent)) yield break;
- if (activateClass == null) yield break;
- if (activateClass.EffectSourceCard == null) yield break;
- CardSource card = activateClass.EffectSourceCard;
- bool CanUseCondition()
- {
- if (IsPermanentExistsOnBattleArea(targetPermanent))
- {
- if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- return true;
- }
- }
- return false;
- }
- ActivateClass blitz = CardEffectFactory.BlitzEffect(
- targetPermanent: targetPermanent,
- isInheritedEffect: false,
- condition: CanUseCondition,
- isWhenDigivolving: isWhenDigivolving,
- rootCardEffect: activateClass,
- card: targetPermanent.TopCard);
- AddEffectToPermanent(
- targetPermanent: targetPermanent,
- effectDuration: effectDuration,
- card: card,
- cardEffect: blitz,
- timing: EffectTiming.OnEnterFieldAnyone);
- if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(targetPermanent));
- }
- }
- #endregion
- }
|