mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
[Bots] Add Support for AA bonuses that were missing. (#2764)
* [Bots] Add Support for AA bonuses that were missing. * Fix GetFocusEffect, add virtual override to Bot to prevent using NPC
This commit is contained in:
parent
900837f633
commit
a16f21d6fe
@ -3544,7 +3544,7 @@ bool Mob::HasProcs() const
|
||||
}
|
||||
}
|
||||
|
||||
if (IsClient()) {
|
||||
if (IsClient() || IsBot()) {
|
||||
for (int i = 0; i < MAX_AA_PROCS; i += 4) {
|
||||
if (aabonuses.SpellProc[i]) {
|
||||
return true;
|
||||
@ -3562,7 +3562,7 @@ bool Mob::HasDefensiveProcs() const
|
||||
}
|
||||
}
|
||||
|
||||
if (IsClient()) {
|
||||
if (IsClient() || IsBot()) {
|
||||
for (int i = 0; i < MAX_AA_PROCS; i += 4) {
|
||||
if (aabonuses.DefensiveProc[i]) {
|
||||
return true;
|
||||
@ -3598,7 +3598,7 @@ bool Mob::HasRangedProcs() const
|
||||
}
|
||||
}
|
||||
|
||||
if (IsClient()) {
|
||||
if (IsClient() || IsBot()) {
|
||||
for (int i = 0; i < MAX_AA_PROCS; i += 4) {
|
||||
if (aabonuses.RangedProc[i]) {
|
||||
return true;
|
||||
@ -4367,7 +4367,7 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) {
|
||||
}
|
||||
|
||||
//AA Procs
|
||||
if (IsClient()){
|
||||
if (IsClient() || IsBot()){
|
||||
for (int i = 0; i < MAX_AA_PROCS; i += 4) {
|
||||
int32 aa_rank_id = aabonuses.DefensiveProc[i + +SBIndex::COMBAT_PROC_ORIGIN_ID];
|
||||
int32 aa_spell_id = aabonuses.DefensiveProc[i + SBIndex::COMBAT_PROC_SPELL_ID];
|
||||
@ -4625,7 +4625,7 @@ void Mob::TrySpellProc(const EQ::ItemInstance *inst, const EQ::ItemData *weapon,
|
||||
}
|
||||
|
||||
//AA Melee and Ranged Procs
|
||||
if (IsClient()) {
|
||||
if (IsClient() || IsBot()) {
|
||||
for (int i = 0; i < MAX_AA_PROCS; i += 4) {
|
||||
|
||||
int32 aa_rank_id = 0;
|
||||
|
||||
@ -374,6 +374,8 @@ public:
|
||||
virtual bool DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQ::spells::CastingSlot slot);
|
||||
virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQ::spells::CastingSlot slot = EQ::spells::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1,
|
||||
uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 aa_id = 0);
|
||||
inline int64 GetFocusEffect(focusType type, uint16 spell_id, Mob *caster = nullptr, bool from_buff_tic = false) override
|
||||
{ return Mob::GetFocusEffect(type, spell_id, caster, from_buff_tic); }
|
||||
|
||||
bool GetBotOwnerDataBuckets();
|
||||
bool GetBotDataBuckets();
|
||||
|
||||
21
zone/mob.cpp
21
zone/mob.cpp
@ -3261,10 +3261,6 @@ const int64& Mob::SetMana(int64 amount)
|
||||
CalcMaxMana();
|
||||
int64 mmana = GetMaxMana();
|
||||
current_mana = amount < 0 ? 0 : (amount > mmana ? mmana : amount);
|
||||
/*
|
||||
if(IsClient())
|
||||
LogFile->write(EQEMuLog::Debug, "Setting mana for %s to %d (%4.1f%%)", GetName(), amount, GetManaRatio());
|
||||
*/
|
||||
|
||||
return current_mana;
|
||||
}
|
||||
@ -4162,8 +4158,8 @@ void Mob::ExecWeaponProc(const EQ::ItemInstance *inst, uint16 spell_id, Mob *on,
|
||||
bool twinproc = false;
|
||||
int32 twinproc_chance = 0;
|
||||
|
||||
if (IsClient()) {
|
||||
twinproc_chance = CastToClient()->GetFocusEffect(focusTwincast, spell_id);
|
||||
if (IsClient() || IsBot()) {
|
||||
twinproc_chance = GetFocusEffect(focusTwincast, spell_id);
|
||||
}
|
||||
|
||||
if (twinproc_chance && zone->random.Roll(twinproc_chance)) {
|
||||
@ -4642,18 +4638,21 @@ void Mob::TryTriggerOnCastRequirement()
|
||||
//Twincast Focus effects should stack across different types (Spell, AA - when implemented ect)
|
||||
void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id)
|
||||
{
|
||||
if(!IsValidSpell(spell_id))
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(IsClient())
|
||||
if (IsClient() || IsBot())
|
||||
{
|
||||
int focus = CastToClient()->GetFocusEffect(focusTwincast, spell_id);
|
||||
int focus = GetFocusEffect(focusTwincast, spell_id);
|
||||
|
||||
if (focus > 0)
|
||||
{
|
||||
if(zone->random.Roll(focus))
|
||||
if (zone->random.Roll(focus))
|
||||
{
|
||||
Message(Chat::Spells,"You twincast %s!", spells[spell_id].name);
|
||||
if (IsClient()) {
|
||||
Message(Chat::Spells,"You twincast %s!", spells[spell_id].name);
|
||||
}
|
||||
SpellFinished(spell_id, target, EQ::spells::CastingSlot::Item, 0, -1, spells[spell_id].resist_difficulty);
|
||||
}
|
||||
}
|
||||
|
||||
@ -717,14 +717,16 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
caster->MessageString(Chat::SpellFailure, IMMUNE_STUN);
|
||||
} else {
|
||||
int stun_resist = itembonuses.StunResist+spellbonuses.StunResist;
|
||||
if (IsClient())
|
||||
if (IsClient() || IsBot()) {
|
||||
stun_resist += aabonuses.StunResist;
|
||||
}
|
||||
|
||||
if (stun_resist <= 0 || zone->random.Int(0,99) >= stun_resist) {
|
||||
LogCombat("Stunned. We had [{}] percent resist chance", stun_resist);
|
||||
|
||||
if (caster && caster->IsClient())
|
||||
if (caster && (caster->IsClient() || caster->IsBot())) {
|
||||
effect_value += effect_value*caster->GetFocusEffect(focusFcStunTimeMod, spell_id)/100;
|
||||
}
|
||||
|
||||
Stun(effect_value);
|
||||
} else {
|
||||
@ -807,7 +809,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
buffs[buffslot].ticsremaining = resistMod * buffs[buffslot].ticsremaining / 100;
|
||||
}
|
||||
|
||||
if(IsClient())
|
||||
if (IsClient() || IsBot())
|
||||
{
|
||||
if(buffs[buffslot].ticsremaining > RuleI(Character, MaxCharmDurationForPlayerCharacter))
|
||||
buffs[buffslot].ticsremaining = RuleI(Character, MaxCharmDurationForPlayerCharacter);
|
||||
@ -865,21 +867,22 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
#ifdef SPELL_EFFECT_SPAM
|
||||
snprintf(effect_desc, _EDLEN, "Fear: %+i", effect_value);
|
||||
#endif
|
||||
if(IsClient())
|
||||
if (IsClient() || IsBot())
|
||||
{
|
||||
if(buffs[buffslot].ticsremaining > RuleI(Character, MaxFearDurationForPlayerCharacter))
|
||||
if (buffs[buffslot].ticsremaining > RuleI(Character, MaxFearDurationForPlayerCharacter)) {
|
||||
buffs[buffslot].ticsremaining = RuleI(Character, MaxFearDurationForPlayerCharacter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(RuleB(Combat, EnableFearPathing)){
|
||||
if(IsClient())
|
||||
if (RuleB(Combat, EnableFearPathing)) {
|
||||
if (IsClient())
|
||||
{
|
||||
CastToClient()->AI_Start();
|
||||
}
|
||||
|
||||
CalculateNewFearpoint();
|
||||
if(currently_fleeing)
|
||||
if (currently_fleeing)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@ -5199,30 +5199,28 @@ int16 Mob::CalcResistChanceBonus()
|
||||
{
|
||||
int resistchance = spellbonuses.ResistSpellChance + itembonuses.ResistSpellChance;
|
||||
|
||||
if(IsClient())
|
||||
if (IsClient() || IsBot()) {
|
||||
resistchance += aabonuses.ResistSpellChance;
|
||||
|
||||
}
|
||||
return resistchance;
|
||||
}
|
||||
|
||||
int16 Mob::CalcFearResistChance()
|
||||
{
|
||||
int resistchance = spellbonuses.ResistFearChance + itembonuses.ResistFearChance;
|
||||
if(IsClient()) {
|
||||
if (IsClient() || IsBot()) {
|
||||
resistchance += aabonuses.ResistFearChance;
|
||||
if(aabonuses.Fearless == true)
|
||||
if (aabonuses.Fearless == true) {
|
||||
resistchance = 100;
|
||||
}
|
||||
}
|
||||
if(spellbonuses.Fearless == true || itembonuses.Fearless == true)
|
||||
if (spellbonuses.Fearless == true || itembonuses.Fearless == true) {
|
||||
resistchance = 100;
|
||||
}
|
||||
|
||||
return resistchance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param spell_id
|
||||
* @return
|
||||
*/
|
||||
float Mob::GetAOERange(uint16 spell_id)
|
||||
{
|
||||
float range = spells[spell_id].aoe_range;
|
||||
@ -5941,7 +5939,7 @@ bool Mob::IsCombatProc(uint16 spell_id) {
|
||||
}
|
||||
}
|
||||
|
||||
if (IsClient()) {
|
||||
if (IsClient() || IsBot()) {
|
||||
for (int i = 0; i < MAX_AA_PROCS; i += 4) {
|
||||
if (aabonuses.SpellProc[i + 1] == spell_id ||
|
||||
aabonuses.RangedProc[i + 1] == spell_id ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user