Add order types

This commit is contained in:
Jaculabilis 2022-02-18 16:58:16 -08:00
parent c4f5145320
commit 3ad0dbc086
10 changed files with 225 additions and 0 deletions

View File

@ -0,0 +1,26 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order to build a unit.
/// </summary>
public class BuildOrder : Order
{
/// <summary>
/// The location in which to build the unit.
/// </summary>
public Location Location { get; }
/// <summary>
/// The type of unit to build.
/// </summary>
public UnitType Type { get; }
public BuildOrder(Power power, Location location, UnitType type)
: base (power)
{
this.Location = location;
this.Type = type;
}
}

View File

@ -0,0 +1,32 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order to move another unit via convoy.
/// </summary>
public class ConvoyOrder : UnitOrder
{
/// <summary>
/// The unit to convoy.
/// </summary>
public Unit Target { get; }
/// <summary>
/// The destination season to which the target is moving.
/// </summary>
public Season Season { get; }
/// <summary>
/// The destination location to which the target is moving.
/// </summary>
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;
}
}

View File

@ -0,0 +1,12 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order to disband a unit.
/// </summary>
public class DisbandOrder : UnitOrder
{
public DisbandOrder(Power power, Unit unit)
: base (power, unit) {}
}

View File

@ -0,0 +1,12 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order for a unit to hold its current province.
/// </summary>
public class HoldOrder : UnitOrder
{
public HoldOrder(Power power, Unit unit)
: base (power, unit) {}
}

View File

@ -0,0 +1,26 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order for a unit to move to another province.
/// </summary>
public class MoveOrder : UnitOrder
{
/// <summary>
/// The destination season to which the unit should move.
/// </summary>
public Season Season { get; }
/// <summary>
/// The destination location to which the unit should move.
/// </summary>
public Location Location { get; }
public MoveOrder(Power power, Unit unit, Season season, Location location)
: base (power, unit)
{
this.Season = season;
this.Location = location;
}
}

View File

@ -0,0 +1,20 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order for a dislodged unit to retreat to an adjacent province.
/// </summary>
public class RetreatOrder : UnitOrder
{
/// <summary>
/// The destination location to which the unit should retreat.
/// </summary>
public Location Location { get; }
public RetreatOrder(Power power, Unit unit, Location location)
: base (power, unit)
{
this.Location = location;
}
}

View File

@ -0,0 +1,20 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order for a unit to support another unit's hold order.
/// </summary>
public class SupportHoldOrder : UnitOrder
{
/// <summary>
/// The unit to support.
/// </summary>
public Unit Target { get; }
public SupportHoldOrder(Power power, Unit unit, Unit target)
: base (power, unit)
{
this.Target = target;
}
}

View File

@ -0,0 +1,32 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order for a unit to support another unit's move order.
/// </summary>
public class SupportMoveOrder : UnitOrder
{
/// <summary>
/// The unit to support.
/// </summary>
public Unit Target { get; }
/// <summary>
/// The destination season to which the target is moving.
/// </summary>
public Season Season { get; }
/// <summary>
/// The destination location to which the target is moving.
/// </summary>
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;
}
}

View File

@ -0,0 +1,26 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order to sustain a timeline in existence.
/// </summary>
public class SustainOrder : Order
{
/// <summary>
/// The ordered time center.
/// </summary>
public Location TimeCenter { get; }
/// <summary>
/// The timeline to sustain.
/// </summary>
public int Timeline { get; }
public SustainOrder(Power power, Location timeCenter, int timeline)
: base (power)
{
this.TimeCenter = timeCenter;
this.Timeline = timeline;
}
}

View File

@ -0,0 +1,19 @@
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order given to a specific unit.
/// </summary>
public abstract class UnitOrder : Order
{
/// <summary>
/// The ordered unit.
/// </summary>
public Unit Unit { get; }
public UnitOrder(Power power, Unit unit) : base(power)
{
this.Unit = unit;
}
}