Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison API/Objects/Requirement/RequirementHandler.cs @ 353:65fccdd51aec
Re #27: Unit requirements
* Add initial requirement handler class
* Add method to get requirements for army (currently falls back to Race)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 17 Apr 2011 20:08:43 +0000 |
parents | |
children | 47712a323cf2 |
comparison
equal
deleted
inserted
replaced
352:7ef9656651b5 | 353:65fccdd51aec |
---|---|
1 // This file (RequirementHandler.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2011 IBBoard | |
2 // | |
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. | |
4 using System; | |
5 | |
6 namespace IBBoard.WarFoundry.API.Objects.Requirement | |
7 { | |
8 /// <summary> | |
9 /// The requirement handler that tests the validity of armies. | |
10 /// </summary> | |
11 public class RequirementHandler | |
12 { | |
13 private RequirementHandler() | |
14 { | |
15 } | |
16 | |
17 public static Validation ValidateArmy (Army army) | |
18 { | |
19 Validation result = Validation.Passed; | |
20 | |
21 foreach (IRequirement requirement in army.GetRequirements()) | |
22 { | |
23 if (!Validates.AsOkay(requirement.ValidatesArmy(army))) | |
24 { | |
25 result = Validation.Failed; | |
26 break; | |
27 } | |
28 } | |
29 | |
30 return result; | |
31 } | |
32 } | |
33 } | |
34 |