No looting if you attack units in same faction
This commit is contained in:
parent
68455a819f
commit
3cae2559c7
|
@ -2573,6 +2573,8 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac
|
||||||
attacker->incKills(attacked->getTeam());
|
attacker->incKills(attacked->getTeam());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform resource looting iff the attack is from a different faction
|
||||||
|
if(attacker->getFaction() != attacked->getFaction()) {
|
||||||
int lootableResourceCount = attacked->getType()->getLootableResourceCount();
|
int lootableResourceCount = attacked->getType()->getLootableResourceCount();
|
||||||
for(int i = 0; i < lootableResourceCount; i++) {
|
for(int i = 0; i < lootableResourceCount; i++) {
|
||||||
LootableResource resource = attacked->getType()->getLootableResource(i);
|
LootableResource resource = attacked->getType()->getLootableResource(i);
|
||||||
|
@ -2600,6 +2602,7 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac
|
||||||
attacker->getFaction()->incResourceAmount(resource.getResourceType(), min(resource.getAmountValue(), factionTotalResource));
|
attacker->getFaction()->incResourceAmount(resource.getResourceType(), min(resource.getAmountValue(), factionTotalResource));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch(this->game->getGameSettings()->getPathFinderType()) {
|
switch(this->game->getGameSettings()->getPathFinderType()) {
|
||||||
case pfBasic:
|
case pfBasic:
|
||||||
|
|
Loading…
Reference in New Issue