Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 16, 2005, 11:08:33 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: some changes in the character_attributes, projectile and weapon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/character_attributes.cc

    r3582 r3583  
    4949 */
    5050void CharacterAttributes::setHealth(int health)
    51 {}
     51{
     52  this->health = health;
     53}
    5254
    5355/**
    5456   \brief adds health to the charater
    5557   \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
    5759 */
    5860int 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}
    6071
    6172/**
     
    6576 */
    6677bool 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}
    6887
    6988/**
     
    7291 */
    7392int CharacterAttributes::getHealth()
    74 {}
     93{
     94  return this->health;
     95}
    7596
    7697
     
    82103 */
    83104void CharacterAttributes::setHealthMax(int healthMax)
    84 {}
     105{
     106  this->healthMax = healthMax;
     107}
    85108
    86109/**
     
    89112 */
    90113int CharacterAttributes::getHealthMax()
    91 {}
     114{
     115  return this->healthMax;
     116}
    92117
    93118
     
    98123 */
    99124void CharacterAttributes::setShieldStrength(int shieldStrength)
    100 {}
     125{
     126  this->shieldStrength = shieldStrength;
     127}
    101128
    102129/**
    103130   \brief adds shield strength
    104131   \param strength
     132   
     133   there is currently no limit to shieldstrength
    105134 */
    106135void CharacterAttributes::addShieldStrength(int shiledStrength)
    107 {}
     136{
     137  this->shieldStrength += shieldStrength;
     138}
    108139
    109140/**
    110141   \brief substracts shield strength
    111142   \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
    113144 */
    114145int 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}
    116155
    117156/**
     
    120159 */
    121160int CharacterAttributes::getShieldStrength()
    122 {}
     161{
     162  return this->shieldStrength;
     163}
    123164
    124165
     
    127168   \brief sets the amount of base damage dealt to all aircrafts
    128169   \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)
    129174 */
    130175void CharacterAttributes::setDamageToAirCraft(int damage)
    131 {}
     176{
     177  this->damageToAirCraft = damage;
     178}
    132179
    133180/**
    134181   \brief gets the amount of base damage
    135182   \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)
    136187 */
    137188int CharacterAttributes::getDamageToAirCraft()
    138 {}
     189{
     190  return this->damageToAirCraft;
     191}
    139192
    140193
     
    142195   \brief sets the amount of base damage dealt to all groundcrafts
    143196   \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)
    144201 */
    145202void CharacterAttributes::setDamageToGroundCraft(int damage)
    146 {}
     203{
     204  this->damageToGroundCraft = damage;
     205}
    147206
    148207/**
    149208   \briefgets the amount of base damage
    150209   \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)
    151214 */
    152215int CharacterAttributes::getDamageToGroundCraft()
    153 {}
     216{
     217  return this->damageToGroundCraft;
     218}
    154219
    155220
     
    161226 */
    162227void CharacterAttributes::setDamageLaserModifier(float modifier)
    163 {}
     228{
     229  this->damageLaserModifier = modifier;
     230}
    164231
    165232/**
     
    170237 */
    171238float CharacterAttributes::getDamageLaserModifier()
    172 {}
     239{
     240  return this->damageLaserModifier;
     241}
    173242
    174243
     
    180249 */
    181250void CharacterAttributes::setDamagePlasmaModifier(float modifier)
    182 {}
     251{
     252  this->damagePlasmaModifier = modifier;
     253}
    183254
    184255/**
     
    189260 */
    190261float CharacterAttributes::getDamagePlasmaModifier()
    191 {}
     262{
     263  return this->damagePlasmaModifier;
     264}
    192265
    193266
     
    199272 */
    200273void CharacterAttributes::setDamageExplosiveModifier(float modifier)
    201 {}
     274{
     275  this->damageExplosiveModifier = modifier;
     276}
    202277
    203278/**
     
    208283 */
    209284float CharacterAttributes::getDamageExplosiveModifier()
    210 {}
     285{
     286  return this->damageExplosiveModifier;
     287}
    211288
    212289
     
    217294 */
    218295void CharacterAttributes::setEnergy(int energy)
    219 {}
     296{
     297  this->energy = energy;
     298}
    220299
    221300/**
     
    225304 */
    226305int 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}
    228316
    229317/**
     
    233321 */
    234322bool 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}
    236332
    237333/**
     
    240336 */
    241337int CharacterAttributes::getEnergy()
    242 {}
     338{
     339  return this->energy;
     340}
    243341
    244342
     
    247345   \param amount of energy
    248346*/
    249 void setEnergyConsumption(int energy)
    250 {}
     347void CharacterAttributes::setEnergyConsumption(int energy)
     348{
     349  this->energyConsumption = energy;
     350}
    251351
    252352/**
     
    254354   \returns amount of energy
    255355*/
    256 int getEnergyConsumption()
    257 {}
     356int CharacterAttributes::getEnergyConsumption()
     357{
     358  return this->energyConsumption;
     359}
    258360 
    259361
     
    262364   \param amount of energy
    263365*/
    264 void setEnergyMax(int energy)
    265 {}
     366void CharacterAttributes::setEnergyMax(int energy)
     367{
     368  this->energyMax = energy;
     369}
    266370
    267371/**
     
    269373   \returns amount of energy
    270374*/
    271 int getEnergyMax()
    272 {}
     375int CharacterAttributes::getEnergyMax()
     376{
     377  return this->energyMax;
     378}
Note: See TracChangeset for help on using the changeset viewer.