*Creatures with the same faction should always be friendly to each other. This fix the bug that creatures with the same faction fight earch other.

*Allow "chain effect" when creatures call assistance.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-11-23 13:58:06 -06:00
parent fb64da2182
commit 8d687761bc
4 changed files with 18 additions and 4 deletions
+2 -1
View File
@@ -1891,7 +1891,8 @@ void Creature::CallAssistence()
for(std::list<Creature*>::iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
{
(*iter)->SetNoCallAssistence(true);
//(*iter)->SetNoCallAssistence(true);
(*iter)->CombatStart(getVictim());
if((*iter)->AI())
(*iter)->AI()->AttackStart(getVictim());
}
+3
View File
@@ -783,6 +783,9 @@ namespace Trinity
if(u->getFaction() != i_funit->getFaction() )
return false;
if(!u->isAggressive())
return false;
// only free creature
if( u->GetCharmerOrOwnerGUID() )
return false;
+8 -2
View File
@@ -8486,10 +8486,16 @@ void Unit::CombatStart(Unit* target)
if(!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER
&& ((Creature*)target)->isAggressive() && ((Creature*)target)->AI())
((Creature*)target)->AI()->AttackStart(this);
{
SetInCombatWith(target);
target->SetInCombatWith(this);
((Creature*)target)->AI()->AttackStart(this);
}
else
{
SetInCombatWith(target);
target->SetInCombatWith(this);
}
if(Player* attackedPlayer = target->GetCharmerOrOwnerPlayerOrPlayerItself())
SetContestedPvP(attackedPlayer);
+4
View File
@@ -229,6 +229,8 @@ struct FactionTemplateEntry
// helpers
bool IsFriendlyTo(FactionTemplateEntry const& entry) const
{
if(ID == entry.ID)
return true;
if(enemyFaction1 == entry.faction || enemyFaction2 == entry.faction || enemyFaction3 == entry.faction || enemyFaction4 == entry.faction )
return false;
if(friendFaction1 == entry.faction || friendFaction2 == entry.faction || friendFaction3 == entry.faction || friendFaction4 == entry.faction )
@@ -237,6 +239,8 @@ struct FactionTemplateEntry
}
bool IsHostileTo(FactionTemplateEntry const& entry) const
{
if(ID == entry.ID)
return false;
if(enemyFaction1 == entry.faction || enemyFaction2 == entry.faction || enemyFaction3 == entry.faction || enemyFaction4 == entry.faction )
return true;
if(friendFaction1 == entry.faction || friendFaction2 == entry.faction || friendFaction3 == entry.faction || friendFaction4 == entry.faction )