Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9953 in orxonox.OLD


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

Location:
branches/playability/src/world_entities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/projectiles/projectile.cc

    r9869 r9953  
    145145}
    146146
     147
     148
     149int Projectile::getPhysDamage () { return this->physDamage; }
     150
     151int Projectile::getElecDamage () { return this->elecDamage; }
  • branches/playability/src/world_entities/projectiles/projectile.h

    r9869 r9953  
    5050    inline bool tickLifeCycle(float dt ) { this->lifeCycle += dt/this->lifeSpan;  return(unlikely(this->lifeCycle >= 1)); }
    5151
     52    virtual int getPhysDamage();
     53    virtual int getElecDamage();
    5254
    5355  protected:
     
    6971    OrxSound::SoundBuffer  explosionBuffer;
    7072    OrxSound::SoundBuffer  engineBuffer;
     73
     74    int                     physDamage;               //!< damage to shield and armor
     75    int                     elecDamage;               //!< damage to elctronic
    7176};
    7277
  • 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
  • branches/playability/src/world_entities/space_ships/space_ship.h

    r9950 r9953  
    6565    void calculateVelocity(float time);
    6666
    67     void shield();  //!< shield handeler
     67    void regen();  //!< handler for shield and electronic regeneration
    6868
    6969    //ship atributes
     
    8080    int         electronicCur;      //!< current electronic
    8181    int         electronicMax;      //!< maximum electronic
     82    int         electronicRegen;    //!< electronic regenration rate
    8283
    8384    int         engineSpeedCur;     //!< speed output
Note: See TracChangeset for help on using the changeset viewer.