using System.Collections; using System.Collections.Generic; using System; using System.Linq; using UnityEngine; public partial class CardEffectCommons { #region Can Trigger [Ascension] public static bool CanTriggerAscension(Hashtable hashtable, CardSource card) { return CanTriggerOnDeletion(hashtable, card); } public static bool CanTriggerPermanentAscension(Hashtable hashtable, Func permanentCondition) { return CanTriggerOnPermanentDeleted(hashtable, permanentCondition); } #endregion #region Can activate [Ascension] public static bool CanActivateAscension(Hashtable hashtable, CardSource card) { return CanActivateOnDeletion(card); } #endregion #region Effect process of [Ascension] public static IEnumerator AscensionProcess(Hashtable hashtable, ICardEffect activateClass, CardSource card) { if (card.Owner.CanAddSecurity(activateClass)) { string selectPlayerMessage = "Will you place this card in security?"; string notSelectPlayerMessage = "The opponent is choosing if they will use Ascension."; List> command_SelectCommands = new List>() { new SelectionElement(message: $"Yes", value: true, spriteIndex: 0), new SelectionElement(message: $"No", value: false, spriteIndex: 1), }; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: command_SelectCommands, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); if(GManager.instance.userSelectionManager.SelectedBoolValue) { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(card, true)); } } } #endregion #region Target 1 Digimon gains [Ascension] public static IEnumerator GainAscension(Permanent targetPermanent, EffectDuration effectDuration, ICardEffect activateClass) { 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 ascension = CardEffectFactory.AscensionEffect( targetPermanent: targetPermanent, isInheritedEffect: false, condition: CanUseCondition, rootCardEffect: activateClass, card: activateClass.EffectSourceCard); AddEffectToPermanent( targetPermanent: targetPermanent, effectDuration: effectDuration, card: card, cardEffect: ascension, timing: EffectTiming.OnDestroyedAnyone); if (!targetPermanent.TopCard.CanNotBeAffected(activateClass)) { yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateBuffEffect(targetPermanent)); } } #endregion }