Opened 8 years ago

Closed 8 years ago

#394 closed defect (fixed)

Make requirements (or factory) more closely match Rollcall methods

Reported by: ibboard Owned by: ibboard
Priority: major Milestone: WarFoundry API 0.2
Component: WarFoundry-API Version: Unknown or N/A
Keywords: requirement army validation Cc:
Blocked By: Blocking: #27

Description

In #27 it defines the Rollcall way of doing requirements (e.g for "N,[list]" it defines "Assume there are three X units and two Y units. Then 2,X|Y means you may have no more than 10 [2 * (3 + 2)] of this unit while 2,X,2,Y means you may have no more than 6 [2 * 3] or no more than 4 [2 * 2] of this unit."). The requirements may follow this at the moment, but the factories don't seem to.

Change History (7)

comment:1 Changed 8 years ago by ibboard

Blocking: 27 added
Owner: set to ibboard
Status: newaccepted

comment:2 Changed 8 years ago by IBBoard <dev@…>

In 59e1fb8a476a02a60d28500de3b075c8269b2ce2/IBBoard.WarFoundry.API:

Re #394: Make requirements (or factory) more closely match Rollcall methods

  • Fix ratio check - we were doing an unnecessary division

comment:3 Changed 8 years ago by IBBoard <dev@…>

In 7b9ff7b1df24568f11bde99b6bdc890902aad275/IBBoard.WarFoundry.API:

Re #394: Make requirements (or factory) more closely match Rollcall methods

  • Make UnitRequiresAtLeastNUnitsRequirementFactory handle "alternatives" (Rollcall's "-1,X|Y" notation)
  • Make RequiresAtLeastNUnitsRequirement handle alternatives/multiple unit types in one limit
  • Move some useful code up the classes

comment:4 Changed 8 years ago by IBBoard <dev@…>

In f951595143a98ecea8162b5ce85b1e023a87aded/IBBoard.WarFoundry.API.Tests:

Re #394: Make requirements (or factory) more closely match Rollcall methods

  • Add unit tests that match text
  • "N for M" factory already handled "2,X|Y" (format: "X;Y:2" - "X|Y" is equivalent to Rollcall's "1,X,1,Y")

comment:5 Changed 8 years ago by IBBoard <dev@…>

In 0fa634c6391b1e857af3337e06b6eaaec64af6de/IBBoard.WarFoundry.API.Tests:

Re #394: Make requirements (or factory) more closely match Rollcall methods

  • Add matching unit tests for validation

comment:6 Changed 8 years ago by IBBoard <dev@…>

In c40cb2048fc3530bda804182822393cbdb7b2945/IBBoard.WarFoundry.API.Tests:

Re #394:

  • Fix UnitRequiresNUnitsForMUnitsRequirementTests unit test so it actually does test the other value
  • Add tests to "requires at least N" requirement and factory to test alternatives (Rollcall's "-1,X|Y" notation)

comment:7 Changed 8 years ago by ibboard

Resolution: fixed
Status: acceptedclosed

Should be done now. Left "requires no more than" alone as the old text says "Note that -2,X,-2,Y is equivalent to -2,X|Y with the exception that two entries produce two warning messages." and we're already effectively giving one warning anyway.

Note: See TracTickets for help on using tickets.