Merge pull request #1 from EQEmu/master

Merge EQEMU
This commit is contained in:
Kemmler
2013-04-28 04:20:55 -07:00
17 changed files with 1619 additions and 685 deletions
+9
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;
+17 -11
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;
}
@@ -6370,6 +6367,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())
{
@@ -6378,7 +6379,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);
}
@@ -9045,7 +9046,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;
+1 -1
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
+3 -69
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);
}
+1 -1
View File
@@ -328,7 +328,7 @@ private:
int GroupLeadershipAAHealthRegeneration();
int GroupLeadershipAAOffenseEnhancement();
void GenerateBaseStats();
void GetMercSize();
void GenerateAppearance();
bool LoadMercSpells();
+37 -35
View File
@@ -1178,7 +1178,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
{
Gate();
}
// solar: shadow step is handled by client already, nothing required
// shadow step is handled by client already, nothing required
break;
}
@@ -1189,7 +1189,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
#endif
if (spells[spell_id].base[i] == 1)
BuffFadeByEffect(SE_Blind);
// solar: handled by client
// handled by client
// TODO: blind flag?
break;
}
@@ -1369,7 +1369,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
#ifdef SPELL_EFFECT_SPAM
snprintf(effect_desc, _EDLEN, "Spin: %d", effect_value);
#endif
// solar: the spinning is handled by the client
// the spinning is handled by the client
int max_level = spells[spell_id].max[i];
if(max_level == 0)
max_level = RuleI(Spells, BaseImmunityLevel); // Default max is 55 level limit
@@ -1383,7 +1383,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
}
else
{
// solar: the spinning is handled by the client
// the spinning is handled by the client
// Stun duration is based on the effect_value, not the buff duration(alot don't have buffs)
Stun(effect_value);
if(!IsClient()) {
@@ -2004,7 +2004,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
#ifdef SPELL_EFFECT_SPAM
snprintf(effect_desc, _EDLEN, "Call Pet");
#endif
// solar: this is cast on self, not on the pet
// this is cast on self, not on the pet
if(GetPet() && GetPet()->IsNPC())
{
GetPet()->CastToNPC()->GMMove(GetX(), GetY(), GetZ(), GetHeading());
@@ -2015,7 +2015,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
case SE_StackingCommand_Block:
case SE_StackingCommand_Overwrite:
{
// solar: these are special effects used by the buff stuff
// these are special effects used by the buff stuff
break;
}
@@ -2100,7 +2100,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
#ifdef SPELL_EFFECT_SPAM
snprintf(effect_desc, _EDLEN, "Skill Attack");
#endif
/*Kayen:
/*
Weapon Damage = spells[spell_id].base[i]
Chance to Hit Bonus = spells[spell_id].base2[i]
???? = spells[spell_id].max[i] - MOST of the effects have this value.
@@ -2812,11 +2812,10 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level,
return(effect_value);
}
// solar: generic formula calculations
// generic formula calculations
int Mob::CalcSpellEffectValue_formula(int formula, int base, int max, int caster_level, uint16 spell_id, int ticsremaining)
{
/*
neotokyo: i need those formulas checked!!!!
0 = base
1 - 99 = base + level * formulaID
@@ -2845,8 +2844,11 @@ neotokyo: i need those formulas checked!!!!
int result = 0, updownsign = 1, ubase = base;
if(ubase < 0)
ubase = 0 - ubase;
int level_diff = caster_level - GetMinLevel(spell_id);
if (level_diff < 0)
level_diff = 0;
// solar: this updown thing might look messed up but if you look at the
// this updown thing might look messed up but if you look at the
// spells it actually looks like some have a positive base and max where
// the max is actually less than the base, hence they grow downward
/*
@@ -2875,17 +2877,17 @@ snare has both of them negative, yet their range should work the same:
case 70:
result = ubase/100; break;
case 0:
case 100: // solar: confirmed 2/6/04
case 100: // confirmed 2/6/04
result = ubase; break;
case 101: // solar: confirmed 2/6/04
case 101: // confirmed 2/6/04
result = updownsign * (ubase + (caster_level / 2)); break;
case 102: // solar: confirmed 2/6/04
case 102: // confirmed 2/6/04
result = updownsign * (ubase + caster_level); break;
case 103: // solar: confirmed 2/6/04
case 103: // confirmed 2/6/04
result = updownsign * (ubase + (caster_level * 2)); break;
case 104: // solar: confirmed 2/6/04
case 104: // confirmed 2/6/04
result = updownsign * (ubase + (caster_level * 3)); break;
case 105: // solar: confirmed 2/6/04
case 105: // confirmed 2/6/04
result = updownsign * (ubase + (caster_level * 4)); break;
case 107:
@@ -2893,35 +2895,35 @@ snare has both of them negative, yet their range should work the same:
result = updownsign * (ubase + (caster_level / 2)); break;
case 108:
result = updownsign * (ubase + (caster_level / 3)); break;
case 109: // solar: confirmed 2/6/04
case 109: // confirmed 2/6/04
result = updownsign * (ubase + (caster_level / 4)); break;
case 110: // solar: confirmed 2/6/04
case 110: // confirmed 2/6/04
//is there a reason we dont use updownsign here???
result = ubase + (caster_level / 5); break;
case 111:
result = updownsign * (ubase + 6 * (caster_level - GetMinLevel(spell_id))); break;
result = updownsign * (ubase + 6 * level_diff); break;
case 112:
result = updownsign * (ubase + 8 * (caster_level - GetMinLevel(spell_id))); break;
result = updownsign * (ubase + 8 * level_diff); break;
case 113:
result = updownsign * (ubase + 10 * (caster_level - GetMinLevel(spell_id))); break;
result = updownsign * (ubase + 10 * level_diff); break;
case 114:
result = updownsign * (ubase + 15 * (caster_level - GetMinLevel(spell_id))); break;
result = updownsign * (ubase + 15 * level_diff); break;
//these formula were updated according to lucy 10/16/04
case 115: // solar: this is only in symbol of transal
result = ubase + 6 * (caster_level - GetMinLevel(spell_id)); break;
case 116: // solar: this is only in symbol of ryltan
result = ubase + 8 * (caster_level - GetMinLevel(spell_id)); break;
case 117: // solar: this is only in symbol of pinzarn
result = ubase + 12 * (caster_level - GetMinLevel(spell_id)); break;
case 118: // solar: used in naltron and a few others
result = ubase + 20 * (caster_level - GetMinLevel(spell_id)); break;
case 115: // this is only in symbol of transal
result = ubase + 6 * level_diff; break;
case 116: // this is only in symbol of ryltan
result = ubase + 8 * level_diff; break;
case 117: // this is only in symbol of pinzarn
result = ubase + 12 * level_diff; break;
case 118: // used in naltron and a few others
result = ubase + 20 * level_diff; break;
case 119: // solar: confirmed 2/6/04
case 119: // confirmed 2/6/04
result = ubase + (caster_level / 8); break;
case 121: // solar: corrected 2/6/04
case 121: // corrected 2/6/04
result = ubase + (caster_level / 3); break;
case 122:
{
@@ -2933,7 +2935,7 @@ snare has both of them negative, yet their range should work the same:
result = updownsign * (ubase - (12 * ticdif));
break;
}
case 123: // solar: added 2/6/04
case 123: // added 2/6/04
result = MakeRandomInt(ubase, abs(max));
break;
@@ -3304,7 +3306,7 @@ void Mob::DoBuffTic(uint16 spell_id, uint32 ticsremaining, uint8 caster_level, M
}
}
// solar: removes the buff in the buff slot 'slot'
// removes the buff in the buff slot 'slot'
void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
{
if(slot < 0 || slot > GetMaxTotalSlots())
@@ -5317,7 +5319,7 @@ int32 Mob::GetAdditionalDamage(Mob *caster, uint32 spell_id, bool use_skill, uin
int32 Mob::ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard) {
//Kayen 9-17-12: This is likely causing crashes, disabled till can resolve.
//9-17-12: This is likely causing crashes, disabled till can resolve.
if (IsBard)
return value;