Changeset 9950 in orxonox.OLD for branches/playability/src/world_entities/space_ships
- Timestamp:
- Nov 23, 2006, 11:44:35 AM (18 years ago)
- Location:
- branches/playability/src/world_entities/space_ships
- Files:
-
- 2 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 -
branches/playability/src/world_entities/space_ships/space_ship.h
r9949 r9950 47 47 virtual void process(const Event &event); 48 48 49 //Functions for GUI 50 virtual int getShieldCur(); //!< returns current shield value 51 virtual int getShieldMax(); //!< returns maximum shield value 52 53 virtual int getArmorCur(); //!< returns current armor value 54 virtual int getArmorMax(); //!< returns current armor value 55 56 virtual int getElectronicCur(); //!< returns current electronic value 57 virtual int getElectronicMax(); //!< returns current electronic value 58 59 //damage handler 60 virtual void damage(int pDamage, int eDamage); //!< pDamage physical damage, eDamage electronic damage 61 49 62 private: 50 63 void init(); … … 52 65 void calculateVelocity(float time); 53 66 67 void shield(); //!< shield handeler 54 68 55 int shield; //!< current shield 56 int shieldMax; //!< maximum shield 57 float shieldEnergyShare; //!< percentage of reactor output 69 //ship atributes 70 int shieldCur; //!< current shield 71 int shieldMax; //!< maximum shield 72 float shieldEnergyShare; //!< percentage of reactor output 73 int shieldRegen; //!< shield regeneration rate 74 int shieldTH; //!< shield threshhold for reactivation 75 bool shieldActive; //!< wheather the shield is working 58 76 59 int armor;//!< current armor60 int armorMax;//!< maximum armor77 int armorCur; //!< current armor 78 int armorMax; //!< maximum armor 61 79 62 int electronic;//!< current electronic63 int electronicMax;//!< maximum electronic80 int electronicCur; //!< current electronic 81 int electronicMax; //!< maximum electronic 64 82 65 int engineSpeed;//!< speed output66 intenginePowerConsume; //!< energy needed67 float engineEnergyShare;//!< percentage of reactor output83 int engineSpeedCur; //!< speed output 84 int enginePowerConsume; //!< energy needed 85 float engineEnergyShare; //!< percentage of reactor output 68 86 69 int weaponEnergySlot;//!< number of energy weapon slots70 intweaponEnergyUsed;71 floatweaponEnergyShare;72 int weaponSpecialSlot;//!< number of special weapon slots73 intweaponSpecialUsed;87 int weaponEnergySlot; //!< number of energy weapon slots 88 int weaponEnergyUsed; 89 float weaponEnergyShare; 90 int weaponSpecialSlot; //!< number of special weapon slots 91 int weaponSpecialUsed; 74 92 75 int reactorOutput;//!< reactor output76 int reactorCapacity;//!< reactor capacity93 int reactorOutput; //!< reactor output 94 int reactorCapacity; //!< reactor capacity 77 95 78 96 bool bUp; //!< up button pressed.
Note: See TracChangeset
for help on using the changeset viewer.