Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 24, 2006, 9:10:24 AM (18 years ago)
Author:
nicolasc
Message:

renamed shield() to regen as Regenration Handler, defined damage in projectile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r9950 r9953  
    540540      pDamage = pDamage - this->shieldCur;
    541541      if( !this->shieldActive) {
    542         this->armorCur = this->armorCur -  pDamage / 2; // remaining damages hits armor at half rate
    543         this->electronicCur = this->electronicCur - eDamage;
     542        this->armorCur = pDamage / 2; // remaining damages hits armor at half rate
     543        this->electronicCur -= eDamage;
    544544      }
    545545    }
     
    552552}
    553553
    554 void SpaceShip::shield(){
     554void SpaceShip::regen(){
    555555  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 
     556  if (this->shieldCur == this->shieldMax){}
     557  else {
     558    if( this->shieldCur + this->shieldRegen * time > shieldMax)
     559      this->shieldCur = this->shieldMax;
     560    else
     561      this->shieldCur += this->shieldRegen * time;
     562    if( this->shieldCur > shieldTH)
     563      this->shieldActive = true;
     564  }
     565  if (this->electronicCur == this->electronicMax){}
     566  else{
     567    if (this->electronicCur + this->electronicRegen * time > electronicMax)
     568      this->electronicCur = this->electronicMax;
     569    else
     570      this->electronicCur += this->electronicRegen * time;
     571  }
     572}
     573
Note: See TracChangeset for help on using the changeset viewer.