home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / Games / Empire-0.6-MIS / Unit.h < prev    next >
Encoding:
Text File  |  1997-10-27  |  4.8 KB  |  181 lines

  1. //
  2. // $Id: Unit.h,v 1.5 1997/10/27 08:28:27 nygard Exp $
  3. //
  4.  
  5. //
  6. //  This file is a part of Empire, a game of exploration and conquest.
  7. //  Copyright (C) 1996  Steve Nygard
  8. //
  9. //  This program is free software; you can redistribute it and/or modify
  10. //  it under the terms of the GNU General Public License as published by
  11. //  the Free Software Foundation; either version 2 of the License, or
  12. //  (at your option) any later version.
  13. //
  14. //  This program is distributed in the hope that it will be useful,
  15. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. //  GNU General Public License for more details.
  18. //
  19. //  You should have received a copy of the GNU General Public License
  20. //  along with this program; if not, write to the Free Software
  21. //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. //
  23. //  You may contact the author by:
  24. //     e-mail:  nygard@telusplanet.net
  25. //
  26.  
  27. #import <AppKit/AppKit.h>
  28. #import "Empire.h"
  29.  
  30. @class City;
  31. @class EmPlayer;
  32. @class Order;
  33.  
  34. //======================================================================
  35.  
  36. @interface Unit : NSObject
  37. {
  38.     UnitType unitType;
  39.     EmPlayer *owner;
  40.  
  41.     NSString *unitName;
  42.     EMMapLocation unitLocation;
  43.  
  44.     int currentHitPoints;
  45.     int currentRange;
  46.     int fuel;
  47.  
  48.     Order *order;
  49.  
  50.     BOOL isDestroyed;
  51.     BOOL isDoneTurn;
  52.  
  53.     NSMutableArray *cargo;
  54.  
  55.     Unit *onBoard; // The ship we are on board, if any.
  56.     City *withinCity;
  57. }
  58.  
  59. + (void) initialize;
  60.  
  61. - initWithUnitType:(UnitType)aUnitType inCity:(City *)producingCity;
  62. - (void) dealloc;
  63.  
  64. - (NSString *) description;
  65.  
  66. //======================================================================
  67. // General static values
  68. //======================================================================
  69.  
  70. - (UnitType) unitType;
  71. - (EmPlayer *) owner;
  72. - (Player) playerNumber;
  73. - (NSString *) unitName;
  74. - (BOOL) isAShip;
  75.  
  76. //======================================================================
  77. // Combat information
  78. //======================================================================
  79.  
  80. - (int) currentHitPoints;
  81.  
  82. // Intrinsic values
  83. - (int) maxHitPoints;
  84. - (int) damagePerHit;
  85.  
  86. // These values have NOT been adjusted by player efficiencies.
  87. - (float) attackFactor;
  88. - (float) defenseFactor:(BOOL)bombardment;
  89.  
  90. - (BOOL) canBombard;
  91.  
  92. //======================================================================
  93. // Movement information
  94. //======================================================================
  95.  
  96. - (int) currentRange;
  97. - (int) remainingFuel;
  98.  
  99. - (BOOL) canMoveOnTerrain:(Terrain)terrain;
  100. - (MovementType) movementType;
  101.  
  102. - (EMMapLocation) unitLocation;
  103. - (void) setLocation:(EMMapLocation)newLocation;
  104. - (void) takeLocationFromTransport;
  105.  
  106. //======================================================================
  107. // Display
  108. //======================================================================
  109.  
  110. - (Icon) icon;
  111. - (NSImage *) iconImage;
  112.  
  113. //======================================================================
  114. // Order support
  115. //======================================================================
  116.  
  117. - (void) setOrder:(Order *)newOrder;
  118. - (Order *) currentOrder;
  119. - (BOOL) isSentried;
  120. - (int) remainingCargoCapacity;
  121. - (BOOL) isFull;
  122.  
  123. //======================================================================
  124. // Turn handling
  125. //======================================================================
  126.  
  127. - (void) repairDamage;
  128. - (void) refuel;
  129. - (void) resetRange;
  130.  
  131. - (void) skipMove;
  132. - (void) useSkippedFuel;
  133. - (void) moved;
  134.  
  135. - (BOOL) isFinishedMoving;
  136. - (void) setUnitFinishedMoving:(BOOL)flag;
  137.  
  138. - (BOOL) tryToMove; // Maybe under order support?
  139.  
  140. //======================================================================
  141. // Human UI support
  142. //======================================================================
  143.  
  144. - (NSString *) statusLine;
  145.  
  146. //======================================================================
  147. // Commands
  148. //======================================================================
  149.  
  150. - (void) unloadShip;
  151. - (void) destroyUnit:(BOOL)disbanded;
  152. - (BOOL) loadUnit:(Unit *)aUnit;
  153.  
  154. //======================================================================
  155. // Combat Support
  156. //======================================================================
  157.  
  158. - (BOOL) hitForDamage:(int)damage;
  159. - (CombatProfile) combatProfileAgainstBombardment:(BOOL)bombarding;
  160.  
  161. //======================================================================
  162. // Other
  163. //======================================================================
  164.  
  165. - (BOOL) isOnBoardShip;
  166. - (BOOL) isInCity;
  167. - (BOOL) hasBeenDestroyed;
  168.  
  169. - (City *) city;
  170. - (void) setCity:(City *)aCity;
  171.  
  172. // If this unit is aboard a ship, this method returns the containing ship.
  173. - (Unit *) shipOnBoard;
  174. - (void) setOnBoardShip:(Unit *)ship;
  175.  
  176. // Shared with City..
  177. - (void) unitDidExit:(Unit *)aUnit;
  178. - (void) unitDidEnter:(Unit *)aUnit;
  179.  
  180. @end
  181.