|
@@ -113,6 +113,16 @@ public class SelectCardEffect : MonoBehaviourPunCallbacks
|
|
|
_skillInfos = skillInfos.Clone();
|
|
_skillInfos = skillInfos.Clone();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void SetReducedCostTuple((int reduceCost, Func<CardSource, bool> reduceCostCardCondition)? reduceCostTuple)
|
|
|
|
|
+ {
|
|
|
|
|
+ _reduceCostTuple = reduceCostTuple;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void SetFixedCostTuple((int fixedCost, Func<CardSource, bool> fixedCostCardCondition)? fixedCostTuple)
|
|
|
|
|
+ {
|
|
|
|
|
+ _fixedCostTuple = fixedCostTuple;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public void SetUpCustomMessage(string CustomMessage, string CustomMessage_Enemy)
|
|
public void SetUpCustomMessage(string CustomMessage, string CustomMessage_Enemy)
|
|
|
{
|
|
{
|
|
|
_customMessage = CustomMessage;
|
|
_customMessage = CustomMessage;
|
|
@@ -168,15 +178,18 @@ public class SelectCardEffect : MonoBehaviourPunCallbacks
|
|
|
bool _isAssembly = false;
|
|
bool _isAssembly = false;
|
|
|
bool _isSecurity = false;
|
|
bool _isSecurity = false;
|
|
|
bool _allowFaceDown = false;
|
|
bool _allowFaceDown = false;
|
|
|
|
|
+ (int reduceCost, Func<CardSource, bool> reduceCostCardCondition)? _reduceCostTuple = null;
|
|
|
|
|
+ (int fixedCost, Func<CardSource, bool> fixedCostCardCondition)? _fixedCostTuple = null;
|
|
|
|
|
|
|
|
public enum Mode
|
|
public enum Mode
|
|
|
{
|
|
{
|
|
|
AddHand,
|
|
AddHand,
|
|
|
Discard,
|
|
Discard,
|
|
|
- PlayForFree,
|
|
|
|
|
|
|
|
|
|
// PutLibraryTop,
|
|
// PutLibraryTop,
|
|
|
// PutLibraryBottom,
|
|
// PutLibraryBottom,
|
|
|
|
|
+ PlayForFree,
|
|
|
|
|
+ PlayForCost,
|
|
|
Custom,
|
|
Custom,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -412,6 +425,10 @@ public class SelectCardEffect : MonoBehaviourPunCallbacks
|
|
|
message = "Select cards to play without paying the cost.";
|
|
message = "Select cards to play without paying the cost.";
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
+ case Mode.PlayForCost:
|
|
|
|
|
+ message = "Select cards to play.";
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
case Mode.Custom:
|
|
case Mode.Custom:
|
|
|
message = "Select cards.";
|
|
message = "Select cards.";
|
|
|
break;
|
|
break;
|
|
@@ -679,7 +696,9 @@ public class SelectCardEffect : MonoBehaviourPunCallbacks
|
|
|
yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(_targetCards, "Cards put on the trash", true, true));
|
|
yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(_targetCards, "Cards put on the trash", true, true));
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
case Mode.PlayForFree:
|
|
case Mode.PlayForFree:
|
|
|
|
|
+ case Mode.PlayForCost:
|
|
|
yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(_targetCards, "Played cards", true, true));
|
|
yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(_targetCards, "Played cards", true, true));
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
@@ -765,7 +784,7 @@ public class SelectCardEffect : MonoBehaviourPunCallbacks
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case Mode.PlayForFree:
|
|
case Mode.PlayForFree:
|
|
|
- yield return ContinuousController.instance.StartCoroutine(
|
|
|
|
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
CardEffectCommons.PlayPermanentCards(
|
|
CardEffectCommons.PlayPermanentCards(
|
|
|
cardSources: _targetCards,
|
|
cardSources: _targetCards,
|
|
|
activateClass: _cardEffect,
|
|
activateClass: _cardEffect,
|
|
@@ -773,7 +792,143 @@ public class SelectCardEffect : MonoBehaviourPunCallbacks
|
|
|
isTapped: false,
|
|
isTapped: false,
|
|
|
root: _root,
|
|
root: _root,
|
|
|
activateETB: true));
|
|
activateETB: true));
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case Mode.PlayForCost:
|
|
|
|
|
+ {
|
|
|
|
|
+ bool PermanentsCondition(List<Permanent> targetPermanents)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (targetPermanents == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ if (targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool SharedCardCondition(CardSource cardSource) => _targetCards.Contains(cardSource);
|
|
|
|
|
+ bool RootCondition(SelectCardEffect.Root root) => true;
|
|
|
|
|
+ bool CanUseCondition(Hashtable hashtable) => true;
|
|
|
|
|
+
|
|
|
|
|
+ #region reduce cost
|
|
|
|
|
+
|
|
|
|
|
+ Func<EffectTiming, ICardEffect> getChangeCostEffect = null;
|
|
|
|
|
+
|
|
|
|
|
+ if (_reduceCostTuple != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ bool CardCondition(CardSource cardSource)
|
|
|
|
|
+ {
|
|
|
|
|
+ return SharedCardCondition(cardSource)
|
|
|
|
|
+ && (_reduceCostTuple.Value.reduceCostCardCondition == null || _reduceCostTuple.Value.reduceCostCardCondition(cardSource));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (PermanentsCondition(targetPermanents))
|
|
|
|
|
+ {
|
|
|
|
|
+ Cost += _reduceCostTuple.Value.reduceCost;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return Cost;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool isUpDown() => true;
|
|
|
|
|
+
|
|
|
|
|
+ ChangeCostClass changeCostClass = new ChangeCostClass();
|
|
|
|
|
+ changeCostClass.SetUpICardEffect($"Play Cost -{_reduceCostTuple.Value.reduceCost}", CanUseCondition, _cardEffect.EffectSourceCard);
|
|
|
|
|
+ changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
|
|
|
|
|
+
|
|
|
|
|
+ ICardEffect GetCardEffect(EffectTiming _timing)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (_timing == EffectTiming.None)
|
|
|
|
|
+ {
|
|
|
|
|
+ return changeCostClass;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (getChangeCostEffect != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ _selectPlayer.UntilCalculateFixedCostEffect.Add(GetCardEffect);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region set fixed cost
|
|
|
|
|
+
|
|
|
|
|
+ Func<EffectTiming, ICardEffect> getFixedCostEffect = null;
|
|
|
|
|
+
|
|
|
|
|
+ if (_fixedCostTuple != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ bool CardCondition(CardSource cardSource)
|
|
|
|
|
+ {
|
|
|
|
|
+ return SharedCardCondition(cardSource)
|
|
|
|
|
+ && (_fixedCostTuple.Value.fixedCostCardCondition == null || _fixedCostTuple.Value.fixedCostCardCondition(cardSource));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (PermanentsCondition(targetPermanents))
|
|
|
|
|
+ {
|
|
|
|
|
+ Cost = _fixedCostTuple.Value.fixedCost;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return Cost;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ bool isUpDown() => false;
|
|
|
|
|
+
|
|
|
|
|
+ ChangeCostClass changeCostClass = new ChangeCostClass();
|
|
|
|
|
+ changeCostClass.SetUpICardEffect($"Play Cost -{_reduceCostTuple.Value.reduceCost}", CanUseCondition, _cardEffect.EffectSourceCard);
|
|
|
|
|
+ changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
|
|
|
|
|
+
|
|
|
|
|
+ ICardEffect GetCardEffect(EffectTiming _timing)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (_timing == EffectTiming.None)
|
|
|
|
|
+ {
|
|
|
|
|
+ return changeCostClass;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (getChangeCostEffect != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ _selectPlayer.UntilCalculateFixedCostEffect.Add(GetCardEffect);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ yield return ContinuousController.instance.StartCoroutine(
|
|
|
|
|
+ CardEffectCommons.PlayPermanentCards(
|
|
|
|
|
+ cardSources: _targetCards,
|
|
|
|
|
+ activateClass: _cardEffect,
|
|
|
|
|
+ payCost: true,
|
|
|
|
|
+ isTapped: false,
|
|
|
|
|
+ root: SelectCardEffect.Root.Hand,
|
|
|
|
|
+ activateETB: true));
|
|
|
|
|
+
|
|
|
|
|
+ #region release effect
|
|
|
|
|
+ if (getChangeCostEffect != null) _selectPlayer.UntilCalculateFixedCostEffect.Remove(getChangeCostEffect);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region release effect
|
|
|
|
|
+ if (getFixedCostEffect != null) _selectPlayer.UntilCalculateFixedCostEffect.Remove(getFixedCostEffect);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
break;
|
|
break;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
case Mode.Custom:
|
|
case Mode.Custom:
|
|
|
if (_selectCardCoroutine != null)
|
|
if (_selectCardCoroutine != null)
|