weaponMgr.cpp

Go to the documentation of this file.
00001 /*
00002  * weaponMgr.cpp
00003  *
00004  *  Created on: Feb 28, 2012
00005  *      Author: sushil
00006  */
00007 
00008 #include <weaponMgr.h>
00009 #include <engine.h>
00010 #include <enums.h>
00011 
00012 FastEcslent::WeaponMgr::WeaponMgr(Engine *eng, Options opts): Mgr(eng) {
00013         options = opts;
00014         //establish weapon mapping
00015 }
00016 
00017 void FastEcslent::WeaponMgr::mapWeaponTypeToEntityType(){
00018         //float templatedDamageMap[NWEAPONTYPES][NENTITYTYPES] = {5,       2,        10, //Cigarette
00019                                                           //Rifle,  Flamer,  Shell
00020         float templatedDamageMap[NENTITYTYPES][NWEAPONTYPES] = {{5,       2,        10}, //Cigarette
00021                                                                         {5,       2,        10}, //Speedboat
00022                                                                         {1,       1,         2}, //DDG51
00023                                                                         {1,       1,         2}, //CVN68
00024                                                                         {2,       2,         4}, //SLEEK
00025                                                                         {1,       5,         1}, //AlienShip
00026                                                                         {0,       0,         0}, //Barracks
00027                                                                         {0,       0,         0}, //Barracks
00028                                                                         {0,       0,         0}, //Barracks
00029                                                                         {0,       0,         0}, //Barracks
00030                                                                         {0,       0,         0}, //Barracks
00031                                                                         {0,       0,         0}, //Barracks
00032                                                                         {0,       0,         0}, //Barracks
00033                                                                         {0,       0,         0}, //Barracks
00034                                                                         {0,       0,         0}, //Barracks
00035                                                                         {0,       0,         0}, //Barracks
00036         };
00037 
00038         //easier than reading from a file
00039         for(int i = 0; i < NWEAPONTYPES; i++){
00040                 for(int j = 0; j < NENTITYTYPES; j++){
00041                         damageMap[i][j] = templatedDamageMap[i][j];
00042                 }
00043         }
00044 
00045         float templatedRange[NWEAPONTYPES] = {400, 200, 800};
00046         for(int i = 0; i < NWEAPONTYPES; i++){
00047                 range[i] = templatedRange[i];
00048         }
00049 
00050 
00051 }
00052 
00053 void FastEcslent::WeaponMgr::fixFightingProperties(){
00054         for (int entType = 0; entType < NENTITYTYPES; entType++){
00055                 switch(entType){
00056                 case MARINE:
00057                         maxHitpoints[MARINE] = 50.0;
00058                         initArmor[MARINE]     = 1.0;
00059                         initDamageMultiplier[MARINE] = 1.0;
00060                         break;
00061                 case REAPER:
00062                         maxHitpoints[REAPER] = 50.0;
00063                         initArmor[REAPER]     = 1.0;
00064                         initDamageMultiplier[REAPER] = 1.0;
00065                         break;
00066                 case TANK:
00067                         maxHitpoints[TANK] = 200.0;
00068                         initArmor[TANK]     = 1.0;
00069                         initDamageMultiplier[TANK] = 1.0;
00070                         break;
00071                 case THOR:
00072                         maxHitpoints[THOR] = 300.0;
00073                         initArmor[THOR]     = 1.0f;
00074                         initDamageMultiplier[THOR] = 1.0f;
00075                         break;
00076                 case MARAUDER:
00077                         maxHitpoints[MARAUDER] = 100;
00078                         initArmor[MARAUDER]     = 1.0;
00079                         initDamageMultiplier[MARAUDER] = 1.0;
00080                         break;
00081                 case HELLION:
00082                         maxHitpoints[HELLION] = 70;
00083                         initArmor[HELLION]     = 1.0;
00084                         initDamageMultiplier[HELLION] = 1.0;
00085                         break;
00086                         //-----------------------------------------------------
00087                 case BARRACKS:
00088                         maxHitpoints[BARRACKS] = 1000;
00089                         initArmor[BARRACKS]    = 1.0;
00090                         initDamageMultiplier[BARRACKS] = 1.0;
00091                 case FACTORY:
00092                         maxHitpoints[FACTORY] = 1000;
00093                         initArmor[FACTORY]    = 1.0;
00094                         initDamageMultiplier[FACTORY] = 1.0;
00095                 case ARMORY:
00096                         maxHitpoints[ARMORY] = 1000;
00097                         initArmor[ARMORY]    = 1.0;
00098                         initDamageMultiplier[ARMORY] = 1.0;
00099                 case ENGINEERINGBAY:
00100                         maxHitpoints[ENGINEERINGBAY] = 1000;
00101                         initArmor[ENGINEERINGBAY]    = 1.0;
00102                         initDamageMultiplier[ENGINEERINGBAY] = 1.0;
00103                         break;
00104                 case SCV:
00105                         maxHitpoints[SCV] = 50;
00106                         initArmor[SCV]    = 1.0;
00107                         initDamageMultiplier[SCV] = 1.0;
00108                         break;
00109                 case GAS:
00110                         maxHitpoints[GAS] = 10000000;
00111                         initArmor[GAS]    = 1.0;
00112                         initDamageMultiplier[GAS] = 1.0;
00113                         break;
00114                 case MINERALS:
00115                         maxHitpoints[MINERALS] = 10000000;
00116                         initArmor[MINERALS]    = 1.0;
00117                         initDamageMultiplier[MINERALS] = 1.0;
00118                         break;
00119                 case COMMANDCENTER:
00120                         maxHitpoints[COMMANDCENTER] = 1500;
00121                         initArmor[COMMANDCENTER]    = 1.0;
00122                         initDamageMultiplier[COMMANDCENTER]= 1.0;
00123                         break;
00124                 default:
00125                         DEBUG(std::cerr << "Unknown Entity Type in WeaponManager. Need to exit" << std::endl;)
00126                         break;
00127                 }
00128         }
00129 }
00130 
00131 
00132 
00133 
00134 void FastEcslent::WeaponMgr::init(){
00135         //establish weaponType, entityType damage mapping
00136         mapWeaponTypeToEntityType();
00137         fixFightingProperties();
00138 
00139 }
00140 
00141 
00142 void FastEcslent::WeaponMgr::tick(double dt){
00143 
00144 }

Generated on Fri Dec 13 14:54:19 2013 for FastECSLent by  doxygen 1.5.4