Fixed a couple of merc stat issues and a few bot aggro issues, removed unneeded bot pet AI.

This commit is contained in:
badcaptain 2013-04-25 00:42:52 -04:00
parent b15cb08f54
commit e2f25d1c92
6 changed files with 37 additions and 82 deletions

View File

@ -1,5 +1,11 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 04/24/2013 ==
Bad_Captain: Fixed a couple of merc stat issues.
Bad_Captain: Removed unneeded bot pet AI.
Bad_Captain: Fixed a few bot aggro issues. (Uleat)
== 04/20/2013 ==
JJ: Fixed rare case where heals from buffs could go negative.

View File

@ -1083,6 +1083,15 @@ void Mob::AI_Process() {
RemoveFromHateList(this);
return;
}
#ifdef BOTS
if (IsPet() && GetOwner()->IsBot() && target == GetOwner())
{
// this blocks all pet attacks against owner..bot pet test (copied above check)
RemoveFromHateList(this);
return;
}
#endif //BOTS
if(DivineAura())
return;

View File

@ -3122,10 +3122,6 @@ bool Bot::Process()
// Bot AI
AI_Process();
// Bot Pet AI
if(HasPet())
PetAIProcess();
return true;
}
@ -3581,8 +3577,8 @@ void Bot::AI_Process() {
if(!IsEngaged()) {
if(GetFollowID()) {
if(BotOwner && BotOwner->CastToClient()->AutoAttackEnabled() && BotOwner->GetTarget() &&
BotOwner->GetTarget()->IsNPC() && BotOwner->GetTarget()->GetHateAmount(BotOwner)) {
if(BotOwner && BotOwner->GetTarget() && BotOwner->GetTarget()->IsNPC() && (BotOwner->GetTarget()->GetHateAmount(BotOwner)
|| BotOwner->CastToClient()->AutoAttackEnabled()) && IsAttackAllowed(BotOwner->GetTarget())) {
AddToHateList(BotOwner->GetTarget(), 1);
if(HasPet())
@ -3594,11 +3590,12 @@ void Bot::AI_Process() {
if(g) {
for(int counter = 0; counter < g->GroupCount(); counter++) {
if(g->members[counter]) {
if(g->members[counter]->IsEngaged() && g->members[counter]->GetTarget()) {
AddToHateList(g->members[counter]->GetTarget(), 1);
Mob* tar = g->members[counter]->GetTarget();
if(tar && tar->IsNPC() && tar->GetHateAmount(g->members[counter]) && IsAttackAllowed(g->members[counter]->GetTarget())) {
AddToHateList(tar, 1);
if(HasPet())
GetPet()->AddToHateList(g->members[counter]->GetTarget(), 1);
GetPet()->AddToHateList(tar, 1);
break;
}
@ -6364,6 +6361,10 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillType attack_skil
SendHPUpdate();
if(this == from) {
return;
}
// Aggro the bot's group members
if(IsGrouped())
{
@ -6372,7 +6373,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillType attack_skil
{
for(int i=0; i<MAX_GROUP_MEMBERS; i++)
{
if(g->members[i] && g->members[i]->IsBot() && from && !g->members[i]->CheckAggro(from))
if(g->members[i] && g->members[i]->IsBot() && from && !g->members[i]->CheckAggro(from) && g->members[i]->IsAttackAllowed(from))
{
g->members[i]->AddToHateList(from, 1);
}
@ -9034,7 +9035,12 @@ bool Bot::IsBotAttackAllowed(Mob* attacker, Mob* target, bool& hasRuleDefined)
if(attacker && target)
{
if(attacker->IsClient() && target->IsBot() && attacker->CastToClient()->GetPVP() && target->CastToBot()->GetBotOwner()->CastToClient()->GetPVP())
if(attacker == target)
{
hasRuleDefined = true;
Result = false;
}
else if(attacker->IsClient() && target->IsBot() && attacker->CastToClient()->GetPVP() && target->CastToBot()->GetBotOwner()->CastToClient()->GetPVP())
{
hasRuleDefined = true;
Result = true;

View File

@ -308,7 +308,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
continue;
// no buffs with illusions.. use #bot command to cast illusions
if(IsEffectInSpell(selectedBotSpell.SpellId, SE_Illusion))
if(IsEffectInSpell(selectedBotSpell.SpellId, SE_Illusion) && tar != this)
continue;
//no teleport spells use #bot command to cast teleports

View File

@ -61,6 +61,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
skills[r] = database.GetSkillCap(GetClass(),(SkillType)r,GetLevel());
}
GetMercSize();
CalcBonuses();
SetHP(GetMaxHP());
@ -80,7 +81,6 @@ Merc::~Merc() {
void Merc::CalcBonuses()
{
//_ZP(Merc_CalcBonuses);
GenerateBaseStats();
memset(&itembonuses, 0, sizeof(StatBonuses));
memset(&aabonuses, 0, sizeof(StatBonuses));
CalcItemBonuses(&itembonuses);
@ -117,59 +117,7 @@ void Merc::CalcBonuses()
rooted = FindType(SE_Root);
}
void Merc::GenerateBaseStats() {
// base stats
uint16 Strength = _baseSTR;
uint16 Stamina = _baseSTA;
uint16 Dexterity = _baseDEX;
uint16 Agility = _baseAGI;
uint16 Wisdom = _baseWIS;
uint16 Intelligence = _baseINT;
uint16 Charisma = _baseCHA;
uint16 Attack = _baseATK;
uint16 MagicResist = _baseMR;
uint16 FireResist = _baseFR;
uint16 DiseaseResist = _baseDR;
uint16 PoisonResist = _basePR;
uint16 ColdResist = _baseCR;
uint16 CorruptionResist = _baseCorrup;
switch(this->GetClass()) {
case 1: // Warrior
Strength += 10;
Stamina += 20;
Agility += 10;
Dexterity += 10;
Attack += 12;
break;
case 2: // Cleric
Strength += 5;
Stamina += 5;
Agility += 10;
Wisdom += 30;
Attack += 8;
break;
case 4: // Ranger
Strength += 15;
Stamina += 10;
Agility += 10;
Wisdom += 15;
Attack += 17;
break;
case 9: // Rogue
Strength += 10;
Stamina += 20;
Agility += 10;
Dexterity += 10;
Attack += 12;
break;
case 12: // Wizard
Stamina += 20;
Intelligence += 30;
Attack += 5;
break;
}
void Merc::GetMercSize() {
float MercSize = GetSize();
@ -220,20 +168,6 @@ void Merc::GenerateBaseStats() {
break;
}
this->_baseSTR = Strength;
this->_baseSTA = Stamina;
this->_baseDEX = Dexterity;
this->_baseAGI = Agility;
this->_baseWIS = Wisdom;
this->_baseINT = Intelligence;
this->_baseCHA = Charisma;
this->_baseATK = Attack;
this->_baseMR = MagicResist;
this->_baseFR = FireResist;
this->_baseDR = DiseaseResist;
this->_basePR = PoisonResist;
this->_baseCR = ColdResist;
this->_baseCorrup = CorruptionResist;
this->size = MercSize;
}
@ -940,7 +874,7 @@ int16 Merc::CalcCorrup()
}
int16 Merc::CalcATK() {
ATK = _baseATK + itembonuses.ATK + spellbonuses.ATK + aabonuses.ATK + GroupLeadershipAAOffenseEnhancement() + ((GetSTR() + GetSkill(OFFENSE)) * 9 / 10);
ATK = _baseATK + itembonuses.ATK + spellbonuses.ATK + aabonuses.ATK + GroupLeadershipAAOffenseEnhancement();
return(ATK);
}

View File

@ -328,7 +328,7 @@ private:
int GroupLeadershipAAHealthRegeneration();
int GroupLeadershipAAOffenseEnhancement();
void GenerateBaseStats();
void GetMercSize();
void GenerateAppearance();
bool LoadMercSpells();