|
|
@@ -7,71 +7,28 @@ using UnityEngine;
|
|
|
public partial class CardEffectFactory
|
|
|
{
|
|
|
#region Trigger effect of [Ascension] on oneself
|
|
|
- public static ICardEffect AscensionSelfEffect(bool isInheritedEffect, CardSource card, Func<bool> condition)
|
|
|
+ public static ICardEffect AscensionSelfEffect(bool isInheritedEffect, CardSource card, Func<bool> condition, bool isLinkedEffect = false)
|
|
|
{
|
|
|
- Permanent targetPermanent = card.PermanentOfThisCard();
|
|
|
-
|
|
|
- bool CanUseCondition()
|
|
|
- {
|
|
|
- if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
|
|
|
- {
|
|
|
- if (condition == null || condition())
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- return AscensionEffect(
|
|
|
- targetPermanent: targetPermanent,
|
|
|
- isInheritedEffect: isInheritedEffect,
|
|
|
- condition: CanUseCondition,
|
|
|
- rootCardEffect: null, card);
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region Trigger effect of [Ascension]
|
|
|
- public static ActivateClass AscensionEffect(Permanent targetPermanent, bool isInheritedEffect, Func<bool> condition, ICardEffect rootCardEffect, CardSource card)
|
|
|
- {
|
|
|
- if (targetPermanent == null) return null;
|
|
|
- if (targetPermanent.TopCard == null) return null;
|
|
|
- if (card == null) return null;
|
|
|
-
|
|
|
ActivateClass activateClass = new ActivateClass();
|
|
|
activateClass.SetUpICardEffect("Ascension", CanUseCondition, card);
|
|
|
activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, DataBase.AscensionEffectDescription());
|
|
|
activateClass.SetIsInheritedEffect(isInheritedEffect);
|
|
|
-
|
|
|
- if (rootCardEffect != null)
|
|
|
- {
|
|
|
- activateClass.SetIsInheritedEffect(false);
|
|
|
- activateClass.SetEffectSourcePermanent(targetPermanent);
|
|
|
- activateClass.SetRootCardEffect(rootCardEffect);
|
|
|
- }
|
|
|
+ activateClass.SetIsLinkedEffect(isLinkedEffect);
|
|
|
|
|
|
bool CanUseCondition(Hashtable hashtable)
|
|
|
{
|
|
|
- if (CardEffectCommons.CanTriggerPermanentAscension(hashtable, (permanent) => permanent == targetPermanent))
|
|
|
- {
|
|
|
- if (condition == null || condition())
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
+ return CardEffectCommons.CanTriggerAscension(hashtable, card)
|
|
|
+ && (condition == null || condition());
|
|
|
}
|
|
|
|
|
|
bool CanActivateCondition(Hashtable hashtable)
|
|
|
{
|
|
|
- return CardEffectCommons.CanActivateAscension(hashtable, targetPermanent.TopCard);
|
|
|
+ return CardEffectCommons.CanActivateAscension(hashtable, card);
|
|
|
}
|
|
|
|
|
|
IEnumerator ActivateCoroutine(Hashtable _hashtable)
|
|
|
{
|
|
|
- return CardEffectCommons.AscensionProcess(_hashtable, activateClass, targetPermanent.TopCard);
|
|
|
+ return CardEffectCommons.AscensionProcess(_hashtable, activateClass, card);
|
|
|
}
|
|
|
|
|
|
return activateClass;
|