| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using System.Collections;
- using System.Collections.Generic;
- using System;
- using System.Linq;
- using UnityEngine;
- using System.Runtime.CompilerServices;
- public partial class CardEffectCommons
- {
- #region Player gains effect to change play cost
- public static IEnumerator ChangePlayCostPlayerEffect(
- Func<Permanent, bool> permanentCondition,
- int changeValue,
- bool setFixedCost,
- EffectDuration effectDuration,
- ICardEffect activateClass)
- {
- if (activateClass == null) yield break;
- if (activateClass.EffectSourceCard == null) yield break;
- if (changeValue == 0) yield break;
- bool PermanentCondition(Permanent permanent)
- {
- if (IsPermanentExistsOnBattleArea(permanent))
- {
- if (!permanent.TopCard.CanNotBeAffected(activateClass))
- {
- if (permanentCondition == null || permanentCondition(permanent))
- {
- return true;
- }
- }
- }
- return false;
- }
- bool CanUseCondition()
- {
- return true;
- }
- ChangeCostClass changeCostClass = CardEffectFactory.ChangePlayCostStaticEffect(
- changeValue: changeValue,
- permanentCondition: PermanentCondition,
- isInheritedEffect: false,
- card: activateClass.EffectSourceCard,
- condition: CanUseCondition,
- setFixedCost: setFixedCost);
- AddEffectToPlayer(effectDuration: effectDuration, card: activateClass.EffectSourceCard, cardEffect: changeCostClass, timing: EffectTiming.None);
- foreach (Permanent permanent in GManager.instance.turnStateMachine.gameContext.PermanentsForTurnPlayer)
- {
- if (PermanentCondition(permanent))
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
- }
- }
- }
- #endregion
- }
|