|
|
|
@ -8,12 +8,12 @@ public class MovementDecisions
|
|
|
|
|
public Dictionary<Unit, IsDislodged> IsDislodged { get; }
|
|
|
|
|
public Dictionary<MoveOrder, HasPath> HasPath { get; }
|
|
|
|
|
public Dictionary<SupportOrder, GivesSupport> GivesSupport { get; }
|
|
|
|
|
public Dictionary<(Province, Season), HoldStrength> HoldStrength { get; }
|
|
|
|
|
public Dictionary<(Province, string), HoldStrength> HoldStrength { get; }
|
|
|
|
|
public Dictionary<MoveOrder, AttackStrength> AttackStrength { get; }
|
|
|
|
|
public Dictionary<MoveOrder, DefendStrength> DefendStrength { get; }
|
|
|
|
|
public Dictionary<MoveOrder, PreventStrength> PreventStrength { get; }
|
|
|
|
|
public Dictionary<MoveOrder, DoesMove> DoesMove { get; }
|
|
|
|
|
public Dictionary<Season, AdvanceTimeline> AdvanceTimeline { get; }
|
|
|
|
|
public Dictionary<string, AdvanceTimeline> AdvanceTimeline { get; }
|
|
|
|
|
|
|
|
|
|
public IEnumerable<AdjudicationDecision> Values =>
|
|
|
|
|
IsDislodged.Values.Cast<AdjudicationDecision>()
|
|
|
|
@ -47,7 +47,7 @@ public class MovementDecisions
|
|
|
|
|
var submittedOrdersBySeason = orders.Cast<UnitOrder>().ToLookup(order => order.Unit.Season);
|
|
|
|
|
foreach (var group in submittedOrdersBySeason)
|
|
|
|
|
{
|
|
|
|
|
AdvanceTimeline[group.Key] = new(group.Key, group);
|
|
|
|
|
AdvanceTimeline[group.Key.Designation] = new(group.Key, group);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create timeline decisions for each season potentially affected by the submitted orders.
|
|
|
|
@ -60,27 +60,27 @@ public class MovementDecisions
|
|
|
|
|
{
|
|
|
|
|
case MoveOrder move:
|
|
|
|
|
AdvanceTimeline.Ensure(
|
|
|
|
|
world.Seasons[move.Season],
|
|
|
|
|
move.Season,
|
|
|
|
|
() => new(world.Seasons[move.Season], world.OrderHistory[move.Season].Orders));
|
|
|
|
|
AdvanceTimeline[world.Seasons[move.Season]].Orders.Add(move);
|
|
|
|
|
AdvanceTimeline[move.Season].Orders.Add(move);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SupportHoldOrder supportHold:
|
|
|
|
|
AdvanceTimeline.Ensure(
|
|
|
|
|
supportHold.Target.Season,
|
|
|
|
|
supportHold.Target.Season.Designation,
|
|
|
|
|
() => new(supportHold.Target.Season, world.OrderHistory[supportHold.Target.Season.Designation].Orders));
|
|
|
|
|
AdvanceTimeline[supportHold.Target.Season].Orders.Add(supportHold);
|
|
|
|
|
AdvanceTimeline[supportHold.Target.Season.Designation].Orders.Add(supportHold);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SupportMoveOrder supportMove:
|
|
|
|
|
AdvanceTimeline.Ensure(
|
|
|
|
|
supportMove.Target.Season,
|
|
|
|
|
supportMove.Target.Season.Designation,
|
|
|
|
|
() => new(supportMove.Target.Season, world.OrderHistory[supportMove.Target.Season.Designation].Orders));
|
|
|
|
|
AdvanceTimeline[supportMove.Target.Season].Orders.Add(supportMove);
|
|
|
|
|
AdvanceTimeline[supportMove.Target.Season.Designation].Orders.Add(supportMove);
|
|
|
|
|
AdvanceTimeline.Ensure(
|
|
|
|
|
supportMove.Season,
|
|
|
|
|
supportMove.Season.Designation,
|
|
|
|
|
() => new(supportMove.Season, world.OrderHistory[supportMove.Season.Designation].Orders));
|
|
|
|
|
AdvanceTimeline[supportMove.Season].Orders.Add(supportMove);
|
|
|
|
|
AdvanceTimeline[supportMove.Season.Designation].Orders.Add(supportMove);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -91,15 +91,18 @@ public class MovementDecisions
|
|
|
|
|
.Distinct()
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
(Province province, Season season) UnitPoint(Unit unit)
|
|
|
|
|
=> (world.Map.GetLocation(unit.Location).Province, unit.Season);
|
|
|
|
|
(Province province, Season season) MovePoint(MoveOrder move)
|
|
|
|
|
=> (move.Province, world.Seasons[move.Season]);
|
|
|
|
|
(Province province, string season) UnitPoint(Unit unit)
|
|
|
|
|
=> (world.Map.GetLocation(unit.Location).Province, unit.Season.Designation);
|
|
|
|
|
(Province province, string season) MovePoint(MoveOrder move)
|
|
|
|
|
=> (move.Province, move.Season);
|
|
|
|
|
|
|
|
|
|
// Create a hold strength decision with an associated order for every province with a unit.
|
|
|
|
|
foreach (UnitOrder order in relevantOrders)
|
|
|
|
|
{
|
|
|
|
|
HoldStrength[UnitPoint(order.Unit)] = new(UnitPoint(order.Unit), order);
|
|
|
|
|
HoldStrength[UnitPoint(order.Unit)] = new(
|
|
|
|
|
world.Map.GetLocation(order.Unit.Location).Province,
|
|
|
|
|
order.Unit.Season,
|
|
|
|
|
order);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsIncoming(UnitOrder me, MoveOrder other)
|
|
|
|
@ -150,7 +153,7 @@ public class MovementDecisions
|
|
|
|
|
DoesMove[move] = new(move, opposingMove, competing);
|
|
|
|
|
|
|
|
|
|
// Ensure a hold strength decision exists for the destination.
|
|
|
|
|
HoldStrength.Ensure(MovePoint(move), () => new(MovePoint(move)));
|
|
|
|
|
HoldStrength.Ensure(MovePoint(move), () => new(move.Province, world.Seasons[move.Season]));
|
|
|
|
|
}
|
|
|
|
|
else if (order is SupportOrder support)
|
|
|
|
|
{
|
|
|
|
@ -158,7 +161,9 @@ public class MovementDecisions
|
|
|
|
|
GivesSupport[support] = new(support, incoming);
|
|
|
|
|
|
|
|
|
|
// Ensure a hold strength decision exists for the target's province.
|
|
|
|
|
HoldStrength.Ensure(UnitPoint(support.Target), () => new(UnitPoint(support.Target)));
|
|
|
|
|
HoldStrength.Ensure(UnitPoint(support.Target), () => new(
|
|
|
|
|
world.Map.GetLocation(support.Target.Location).Province,
|
|
|
|
|
support.Target.Season));
|
|
|
|
|
|
|
|
|
|
if (support is SupportHoldOrder supportHold)
|
|
|
|
|
{
|
|
|
|
@ -167,7 +172,9 @@ public class MovementDecisions
|
|
|
|
|
else if (support is SupportMoveOrder supportMove)
|
|
|
|
|
{
|
|
|
|
|
// Ensure a hold strength decision exists for the target's destination.
|
|
|
|
|
HoldStrength.Ensure(supportMove.Point, () => new(supportMove.Point));
|
|
|
|
|
HoldStrength.Ensure(
|
|
|
|
|
(supportMove.Province, supportMove.Season.Designation),
|
|
|
|
|
() => new(supportMove.Province, supportMove.Season));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|