Post by Legend on Mar 30, 2022 20:43:45 GMT
Hello I am change the card cost based off other stats within the game as the game progresses and for some reason i can see everything changes except when the actual card is played and that playcard action is taken - so i see the update on the cardview.card and i see playable card in cardsystem refresh and the cost is correct there but the Card from the PlayCardAction doesnt appear correct:
original card cost = 1
changed card cost = 3
Debug.Log(owner.activeCardView.card.cost + " confirm state card cost"); <--- this shows '5 confirm state card cost' = which is actually what it should be
var action = new PlayCardAction(owner.activeCardView.card);
owner.game.Perform(action);
this travels down the line to:
public static class ActionSystemExtensions {
public static void Perform (this IContainer game, GameAction action) {
var actionSystem = game.GetAspect<ActionSystem> ();
if (action is PlayCardAction)
Debug.Log(((PlayCardAction)action).card.cost + "action system perform" ); <--- this shows '5 confirm state card cost' = which is actually what it should be
actionSystem.Perform (action);
}
the goes to here:
public void Perform (GameAction action) {
if (IsActive) return;
rootAction = action;
if (action is PlayCardAction)
Debug.Log(((PlayCardAction)action).card.cost + "Perform action system call sequence"); <--- this shows '5 confirm state card cost' = which is actually what it should be
rootSequence = Sequence (action);
}
IEnumerator MainPhase (Phase phase) {
bool isActionCancelled = phase.owner.isCanceled;
bool isCancelPhase = phase.owner.cancel == phase;
if (isActionCancelled ^ isCancelPhase)
yield break;
var reactions = openReactions = new List<GameAction> ();
var flow = phase.Flow (container);
while (flow.MoveNext ()) { yield return null; }
flow = ReactPhase (reactions);
while (flow.MoveNext ()) { yield return null; }
if (phase.owner is PlayCardAction)
Debug.Log(((PlayCardAction)phase.owner).card.cost + "mainphase system perform"); <----- 5 the original cost
}
IEnumerator Sequence(GameAction action)
{
this.PostNotification(beginSequenceNotification, action);
if (action.Validate() == false)
action.Cancel();
var phase = MainPhase(action.prepare);
while (phase.MoveNext()) { yield return null; }
phase = MainPhase(action.perform);
while (phase.MoveNext()) { yield return null; }
phase = MainPhase(action.cancel);
while (phase.MoveNext()) { yield return null; }
if (rootAction == action)
{
phase = EventPhase(deathReaperNotification, action, true);
while (phase.MoveNext()) { yield return null; }
}
if (action is PlayCardAction)
Debug.Log(((PlayCardAction)action).card.cost + "end of sequence system perform"); <------ 5 the original cost
this.PostNotification(endSequenceNotification, action);
}
I am not quite sure why the ethereal system registers the original cost but not the new one ( do you have any idea where to look that might be the issue - like is there anything that i am missing that would replace the Card in the PlayCardAction with original data by the action system or something ?
thanks!
Legend
original card cost = 1
changed card cost = 3
Debug.Log(owner.activeCardView.card.cost + " confirm state card cost"); <--- this shows '5 confirm state card cost' = which is actually what it should be
var action = new PlayCardAction(owner.activeCardView.card);
owner.game.Perform(action);
this travels down the line to:
public static class ActionSystemExtensions {
public static void Perform (this IContainer game, GameAction action) {
var actionSystem = game.GetAspect<ActionSystem> ();
if (action is PlayCardAction)
Debug.Log(((PlayCardAction)action).card.cost + "action system perform" ); <--- this shows '5 confirm state card cost' = which is actually what it should be
actionSystem.Perform (action);
}
the goes to here:
public void Perform (GameAction action) {
if (IsActive) return;
rootAction = action;
if (action is PlayCardAction)
Debug.Log(((PlayCardAction)action).card.cost + "Perform action system call sequence"); <--- this shows '5 confirm state card cost' = which is actually what it should be
rootSequence = Sequence (action);
}
IEnumerator MainPhase (Phase phase) {
bool isActionCancelled = phase.owner.isCanceled;
bool isCancelPhase = phase.owner.cancel == phase;
if (isActionCancelled ^ isCancelPhase)
yield break;
var reactions = openReactions = new List<GameAction> ();
var flow = phase.Flow (container);
while (flow.MoveNext ()) { yield return null; }
flow = ReactPhase (reactions);
while (flow.MoveNext ()) { yield return null; }
if (phase.owner is PlayCardAction)
Debug.Log(((PlayCardAction)phase.owner).card.cost + "mainphase system perform"); <----- 5 the original cost
}
IEnumerator Sequence(GameAction action)
{
this.PostNotification(beginSequenceNotification, action);
if (action.Validate() == false)
action.Cancel();
var phase = MainPhase(action.prepare);
while (phase.MoveNext()) { yield return null; }
phase = MainPhase(action.perform);
while (phase.MoveNext()) { yield return null; }
phase = MainPhase(action.cancel);
while (phase.MoveNext()) { yield return null; }
if (rootAction == action)
{
phase = EventPhase(deathReaperNotification, action, true);
while (phase.MoveNext()) { yield return null; }
}
if (action is PlayCardAction)
Debug.Log(((PlayCardAction)action).card.cost + "end of sequence system perform"); <------ 5 the original cost
this.PostNotification(endSequenceNotification, action);
}
I am not quite sure why the ethereal system registers the original cost but not the new one ( do you have any idea where to look that might be the issue - like is there anything that i am missing that would replace the Card in the PlayCardAction with original data by the action system or something ?
thanks!
Legend