Changeset 3583 in orxonox.OLD for orxonox/trunk/src/world_entities/character_attributes.cc
- Timestamp:
- Mar 16, 2005, 11:08:33 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/character_attributes.cc
r3582 r3583 49 49 */ 50 50 void CharacterAttributes::setHealth(int health) 51 {} 51 { 52 this->health = health; 53 } 52 54 53 55 /** 54 56 \brief adds health to the charater 55 57 \param health 56 \returns health that couldnt be added due to healt limit 58 \returns health that couldnt be added due to healt limit, 0 if everything worked as normal 57 59 */ 58 60 int CharacterAttributes::addHealth(int health) 59 {} 61 { 62 this->health += health; 63 int rest = this->healthMax - this->health; 64 if( rest < 0) 65 { 66 this->health = this->healthMax; 67 return 0; 68 } 69 return rest; 70 } 60 71 61 72 /** … … 65 76 */ 66 77 bool CharacterAttributes::substractHealth(int health) 67 {} 78 { 79 this->health -= health; 80 if( this->health < 0) 81 { 82 this->health = 0; 83 return false; 84 } 85 return true; 86 } 68 87 69 88 /** … … 72 91 */ 73 92 int CharacterAttributes::getHealth() 74 {} 93 { 94 return this->health; 95 } 75 96 76 97 … … 82 103 */ 83 104 void CharacterAttributes::setHealthMax(int healthMax) 84 {} 105 { 106 this->healthMax = healthMax; 107 } 85 108 86 109 /** … … 89 112 */ 90 113 int CharacterAttributes::getHealthMax() 91 {} 114 { 115 return this->healthMax; 116 } 92 117 93 118 … … 98 123 */ 99 124 void CharacterAttributes::setShieldStrength(int shieldStrength) 100 {} 125 { 126 this->shieldStrength = shieldStrength; 127 } 101 128 102 129 /** 103 130 \brief adds shield strength 104 131 \param strength 132 133 there is currently no limit to shieldstrength 105 134 */ 106 135 void CharacterAttributes::addShieldStrength(int shiledStrength) 107 {} 136 { 137 this->shieldStrength += shieldStrength; 138 } 108 139 109 140 /** 110 141 \brief substracts shield strength 111 142 \param strength 112 \returns amount of shield strength below zero after substraction. Magic: Troumble 143 \returns amount of shield strength below zero after substraction. Magic: Troumble. if everything works allright, it returns 0 113 144 */ 114 145 int CharacterAttributes::substractShieldStrength(int shieldStrength) 115 {} 146 { 147 int rest = this->shieldStrength -= shieldStrength; 148 if( rest < 0) 149 { 150 this->shieldStrength = 0; 151 return -rest; 152 } 153 return 0; 154 } 116 155 117 156 /** … … 120 159 */ 121 160 int CharacterAttributes::getShieldStrength() 122 {} 161 { 162 return this->shieldStrength; 163 } 123 164 124 165 … … 127 168 \brief sets the amount of base damage dealt to all aircrafts 128 169 \param damage 170 171 There can be a difference between arms that hit a ground/air craft. Eg. 172 a tank will react differently to explosives than something in the air 173 (think about physics) 129 174 */ 130 175 void CharacterAttributes::setDamageToAirCraft(int damage) 131 {} 176 { 177 this->damageToAirCraft = damage; 178 } 132 179 133 180 /** 134 181 \brief gets the amount of base damage 135 182 \returns base damage to aircrafts 183 184 There can be a difference between arms that hit a ground/air craft. Eg. 185 a tank will react differently to explosives than something in the air 186 (think about physics) 136 187 */ 137 188 int CharacterAttributes::getDamageToAirCraft() 138 {} 189 { 190 return this->damageToAirCraft; 191 } 139 192 140 193 … … 142 195 \brief sets the amount of base damage dealt to all groundcrafts 143 196 \param damage 197 198 There can be a difference between arms that hit a ground/air craft. Eg. 199 a tank will react differently to explosives than something in the air 200 (think about physics) 144 201 */ 145 202 void CharacterAttributes::setDamageToGroundCraft(int damage) 146 {} 203 { 204 this->damageToGroundCraft = damage; 205 } 147 206 148 207 /** 149 208 \briefgets the amount of base damage 150 209 \returns base damage to groundcrafts 210 211 There can be a difference between arms that hit a ground/air craft. Eg. 212 a tank will react differently to explosives than something in the air 213 (think about physics) 151 214 */ 152 215 int CharacterAttributes::getDamageToGroundCraft() 153 {} 216 { 217 return this->damageToGroundCraft; 218 } 154 219 155 220 … … 161 226 */ 162 227 void CharacterAttributes::setDamageLaserModifier(float modifier) 163 {} 228 { 229 this->damageLaserModifier = modifier; 230 } 164 231 165 232 /** … … 170 237 */ 171 238 float CharacterAttributes::getDamageLaserModifier() 172 {} 239 { 240 return this->damageLaserModifier; 241 } 173 242 174 243 … … 180 249 */ 181 250 void CharacterAttributes::setDamagePlasmaModifier(float modifier) 182 {} 251 { 252 this->damagePlasmaModifier = modifier; 253 } 183 254 184 255 /** … … 189 260 */ 190 261 float CharacterAttributes::getDamagePlasmaModifier() 191 {} 262 { 263 return this->damagePlasmaModifier; 264 } 192 265 193 266 … … 199 272 */ 200 273 void CharacterAttributes::setDamageExplosiveModifier(float modifier) 201 {} 274 { 275 this->damageExplosiveModifier = modifier; 276 } 202 277 203 278 /** … … 208 283 */ 209 284 float CharacterAttributes::getDamageExplosiveModifier() 210 {} 285 { 286 return this->damageExplosiveModifier; 287 } 211 288 212 289 … … 217 294 */ 218 295 void CharacterAttributes::setEnergy(int energy) 219 {} 296 { 297 this->energy = energy; 298 } 220 299 221 300 /** … … 225 304 */ 226 305 int CharacterAttributes::addEnergy(int addEnergy) 227 {} 306 { 307 this->energy += addEnergy; 308 int rest = this->energyMax - this->energy; 309 if(rest < 0) 310 { 311 this->energy = 0; 312 return rest; 313 } 314 return 0; 315 } 228 316 229 317 /** … … 233 321 */ 234 322 bool CharacterAttributes::substractEnergy(int subEnergy) 235 {} 323 { 324 this->energy -= subEnergy; 325 if(this->energy < 0) 326 { 327 this->energy = 0; 328 return false; 329 } 330 return true; 331 } 236 332 237 333 /** … … 240 336 */ 241 337 int CharacterAttributes::getEnergy() 242 {} 338 { 339 return this->energy; 340 } 243 341 244 342 … … 247 345 \param amount of energy 248 346 */ 249 void setEnergyConsumption(int energy) 250 {} 347 void CharacterAttributes::setEnergyConsumption(int energy) 348 { 349 this->energyConsumption = energy; 350 } 251 351 252 352 /** … … 254 354 \returns amount of energy 255 355 */ 256 int getEnergyConsumption() 257 {} 356 int CharacterAttributes::getEnergyConsumption() 357 { 358 return this->energyConsumption; 359 } 258 360 259 361 … … 262 364 \param amount of energy 263 365 */ 264 void setEnergyMax(int energy) 265 {} 366 void CharacterAttributes::setEnergyMax(int energy) 367 { 368 this->energyMax = energy; 369 } 266 370 267 371 /** … … 269 373 \returns amount of energy 270 374 */ 271 int getEnergyMax() 272 {} 375 int CharacterAttributes::getEnergyMax() 376 { 377 return this->energyMax; 378 }
Note: See TracChangeset
for help on using the changeset viewer.