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::fixFightingProperties(){ 00018 for (int entType = 0; entType < NENTITYTYPES; entType++){ 00019 switch(entType){ 00020 case SCV: 00021 maxHitpoints[SCV] = 50; 00022 initArmor[SCV] = 1.0; 00023 initDamageMultiplier[SCV] = 1.0; 00024 weaponType[SCV] = &WeaponTypes::Fusion_Cutter; 00025 break; 00026 case MARINE: 00027 maxHitpoints[MARINE] = 50.0; 00028 initArmor[MARINE] = 1.0; 00029 initDamageMultiplier[MARINE] = 1.0; 00030 weaponType[MARINE] = &WeaponTypes::Rifle; 00031 break; 00032 case REAPER: 00033 maxHitpoints[REAPER] = 60.0; 00034 initArmor[REAPER] = 1.0; 00035 initDamageMultiplier[REAPER] = 1.0; 00036 weaponType[REAPER] = &WeaponTypes::Rifle; 00037 break; 00038 case TANK: 00039 maxHitpoints[TANK] = 160.0; 00040 initArmor[TANK] = 1.0; 00041 initDamageMultiplier[TANK] = 1.0; 00042 weaponType[TANK] = &WeaponTypes::Cannon; 00043 break; 00044 case THOR: 00045 maxHitpoints[THOR] = 400.0; 00046 initArmor[THOR] = 1.0f; 00047 initDamageMultiplier[THOR] = 1.0f; 00048 weaponType[THOR] = &WeaponTypes::Cannon; 00049 break; 00050 case MARAUDER: 00051 maxHitpoints[MARAUDER] = 125; 00052 initArmor[MARAUDER] = 1.0; 00053 initDamageMultiplier[MARAUDER] = 1.0; 00054 weaponType[MARAUDER] = &WeaponTypes::Cannon; 00055 break; 00056 case HELLION: 00057 maxHitpoints[HELLION] = 70; 00058 initArmor[HELLION] = 1.0; 00059 initDamageMultiplier[HELLION] = 1.0; 00060 weaponType[HELLION] = &WeaponTypes::Hellfire; 00061 break; 00062 //----------------------------------------------------- 00063 case BARRACKS: 00064 maxHitpoints[BARRACKS] = 1000; 00065 initArmor[BARRACKS] = 1.0; 00066 initDamageMultiplier[BARRACKS] = 1.0; 00067 weaponType[BARRACKS] = &WeaponTypes::None; 00068 break; 00069 case FACTORY: 00070 maxHitpoints[FACTORY] = 1000; 00071 initArmor[FACTORY] = 1.0; 00072 initDamageMultiplier[FACTORY] = 1.0; 00073 weaponType[FACTORY] = &WeaponTypes::None; 00074 break; 00075 case ARMORY: 00076 maxHitpoints[ARMORY] = 1000; 00077 initArmor[ARMORY] = 1.0; 00078 initDamageMultiplier[ARMORY] = 1.0; 00079 weaponType[ARMORY] = &WeaponTypes::None; 00080 break; 00081 case ENGINEERINGBAY: 00082 maxHitpoints[ENGINEERINGBAY] = 1000; 00083 initArmor[ENGINEERINGBAY] = 1.0; 00084 initDamageMultiplier[ENGINEERINGBAY] = 1.0; 00085 weaponType[ENGINEERINGBAY] = &WeaponTypes::None; 00086 break; 00087 case REFINERY: 00088 maxHitpoints[REFINERY] = 500; 00089 initArmor[REFINERY] = 1.0; 00090 initDamageMultiplier[REFINERY] = 1.0; 00091 weaponType[REFINERY] = &WeaponTypes::None; 00092 break; 00093 case GAS: 00094 maxHitpoints[GAS] = 10000000; 00095 initArmor[GAS] = 1.0; 00096 initDamageMultiplier[GAS] = 1.0; 00097 weaponType[GAS] = &WeaponTypes::None; 00098 break; 00099 case MINERALS: 00100 maxHitpoints[MINERALS] = 10000000; 00101 initArmor[MINERALS] = 1.0; 00102 initDamageMultiplier[MINERALS] = 1.0; 00103 weaponType[MINERALS] = &WeaponTypes::None; 00104 break; 00105 case COMMANDCENTER: 00106 maxHitpoints[COMMANDCENTER] = 1500; 00107 initArmor[COMMANDCENTER] = 1.0; 00108 initDamageMultiplier[COMMANDCENTER]= 1.0; 00109 weaponType[COMMANDCENTER] = &WeaponTypes::None; 00110 break; 00111 default: 00112 DEBUG(std::cerr << "Unknown Entity Type in WeaponManager. Need to exit" << std::endl;) 00113 break; 00114 } 00115 } 00116 } 00117 00118 00119 00120 00121 void FastEcslent::WeaponMgr::init(){ 00122 //establish weaponType, entityType damage mapping 00123 fixFightingProperties(); 00124 00125 FastEcslent::ExplosionTypes::init(); 00126 FastEcslent::WeaponTypes::init(); 00127 } 00128 00129 00130 void FastEcslent::WeaponMgr::tick(double dt){ 00131 00132 }