From 3ad0dbc08646624946ed81322d490a06e904f9d0 Mon Sep 17 00:00:00 2001 From: Jaculabilis Date: Fri, 18 Feb 2022 16:58:16 -0800 Subject: [PATCH] Add order types --- MultiversalDiplomacy/Orders/BuildOrder.cs | 26 +++++++++++++++ MultiversalDiplomacy/Orders/ConvoyOrder.cs | 32 +++++++++++++++++++ MultiversalDiplomacy/Orders/DisbandOrder.cs | 12 +++++++ MultiversalDiplomacy/Orders/HoldOrder.cs | 12 +++++++ MultiversalDiplomacy/Orders/MoveOrder.cs | 26 +++++++++++++++ MultiversalDiplomacy/Orders/RetreatOrder.cs | 20 ++++++++++++ .../Orders/SupportHoldOrder.cs | 20 ++++++++++++ .../Orders/SupportMoveOrder.cs | 32 +++++++++++++++++++ MultiversalDiplomacy/Orders/SustainOrder.cs | 26 +++++++++++++++ MultiversalDiplomacy/Orders/UnitOrder.cs | 19 +++++++++++ 10 files changed, 225 insertions(+) create mode 100644 MultiversalDiplomacy/Orders/BuildOrder.cs create mode 100644 MultiversalDiplomacy/Orders/ConvoyOrder.cs create mode 100644 MultiversalDiplomacy/Orders/DisbandOrder.cs create mode 100644 MultiversalDiplomacy/Orders/HoldOrder.cs create mode 100644 MultiversalDiplomacy/Orders/MoveOrder.cs create mode 100644 MultiversalDiplomacy/Orders/RetreatOrder.cs create mode 100644 MultiversalDiplomacy/Orders/SupportHoldOrder.cs create mode 100644 MultiversalDiplomacy/Orders/SupportMoveOrder.cs create mode 100644 MultiversalDiplomacy/Orders/SustainOrder.cs create mode 100644 MultiversalDiplomacy/Orders/UnitOrder.cs diff --git a/MultiversalDiplomacy/Orders/BuildOrder.cs b/MultiversalDiplomacy/Orders/BuildOrder.cs new file mode 100644 index 0000000..29e8653 --- /dev/null +++ b/MultiversalDiplomacy/Orders/BuildOrder.cs @@ -0,0 +1,26 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order to build a unit. +/// +public class BuildOrder : Order +{ + /// + /// The location in which to build the unit. + /// + public Location Location { get; } + + /// + /// The type of unit to build. + /// + public UnitType Type { get; } + + public BuildOrder(Power power, Location location, UnitType type) + : base (power) + { + this.Location = location; + this.Type = type; + } +} diff --git a/MultiversalDiplomacy/Orders/ConvoyOrder.cs b/MultiversalDiplomacy/Orders/ConvoyOrder.cs new file mode 100644 index 0000000..665fef6 --- /dev/null +++ b/MultiversalDiplomacy/Orders/ConvoyOrder.cs @@ -0,0 +1,32 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order to move another unit via convoy. +/// +public class ConvoyOrder : UnitOrder +{ + /// + /// The unit to convoy. + /// + public Unit Target { get; } + + /// + /// The destination season to which the target is moving. + /// + public Season Season { get; } + + /// + /// The destination location to which the target is moving. + /// + public Location Location { get; } + + public ConvoyOrder(Power power, Unit unit, Unit target, Season season, Location location) + : base (power, unit) + { + this.Target = target; + this.Season = season; + this.Location = location; + } +} diff --git a/MultiversalDiplomacy/Orders/DisbandOrder.cs b/MultiversalDiplomacy/Orders/DisbandOrder.cs new file mode 100644 index 0000000..a04b790 --- /dev/null +++ b/MultiversalDiplomacy/Orders/DisbandOrder.cs @@ -0,0 +1,12 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order to disband a unit. +/// +public class DisbandOrder : UnitOrder +{ + public DisbandOrder(Power power, Unit unit) + : base (power, unit) {} +} diff --git a/MultiversalDiplomacy/Orders/HoldOrder.cs b/MultiversalDiplomacy/Orders/HoldOrder.cs new file mode 100644 index 0000000..82b2c1c --- /dev/null +++ b/MultiversalDiplomacy/Orders/HoldOrder.cs @@ -0,0 +1,12 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order for a unit to hold its current province. +/// +public class HoldOrder : UnitOrder +{ + public HoldOrder(Power power, Unit unit) + : base (power, unit) {} +} diff --git a/MultiversalDiplomacy/Orders/MoveOrder.cs b/MultiversalDiplomacy/Orders/MoveOrder.cs new file mode 100644 index 0000000..a6b7582 --- /dev/null +++ b/MultiversalDiplomacy/Orders/MoveOrder.cs @@ -0,0 +1,26 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order for a unit to move to another province. +/// +public class MoveOrder : UnitOrder +{ + /// + /// The destination season to which the unit should move. + /// + public Season Season { get; } + + /// + /// The destination location to which the unit should move. + /// + public Location Location { get; } + + public MoveOrder(Power power, Unit unit, Season season, Location location) + : base (power, unit) + { + this.Season = season; + this.Location = location; + } +} diff --git a/MultiversalDiplomacy/Orders/RetreatOrder.cs b/MultiversalDiplomacy/Orders/RetreatOrder.cs new file mode 100644 index 0000000..a2580cd --- /dev/null +++ b/MultiversalDiplomacy/Orders/RetreatOrder.cs @@ -0,0 +1,20 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order for a dislodged unit to retreat to an adjacent province. +/// +public class RetreatOrder : UnitOrder +{ + /// + /// The destination location to which the unit should retreat. + /// + public Location Location { get; } + + public RetreatOrder(Power power, Unit unit, Location location) + : base (power, unit) + { + this.Location = location; + } +} diff --git a/MultiversalDiplomacy/Orders/SupportHoldOrder.cs b/MultiversalDiplomacy/Orders/SupportHoldOrder.cs new file mode 100644 index 0000000..97ddbb9 --- /dev/null +++ b/MultiversalDiplomacy/Orders/SupportHoldOrder.cs @@ -0,0 +1,20 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order for a unit to support another unit's hold order. +/// +public class SupportHoldOrder : UnitOrder +{ + /// + /// The unit to support. + /// + public Unit Target { get; } + + public SupportHoldOrder(Power power, Unit unit, Unit target) + : base (power, unit) + { + this.Target = target; + } +} \ No newline at end of file diff --git a/MultiversalDiplomacy/Orders/SupportMoveOrder.cs b/MultiversalDiplomacy/Orders/SupportMoveOrder.cs new file mode 100644 index 0000000..45fae77 --- /dev/null +++ b/MultiversalDiplomacy/Orders/SupportMoveOrder.cs @@ -0,0 +1,32 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order for a unit to support another unit's move order. +/// +public class SupportMoveOrder : UnitOrder +{ + /// + /// The unit to support. + /// + public Unit Target { get; } + + /// + /// The destination season to which the target is moving. + /// + public Season Season { get; } + + /// + /// The destination location to which the target is moving. + /// + public Location Location { get; } + + public SupportMoveOrder(Power power, Unit unit, Unit target, Season season, Location location) + : base (power, unit) + { + this.Target = target; + this.Season = season; + this.Location = location; + } +} \ No newline at end of file diff --git a/MultiversalDiplomacy/Orders/SustainOrder.cs b/MultiversalDiplomacy/Orders/SustainOrder.cs new file mode 100644 index 0000000..e6954d3 --- /dev/null +++ b/MultiversalDiplomacy/Orders/SustainOrder.cs @@ -0,0 +1,26 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order to sustain a timeline in existence. +/// +public class SustainOrder : Order +{ + /// + /// The ordered time center. + /// + public Location TimeCenter { get; } + + /// + /// The timeline to sustain. + /// + public int Timeline { get; } + + public SustainOrder(Power power, Location timeCenter, int timeline) + : base (power) + { + this.TimeCenter = timeCenter; + this.Timeline = timeline; + } +} diff --git a/MultiversalDiplomacy/Orders/UnitOrder.cs b/MultiversalDiplomacy/Orders/UnitOrder.cs new file mode 100644 index 0000000..e6d1f6d --- /dev/null +++ b/MultiversalDiplomacy/Orders/UnitOrder.cs @@ -0,0 +1,19 @@ +using MultiversalDiplomacy.Model; + +namespace MultiversalDiplomacy.Orders; + +/// +/// An order given to a specific unit. +/// +public abstract class UnitOrder : Order +{ + /// + /// The ordered unit. + /// + public Unit Unit { get; } + + public UnitOrder(Power power, Unit unit) : base(power) + { + this.Unit = unit; + } +} \ No newline at end of file