- no longer allow killing self or team to update your skill levels
This commit is contained in:
parent
b180581bf8
commit
16ea7881ab
|
@ -242,6 +242,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType
|
||||||
animProgress= 0;
|
animProgress= 0;
|
||||||
progress2= 0;
|
progress2= 0;
|
||||||
kills= 0;
|
kills= 0;
|
||||||
|
enemyKills = 0;
|
||||||
loadCount= 0;
|
loadCount= 0;
|
||||||
ep= 0;
|
ep= 0;
|
||||||
deadCount= 0;
|
deadCount= 0;
|
||||||
|
@ -1444,9 +1445,9 @@ string Unit::getDesc() const {
|
||||||
|
|
||||||
//kills
|
//kills
|
||||||
const Level *nextLevel= getNextLevel();
|
const Level *nextLevel= getNextLevel();
|
||||||
if(kills>0 || nextLevel!=NULL){
|
if(enemyKills > 0 || nextLevel != NULL) {
|
||||||
str+= "\n" + lang.get("Kills") +": " + intToStr(kills);
|
str+= "\n" + lang.get("Kills") +": " + intToStr(enemyKills);
|
||||||
if(nextLevel!=NULL){
|
if(nextLevel != NULL) {
|
||||||
str+= " (" + nextLevel->getName() + ": " + intToStr(nextLevel->getKills()) + ")";
|
str+= " (" + nextLevel->getName() + ": " + intToStr(nextLevel->getKills()) + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1509,17 +1510,20 @@ void Unit::computeTotalUpgrade(){
|
||||||
faction->getUpgradeManager()->computeTotalUpgrade(this, &totalUpgrade);
|
faction->getUpgradeManager()->computeTotalUpgrade(this, &totalUpgrade);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::incKills(){
|
void Unit::incKills(int team) {
|
||||||
++kills;
|
++kills;
|
||||||
|
if(team != this->getTeam()) {
|
||||||
|
++enemyKills;
|
||||||
|
}
|
||||||
|
|
||||||
const Level *nextLevel= getNextLevel();
|
const Level *nextLevel= getNextLevel();
|
||||||
if(nextLevel!=NULL && kills>= nextLevel->getKills()){
|
if(nextLevel != NULL && enemyKills >= nextLevel->getKills()) {
|
||||||
level= nextLevel;
|
level= nextLevel;
|
||||||
int maxHp= totalUpgrade.getMaxHp();
|
int maxHp= totalUpgrade.getMaxHp();
|
||||||
totalUpgrade.incLevel(type);
|
totalUpgrade.incLevel(type);
|
||||||
|
|
||||||
checkItemInVault(&this->hp,this->hp);
|
checkItemInVault(&this->hp,this->hp);
|
||||||
hp += totalUpgrade.getMaxHp()-maxHp;
|
hp += totalUpgrade.getMaxHp() - maxHp;
|
||||||
addItemToVault(&this->hp,this->hp);
|
addItemToVault(&this->hp,this->hp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2143,6 +2147,7 @@ std::string Unit::toString() const {
|
||||||
result += " highlight = " + floatToStr(this->highlight);
|
result += " highlight = " + floatToStr(this->highlight);
|
||||||
result += " progress2 = " + intToStr(this->progress2);
|
result += " progress2 = " + intToStr(this->progress2);
|
||||||
result += " kills = " + intToStr(this->kills);
|
result += " kills = " + intToStr(this->kills);
|
||||||
|
result += " enemyKills = " + intToStr(this->enemyKills);
|
||||||
result += "\n";
|
result += "\n";
|
||||||
|
|
||||||
// WARNING!!! Don't access the Unit pointer in this->targetRef in this method or it causes
|
// WARNING!!! Don't access the Unit pointer in this->targetRef in this method or it causes
|
||||||
|
|
|
@ -262,6 +262,7 @@ private:
|
||||||
float highlight;
|
float highlight;
|
||||||
int progress2;
|
int progress2;
|
||||||
int kills;
|
int kills;
|
||||||
|
int enemyKills;
|
||||||
|
|
||||||
UnitReference targetRef;
|
UnitReference targetRef;
|
||||||
|
|
||||||
|
@ -376,7 +377,8 @@ public:
|
||||||
float getRotation() const {return rotation;}
|
float getRotation() const {return rotation;}
|
||||||
float getVerticalRotation() const;
|
float getVerticalRotation() const;
|
||||||
ParticleSystem *getFire() const {return fire;}
|
ParticleSystem *getFire() const {return fire;}
|
||||||
int getKills() {return kills;}
|
int getKills() const {return kills;}
|
||||||
|
int getEnemyKills() const {return enemyKills;}
|
||||||
const Level *getLevel() const {return level;}
|
const Level *getLevel() const {return level;}
|
||||||
const Level *getNextLevel() const;
|
const Level *getNextLevel() const;
|
||||||
string getFullName() const;
|
string getFullName() const;
|
||||||
|
@ -459,7 +461,7 @@ public:
|
||||||
void tick();
|
void tick();
|
||||||
void applyUpgrade(const UpgradeType *upgradeType);
|
void applyUpgrade(const UpgradeType *upgradeType);
|
||||||
void computeTotalUpgrade();
|
void computeTotalUpgrade();
|
||||||
void incKills();
|
void incKills(int team);
|
||||||
bool morph(const MorphCommandType *mct);
|
bool morph(const MorphCommandType *mct);
|
||||||
CommandResult checkCommand(Command *command) const;
|
CommandResult checkCommand(Command *command) const;
|
||||||
void applyCommand(Command *command);
|
void applyCommand(Command *command);
|
||||||
|
|
|
@ -1865,7 +1865,7 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac
|
||||||
//damage the unit
|
//damage the unit
|
||||||
if(attacked->decHp(static_cast<int>(damage))){
|
if(attacked->decHp(static_cast<int>(damage))){
|
||||||
world->getStats()->kill(attacker->getFactionIndex(), attacked->getFactionIndex(), attacker->getTeam() != attacked->getTeam());
|
world->getStats()->kill(attacker->getFactionIndex(), attacked->getFactionIndex(), attacker->getTeam() != attacked->getTeam());
|
||||||
attacker->incKills();
|
attacker->incKills(attacked->getTeam());
|
||||||
|
|
||||||
switch(this->game->getGameSettings()->getPathFinderType()) {
|
switch(this->game->getGameSettings()->getPathFinderType()) {
|
||||||
case pfBasic:
|
case pfBasic:
|
||||||
|
|
Loading…
Reference in New Issue