Changeset 10627
- Timestamp:
- Oct 6, 2015, 9:37:11 PM (9 years ago)
- Location:
- code/branches/towerdefenseFabien
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFabien/data/levels/towerDefense.oxw
r10606 r10627 143 143 </links> 144 144 <Weapon> 145 <SplitGun mode=0 munitionpershot=0 damage=9.3 muzzleoffset=" 1.6, 1.3, -2.0" splittime=0.2 numberofsplits=2 numberofchilds=5 spread=0.1 />145 <SplitGun mode=0 munitionpershot=0 damage=9.3 muzzleoffset=" 1.6, 1.3, -2.0" splittime=0.2 numberofsplits=2 numberofchilds=5 spread=0.1 damagereduction=3.0 /> 146 146 </Weapon> 147 147 </WeaponPack> -
code/branches/towerdefenseFabien/src/modules/weapons/munitions/CMakeLists.txt
r7846 r10627 4 4 FusionMunition.cc 5 5 RocketMunition.cc 6 SplitMunition.cc 7 IceMunition.cc 6 8 ) -
code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc
r10606 r10627 49 49 this->numberOfSplits_ = 0; 50 50 this->numberOfChilds_ = 0; 51 this->splitTime_ = 1.0; 52 this->spread_ = 0.2; 51 this->splitTime_ = 1.0f; 52 this->spread_ = 0.2f; 53 this->damageReduction_ = 1.0f; 53 54 } 54 55 … … 96 97 void SplitGunProjectile::setSpread(float spread) 97 98 { 98 spread_ = spread; 99 this->spread_ = spread; 100 } 101 102 /** 103 @brief 104 This is the setter function for the damageReduction_ variable. The value of the variable is bounded between 0 and 1. 105 */ 106 void SplitGunProjectile::setDamageReduction(float damageReduction) 107 { 108 this->damageReduction_ = (damageReduction >= 0.0f ? damageReduction : 1.0f); 99 109 } 100 110 … … 109 119 -- numberOfSplits_; 110 120 111 // Reduce damage of this projectile by the number of childs plus one. This way the total amount of possible damage contained in the original projectile and its childs is unchanged after s aplit.112 this->setDamage(this->getDamage() /(numberOfChilds_+1));121 // Reduce damage of this projectile 122 this->setDamage(this->getDamage() * this->damageReduction_ / (this->numberOfChilds_+1)); 113 123 114 124 // Calculate a normalized vector (velocityOffset) that is perpendicluar to the velocity of this projectile. Since there are infinitly many perpendicular vectors a random one is chosen. … … 138 148 projectile->setSplitTime(this->splitTime_); 139 149 projectile->setSpread(this->spread_); 150 projectile->setDamageReduction(this->damageReduction_); 140 151 141 152 projectile->setShooter(this->getShooter()); -
code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.h
r10606 r10627 61 61 virtual void setSplitTime(float splitTime); 62 62 virtual void setSpread(float spread); 63 virtual void setDamageReduction(float damageReduction); 63 64 64 65 private: … … 67 68 float splitTime_; 68 69 float spread_; 70 float damageReduction_; //The damage of a child projectile is reduced by this factor 69 71 Timer splitTimer_; 70 72 -
code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/IceGun.cc
r10608 r10627 54 54 this->reloadTime_ = 1.0f; 55 55 this->damage_ = 0.0f; 56 this->speed_ = 750.0f;56 this->speed_ = 1200.0f; 57 57 58 58 this->setFreezeTime(3.0); -
code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.cc
r10606 r10627 56 56 this->numberOfSplits_ = 2; 57 57 this->numberOfChilds_ = 3; 58 this->splitTime_ = 0.3; 59 this->spread_ = 0.1; 58 this->splitTime_ = 0.3f; 59 this->spread_ = 0.1f; 60 this->damageReduction_ = 1.0f; 60 61 61 this->setMunitionName(" LaserMunition");62 this->setMunitionName("SplitMunition"); 62 63 this->setDefaultSound("sounds/Weapon_LightningGun.ogg"); 63 64 } … … 79 80 XMLPortParam(SplitGun, "splittime", setSplitTime, getSplitTime, xmlelement, mode); 80 81 XMLPortParam(SplitGun, "spread", setSpread, getSpread, xmlelement, mode); 82 XMLPortParam(SplitGun, "damagereduction", setDamageReduction, getDamageReduction, xmlelement, mode); 81 83 } 82 84 … … 95 97 projectile->setVelocity(this->getMuzzleDirection() * this->speed_); 96 98 97 // Pass important information to the projectile: Number of splits, Number of childs, split time, spread 99 // Pass important information to the projectile: Number of splits, Number of childs, split time, spread and the damage reduction 98 100 projectile->setNumberOfSplits(getNumberOfSplits()); 99 101 projectile->setNumberOfChilds(getNumberOfChilds()); 100 102 projectile->setSplitTime(getSplitTime()); 101 103 projectile->setSpread(getSpread()); 104 projectile->setDamageReduction(getDamageReduction()); 102 105 103 106 projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); -
code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.h
r10606 r10627 73 73 inline float getSpread() const 74 74 { return this->spread_; } 75 inline void setDamageReduction(float damageReduction) 76 { this->damageReduction_ = (damageReduction >= 0.0f ? damageReduction : 1.0f); } 77 inline float getDamageReduction() const 78 { return this->damageReduction_; } 75 79 76 80 private: … … 80 84 float splitTime_; //The time between creation of the projectile and the split of the projectile 81 85 float spread_; //Low spread means that the child projectiles are concentrated in a small area 86 float damageReduction_; //The damage of a child projectile is reduced by this factor 82 87 }; 83 88 }
Note: See TracChangeset
for help on using the changeset viewer.