123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- #include "Skill.h"
- ActiveSkill::ActiveSkill()
- {
- active = 0;
- time = 0;
- maxTime = 0;
- reloadTimeFactor = 1;
- beschleunigungBonus = 0;
- reparaturBonus = 0;
- laserIntensityBonus = 0;
- laserEffizienzBonus = 0;
- akkuLeistungBonus = 0;
- maxEnergieBonus = 0;
- maxStabilityBonus = 0;
- laserTempoBonus = 0;
- wendigkeitBonus = 0;
- antriebEffizienzBonus = 0;
- energieSchildBonus = 0;
- energieSchildEffizienzBonus = 0;
- beschleunigungFactor = 1;
- reparaturFactor = 1;
- laserIntensityFactor = 1;
- laserEffizienzFactor = 1;
- akkuLeistungFactor = 1;
- maxEnergieFactor = 1;
- maxStabilityFactor = 1;
- laserTempoFactor = 1;
- wendigkeitFactor = 1;
- antriebEffizienzFactor = 1;
- energieSchildFactor = 1;
- energieSchildEffizienzFactor = 1;
- ref = 1;
- }
- ActiveSkill::~ActiveSkill()
- {}
- void ActiveSkill::tick( double time )
- {
- if( active )
- {
- if( this->time < time )
- active = 0;
- else
- this->time -= time;
- }
- if( !active )
- {
- this->time += time * reloadTimeFactor;
- if( this->time > maxTime )
- this->time = maxTime;
- }
- }
- bool ActiveSkill::isActive() const
- {
- return active;
- }
- void ActiveSkill::activate()
- {
- active = 1;
- }
- void ActiveSkill::reset()
- {
- time = 0;
- active = 0;
- }
- double ActiveSkill::getBeschleunigungBonus()
- {
- return active ? beschleunigungBonus : 0;
- }
- double ActiveSkill::getReparaturBonus()
- {
- return active ? reparaturBonus : 0;
- }
- double ActiveSkill::getLaserIntensityBonus()
- {
- return active ? laserIntensityBonus : 0;
- }
- double ActiveSkill::getLaserEffizienzBonus()
- {
- return active ? laserEffizienzBonus : 0;
- }
- double ActiveSkill::getAkkuLeistungBonus()
- {
- return active ? akkuLeistungBonus : 0;
- }
- double ActiveSkill::getMaxEnergieBonus()
- {
- return active ? maxEnergieBonus : 0;
- }
- double ActiveSkill::getMaxStabilityBonus()
- {
- return active ? maxStabilityBonus : 0;
- }
- double ActiveSkill::getLaserTempoBonus()
- {
- return active ? laserTempoBonus : 0;
- }
- double ActiveSkill::getWendigkeitBonus()
- {
- return active ? wendigkeitBonus : 0;
- }
- double ActiveSkill::getAntriebEffizienzBonus()
- {
- return active ? antriebEffizienzBonus : 0;
- }
- double ActiveSkill::getEnergieSchildBonus()
- {
- return active ? energieSchildBonus : 0;
- }
- double ActiveSkill::getEnergieSchildEffizienzBonus()
- {
- return active ? energieSchildEffizienzBonus : 0;
- }
- double ActiveSkill::getBeschleunigungFactor()
- {
- return active ? beschleunigungFactor : 1;
- }
- double ActiveSkill::getReparaturFactor()
- {
- return active ? reparaturFactor : 1;
- }
- double ActiveSkill::getLaserIntensityFactor()
- {
- return active ? laserIntensityFactor : 1;
- }
- double ActiveSkill::getLaserEffizienzFactor()
- {
- return active ? laserEffizienzFactor : 1;
- }
- double ActiveSkill::getAkkuLeistungFactor()
- {
- return active ? akkuLeistungFactor : 1;
- }
- double ActiveSkill::getMaxEnergieFactor()
- {
- return active ? maxEnergieFactor : 1;
- }
- double ActiveSkill::getMaxStabilityFactor()
- {
- return active ? maxStabilityFactor : 1;
- }
- double ActiveSkill::getLaserTempoFactor()
- {
- return active ? laserTempoFactor : 1;
- }
- double ActiveSkill::getWendigkeitFactor()
- {
- return active ? wendigkeitFactor : 1;
- }
- double ActiveSkill::getAntriebEffizienzFactor()
- {
- return active ? antriebEffizienzFactor : 1;
- }
- double ActiveSkill::getEnergieSchildFactor()
- {
- return active ? energieSchildFactor : 1;
- }
- double ActiveSkill::getEnergieSchildEffizienzFactor()
- {
- return active ? energieSchildEffizienzFactor : 1;
- }
- ActiveSkill *ActiveSkill::getThis()
- {
- ref++;
- return this;
- }
- ActiveSkill *ActiveSkill::release()
- {
- if( !--ref )
- delete this;
- return 0;
- }
- SpeedBoost::SpeedBoost()
- : ActiveSkill()
- {
- beschleunigungFactor = 2;
- wendigkeitFactor = 2;
- antriebEffizienzFactor = 2;
- reloadTimeFactor = 0.02;
- maxTime = 2;
- }
- ShieldBoost::ShieldBoost()
- : ActiveSkill()
- {
- energieSchildFactor = 2;
- energieSchildEffizienzFactor = 2;
- reloadTimeFactor = 0.01;
- maxTime = 1;
- }
|