processes turns in order of neutral->hostiler->friendly
This commit is contained in:
+15
-10
@@ -109,24 +109,25 @@ public partial class PegController : TurnController
|
||||
}
|
||||
}
|
||||
|
||||
public void HandlePegTurn()
|
||||
public void HandlePegTurn(MapCellOccupant.Disposition DISPOSITION)
|
||||
{
|
||||
_tweenStages.Clear();
|
||||
|
||||
List<Peg> dispositionPegs = [.. _pegs.Where(p => p._disposition == DISPOSITION)];
|
||||
GD.Print(dispositionPegs.Count);
|
||||
int loop = 0;
|
||||
bool anyPegsActed = true;
|
||||
while (anyPegsActed)
|
||||
{
|
||||
anyPegsActed = false;
|
||||
for (int i = 0; i < _pegs.Count; i++)
|
||||
for (int i = 0; i < dispositionPegs.Count; i++)
|
||||
{
|
||||
Peg peg = _pegs[i];
|
||||
Peg peg = dispositionPegs[i];
|
||||
PegAction action = peg.SelectAction();
|
||||
|
||||
if (action != null)
|
||||
{
|
||||
action.DoImmediately(peg);
|
||||
string key = action._priority + ":" + loop;
|
||||
string key = (int)peg._disposition + ":" + action._priority + ":" + loop;
|
||||
GD.Print(key);
|
||||
|
||||
if (!_tweenStages.ContainsKey(key))
|
||||
{
|
||||
@@ -142,7 +143,6 @@ public partial class PegController : TurnController
|
||||
}
|
||||
loop++;
|
||||
}
|
||||
ProcessTween();
|
||||
}
|
||||
|
||||
public void HandlePegClick(Node CLICKED_NODE, int CLICK_TYPE)
|
||||
@@ -212,8 +212,8 @@ public partial class PegController : TurnController
|
||||
|
||||
public void ProcessTween()
|
||||
{
|
||||
_tweenStages = _tweenStages.OrderBy(s => int.Parse(s.Key.Split(":")[0])).ThenBy(s => int.Parse(s.Key.Split(":")[1])).ToDictionary();
|
||||
|
||||
_tweenStages = _tweenStages.OrderBy(s => int.Parse(s.Key.Split(":")[0])).ThenBy(s => int.Parse(s.Key.Split(":")[1])).ThenBy(s => int.Parse(s.Key.Split(":")[2])).ToDictionary();
|
||||
GD.Print(string.Join(", ",_tweenStages.Keys));
|
||||
if (_tweenStages.Count <= 0)
|
||||
{
|
||||
EndTurn();
|
||||
@@ -246,6 +246,7 @@ public partial class PegController : TurnController
|
||||
|
||||
public override void StartTurn()
|
||||
{
|
||||
_tweenStages.Clear();
|
||||
AddHostilePegs(4);
|
||||
|
||||
for (int i = 0; i < _pegs.Count; i++)
|
||||
@@ -254,7 +255,11 @@ public partial class PegController : TurnController
|
||||
}
|
||||
HandlePegSort();
|
||||
|
||||
HandlePegTurn();
|
||||
HandlePegTurn(MapCellOccupant.Disposition.NEUTRAL);
|
||||
HandlePegTurn(MapCellOccupant.Disposition.HOSTILE);
|
||||
HandlePegTurn(MapCellOccupant.Disposition.FRIENDLY);
|
||||
|
||||
ProcessTween();
|
||||
_playArea.HighlightCells();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user