Compare commits
No commits in common. "601ce2d297168e6bbc7706443c8ab0f1ead558ca" and "9185534f70fb6e91b86183f890ae4726fcaea9a1" have entirely different histories.
601ce2d297
...
9185534f70
|
@ -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, string), HoldStrength> HoldStrength { get; }
|
||||
public Dictionary<(Province, Season), 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<string, AdvanceTimeline> AdvanceTimeline { get; }
|
||||
public Dictionary<Season, 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.Designation] = new(group.Key, group);
|
||||
AdvanceTimeline[group.Key] = 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(
|
||||
move.Season,
|
||||
world.Seasons[move.Season],
|
||||
() => new(world.Seasons[move.Season], world.OrderHistory[move.Season].Orders));
|
||||
AdvanceTimeline[move.Season].Orders.Add(move);
|
||||
AdvanceTimeline[world.Seasons[move.Season]].Orders.Add(move);
|
||||
break;
|
||||
|
||||
case SupportHoldOrder supportHold:
|
||||
AdvanceTimeline.Ensure(
|
||||
supportHold.Target.Season.Designation,
|
||||
supportHold.Target.Season,
|
||||
() => new(supportHold.Target.Season, world.OrderHistory[supportHold.Target.Season.Designation].Orders));
|
||||
AdvanceTimeline[supportHold.Target.Season.Designation].Orders.Add(supportHold);
|
||||
AdvanceTimeline[supportHold.Target.Season].Orders.Add(supportHold);
|
||||
break;
|
||||
|
||||
case SupportMoveOrder supportMove:
|
||||
AdvanceTimeline.Ensure(
|
||||
supportMove.Target.Season.Designation,
|
||||
supportMove.Target.Season,
|
||||
() => new(supportMove.Target.Season, world.OrderHistory[supportMove.Target.Season.Designation].Orders));
|
||||
AdvanceTimeline[supportMove.Target.Season.Designation].Orders.Add(supportMove);
|
||||
AdvanceTimeline[supportMove.Target.Season].Orders.Add(supportMove);
|
||||
AdvanceTimeline.Ensure(
|
||||
supportMove.Season.Designation,
|
||||
supportMove.Season,
|
||||
() => new(supportMove.Season, world.OrderHistory[supportMove.Season.Designation].Orders));
|
||||
AdvanceTimeline[supportMove.Season.Designation].Orders.Add(supportMove);
|
||||
AdvanceTimeline[supportMove.Season].Orders.Add(supportMove);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -91,18 +91,15 @@ public class MovementDecisions
|
|||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
(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);
|
||||
(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]);
|
||||
|
||||
// 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(
|
||||
world.Map.GetLocation(order.Unit.Location).Province,
|
||||
order.Unit.Season,
|
||||
order);
|
||||
HoldStrength[UnitPoint(order.Unit)] = new(UnitPoint(order.Unit), order);
|
||||
}
|
||||
|
||||
bool IsIncoming(UnitOrder me, MoveOrder other)
|
||||
|
@ -153,7 +150,7 @@ public class MovementDecisions
|
|||
DoesMove[move] = new(move, opposingMove, competing);
|
||||
|
||||
// Ensure a hold strength decision exists for the destination.
|
||||
HoldStrength.Ensure(MovePoint(move), () => new(move.Province, world.Seasons[move.Season]));
|
||||
HoldStrength.Ensure(MovePoint(move), () => new(MovePoint(move)));
|
||||
}
|
||||
else if (order is SupportOrder support)
|
||||
{
|
||||
|
@ -161,9 +158,7 @@ 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(
|
||||
world.Map.GetLocation(support.Target.Location).Province,
|
||||
support.Target.Season));
|
||||
HoldStrength.Ensure(UnitPoint(support.Target), () => new(UnitPoint(support.Target)));
|
||||
|
||||
if (support is SupportHoldOrder supportHold)
|
||||
{
|
||||
|
@ -172,9 +167,7 @@ public class MovementDecisions
|
|||
else if (support is SupportMoveOrder supportMove)
|
||||
{
|
||||
// Ensure a hold strength decision exists for the target's destination.
|
||||
HoldStrength.Ensure(
|
||||
(supportMove.Province, supportMove.Season.Designation),
|
||||
() => new(supportMove.Province, supportMove.Season));
|
||||
HoldStrength.Ensure(supportMove.Point, () => new(supportMove.Point));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -774,7 +774,7 @@ public class MovementPhaseAdjudicator : IPhaseAdjudicator
|
|||
// If there is a head to head battle, a unit at the destination that isn't moving away, or
|
||||
// a unit at the destination that will fail to move away, then the attacking unit will have
|
||||
// to dislodge it.
|
||||
UnitOrder? destOrder = decisions.HoldStrength[(decision.Order.Province, decision.Order.Season)].Order;
|
||||
UnitOrder? destOrder = decisions.HoldStrength[(decision.Order.Province, world.Seasons[decision.Order.Season])].Order;
|
||||
DoesMove? destMoveAway = destOrder is MoveOrder moveAway
|
||||
? decisions.DoesMove[moveAway]
|
||||
: null;
|
||||
|
@ -953,7 +953,7 @@ public class MovementPhaseAdjudicator : IPhaseAdjudicator
|
|||
// strength.
|
||||
NumericAdjudicationDecision defense = decision.OpposingMove != null
|
||||
? decisions.DefendStrength[decision.OpposingMove]
|
||||
: decisions.HoldStrength[(decision.Order.Province, decision.Order.Season)];
|
||||
: decisions.HoldStrength[(decision.Order.Province, world.Seasons[decision.Order.Season])];
|
||||
progress |= ResolveDecision(defense, world, decisions, depth + 1);
|
||||
|
||||
// If the attack doesn't beat the defense, resolve the move to false.
|
||||
|
|
Loading…
Reference in New Issue