Changeset 9950 in orxonox.OLD for branches/playability/src/world_entities/space_ships/space_ship.cc
- Timestamp:
- Nov 23, 2006, 11:44:35 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/space_ships/space_ship.cc
r9869 r9950 521 521 522 522 523 524 523 int SpaceShip::getShieldCur () { return this->shieldCur; } 524 int SpaceShip::getShieldMax () { return this->shieldMax; } 525 526 int SpaceShip::getArmorCur () { return this->armorCur; } 527 int SpaceShip::getArmorMax () { return this->armorMax; } 528 529 int SpaceShip::getElectronicCur () { return this->electronicCur; } 530 int SpaceShip::getElectronicMax () { return this->electronicMax; } 531 532 void SpaceShip::damage(int pDamage, int eDamage){ 533 if( this->shieldActive) { 534 if( this->shieldCur > pDamage) { 535 this->shieldCur = this->shieldCur - pDamage; 536 } 537 else { // shield <= pDamage 538 this->shieldCur = 0; 539 this->shieldActive = false; //shield collaptses 540 pDamage = pDamage - this->shieldCur; 541 if( !this->shieldActive) { 542 this->armorCur = this->armorCur - pDamage / 2; // remaining damages hits armor at half rate 543 this->electronicCur = this->electronicCur - eDamage; 544 } 545 } 546 } 547 else { 548 this->armorCur = this->armorCur - pDamage; 549 this->electronicCur = this->electronicCur - eDamage; 550 } 551 if( this->armorCur <= 0) { /* FIXME implement shipcrash*/ } 552 } 553 554 void SpaceShip::shield(){ 555 int time = 1; // FIXME implement tick time calculation 556 if( this->shieldCur + this->shieldRegen * time > shieldMax) 557 this->shield = this->shieldMax; 558 else 559 this-shieldCur = this->shieldCur + this->shieldRegen * time; 560 561 if( this->shieldCur > shieldTH) 562 this->shieldActive = true; 563 } 564
Note: See TracChangeset
for help on using the changeset viewer.