mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[Quest API] Add Spell methods to Perl. (#1631)
* [Quest API] Add Spell methods to Perl. - Add quest::getspell(spell_id) to Perl. - Add eq.get_spell(spell_id) to Lua. These methods return a spell object. Exports $spell object references to spell events. * Formatting. * Remove comment. * Update spdat.cpp * Amplication typo. * Fix conflicts. * Remove repository changes. * Fix typing. * Update spell_effects.cpp
This commit is contained in:
+197
-197
@@ -257,30 +257,30 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
||||
}
|
||||
|
||||
for (int x1 = 0; x1 < EFFECT_COUNT; x1++) {
|
||||
switch (spell.effectid[x1]) {
|
||||
switch (spell.effect_id[x1]) {
|
||||
case SE_IllusionCopy:
|
||||
case SE_Illusion: {
|
||||
if (spell.base[x1] == -1) {
|
||||
if (spell.base_value[x1] == -1) {
|
||||
if (gender == 1)
|
||||
gender = 0;
|
||||
else if (gender == 0)
|
||||
gender = 1;
|
||||
SendIllusionPacket(GetRace(), gender, 0xFF, 0xFF);
|
||||
}
|
||||
else if (spell.base[x1] == -2) // WTF IS THIS
|
||||
else if (spell.base_value[x1] == -2) // WTF IS THIS
|
||||
{
|
||||
if (GetRace() == 128 || GetRace() == 130 || GetRace() <= 12)
|
||||
SendIllusionPacket(GetRace(), GetGender(), spell.base2[x1], spell.max[x1]);
|
||||
SendIllusionPacket(GetRace(), GetGender(), spell.limit_value[x1], spell.max_value[x1]);
|
||||
}
|
||||
else if (spell.max[x1] > 0)
|
||||
else if (spell.max_value[x1] > 0)
|
||||
{
|
||||
SendIllusionPacket(spell.base[x1], 0xFF, spell.base2[x1], spell.max[x1]);
|
||||
SendIllusionPacket(spell.base_value[x1], 0xFF, spell.limit_value[x1], spell.max_value[x1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendIllusionPacket(spell.base[x1], 0xFF, 0xFF, 0xFF);
|
||||
SendIllusionPacket(spell.base_value[x1], 0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
switch (spell.base[x1]) {
|
||||
switch (spell.base_value[x1]) {
|
||||
case OGRE:
|
||||
SendAppearancePacket(AT_Size, 9);
|
||||
break;
|
||||
@@ -367,17 +367,17 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
||||
case SE_AddMeleeProc:
|
||||
case SE_WeaponProc:
|
||||
{
|
||||
AddProcToWeapon(GetProcID(buffs[j1].spellid, x1), false, 100 + spells[buffs[j1].spellid].base2[x1], buffs[j1].spellid, buffs[j1].casterlevel);
|
||||
AddProcToWeapon(GetProcID(buffs[j1].spellid, x1), false, 100 + spells[buffs[j1].spellid].limit_value[x1], buffs[j1].spellid, buffs[j1].casterlevel);
|
||||
break;
|
||||
}
|
||||
case SE_DefensiveProc:
|
||||
{
|
||||
AddDefensiveProc(GetProcID(buffs[j1].spellid, x1), 100 + spells[buffs[j1].spellid].base2[x1], buffs[j1].spellid);
|
||||
AddDefensiveProc(GetProcID(buffs[j1].spellid, x1), 100 + spells[buffs[j1].spellid].limit_value[x1], buffs[j1].spellid);
|
||||
break;
|
||||
}
|
||||
case SE_RangedProc:
|
||||
{
|
||||
AddRangedProc(GetProcID(buffs[j1].spellid, x1), 100 + spells[buffs[j1].spellid].base2[x1], buffs[j1].spellid);
|
||||
AddRangedProc(GetProcID(buffs[j1].spellid, x1), 100 + spells[buffs[j1].spellid].limit_value[x1], buffs[j1].spellid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4937,8 +4937,8 @@ int32 Bot::CalcBotAAFocus(focusType type, uint32 aa_ID, uint32 points, uint16 sp
|
||||
bool LimitSpellSkill = false;
|
||||
bool SpellSkill_Found = false;
|
||||
uint32 effect = 0;
|
||||
int32 base1 = 0;
|
||||
int32 base2 = 0;
|
||||
int32 base_value = 0;
|
||||
int32 limit_value = 0;
|
||||
uint32 slot = 0;
|
||||
bool LimitFound = false;
|
||||
int FocusCount = 0;
|
||||
@@ -4953,8 +4953,8 @@ int32 Bot::CalcBotAAFocus(focusType type, uint32 aa_ID, uint32 points, uint16 sp
|
||||
|
||||
for(auto &eff : rank->effects) {
|
||||
effect = eff.effect_id;
|
||||
base1 = eff.base1;
|
||||
base2 = eff.base2;
|
||||
base_value = eff.base_value;
|
||||
limit_value = eff.limit_value;
|
||||
slot = eff.slot;
|
||||
|
||||
//AA Foci's can contain multiple focus effects within the same AA.
|
||||
@@ -4979,22 +4979,22 @@ int32 Bot::CalcBotAAFocus(focusType type, uint32 aa_ID, uint32 points, uint16 sp
|
||||
case SE_Blank:
|
||||
break;
|
||||
case SE_LimitResist:
|
||||
if(base1) {
|
||||
if(spell.resisttype != base1)
|
||||
if(base_value) {
|
||||
if(spell.resist_type != base_value)
|
||||
LimitFound = true;
|
||||
}
|
||||
break;
|
||||
case SE_LimitInstant:
|
||||
if(spell.buffduration)
|
||||
if(spell.buff_duration)
|
||||
LimitFound = true;
|
||||
break;
|
||||
case SE_LimitMaxLevel:
|
||||
spell_level = spell.classes[(GetClass() % 17) - 1];
|
||||
lvldiff = spell_level - base1;
|
||||
lvldiff = spell_level - base_value;
|
||||
//every level over cap reduces the effect by base2 percent unless from a clicky when ItemCastsUseFocus is true
|
||||
if(lvldiff > 0 && (spell_level <= RuleI(Character, MaxLevel) || RuleB(Character, ItemCastsUseFocus) == false)) {
|
||||
if(base2 > 0) {
|
||||
lvlModifier -= (base2 * lvldiff);
|
||||
if(limit_value > 0) {
|
||||
lvlModifier -= (limit_value * lvldiff);
|
||||
if(lvlModifier < 1)
|
||||
LimitFound = true;
|
||||
}
|
||||
@@ -5003,37 +5003,37 @@ int32 Bot::CalcBotAAFocus(focusType type, uint32 aa_ID, uint32 points, uint16 sp
|
||||
}
|
||||
break;
|
||||
case SE_LimitMinLevel:
|
||||
if((spell.classes[(GetClass() % 17) - 1]) < base1)
|
||||
if((spell.classes[(GetClass() % 17) - 1]) < base_value)
|
||||
LimitFound = true;
|
||||
break;
|
||||
case SE_LimitCastTimeMin:
|
||||
if (spell.cast_time < base1)
|
||||
if (spell.cast_time < base_value)
|
||||
LimitFound = true;
|
||||
break;
|
||||
case SE_LimitSpell:
|
||||
if(base1 < 0) {
|
||||
if (spell_id == (base1*-1))
|
||||
if(base_value < 0) {
|
||||
if (spell_id == (base_value*-1))
|
||||
LimitFound = true;
|
||||
} else {
|
||||
if (spell_id != base1)
|
||||
if (spell_id != base_value)
|
||||
LimitFound = true;
|
||||
}
|
||||
break;
|
||||
case SE_LimitMinDur:
|
||||
if (base1 > CalcBuffDuration_formula(GetLevel(), spell.buffdurationformula, spell.buffduration))
|
||||
if (base_value > CalcBuffDuration_formula(GetLevel(), spell.buff_duration_formula, spell.buff_duration))
|
||||
LimitFound = true;
|
||||
break;
|
||||
case SE_LimitEffect:
|
||||
if(base1 < 0) {
|
||||
if(IsEffectInSpell(spell_id,(base1*-1)))
|
||||
if(base_value < 0) {
|
||||
if(IsEffectInSpell(spell_id,(base_value*-1)))
|
||||
LimitFound = true;
|
||||
} else {
|
||||
if(!IsEffectInSpell(spell_id,base1))
|
||||
if(!IsEffectInSpell(spell_id,base_value))
|
||||
LimitFound = true;
|
||||
}
|
||||
break;
|
||||
case SE_LimitSpellType:
|
||||
switch(base1) {
|
||||
switch(base_value) {
|
||||
case 0:
|
||||
if (!IsDetrimentalSpell(spell_id))
|
||||
LimitFound = true;
|
||||
@@ -5046,110 +5046,110 @@ int32 Bot::CalcBotAAFocus(focusType type, uint32 aa_ID, uint32 points, uint16 sp
|
||||
break;
|
||||
|
||||
case SE_LimitManaMin:
|
||||
if(spell.mana < base1)
|
||||
if(spell.mana < base_value)
|
||||
LimitFound = true;
|
||||
break;
|
||||
case SE_LimitTarget:
|
||||
if(base1 < 0) {
|
||||
if(-base1 == spell.targettype)
|
||||
if(base_value < 0) {
|
||||
if(-base_value == spell.target_type)
|
||||
LimitFound = true;
|
||||
} else {
|
||||
if(base1 != spell.targettype)
|
||||
if(base_value != spell.target_type)
|
||||
LimitFound = true;
|
||||
}
|
||||
break;
|
||||
case SE_LimitCombatSkills:
|
||||
if((base1 == 1 && !IsDiscipline(spell_id)) || (base1 == 0 && IsDiscipline(spell_id)))
|
||||
if((base_value == 1 && !IsDiscipline(spell_id)) || (base_value == 0 && IsDiscipline(spell_id)))
|
||||
LimitFound = true;
|
||||
break;
|
||||
case SE_LimitSpellGroup:
|
||||
if((base1 > 0 && base1 != spell.spellgroup) || (base1 < 0 && base1 == spell.spellgroup))
|
||||
if((base_value > 0 && base_value != spell.spell_group) || (base_value < 0 && base_value == spell.spell_group))
|
||||
LimitFound = true;
|
||||
break;
|
||||
case SE_LimitCastingSkill:
|
||||
LimitSpellSkill = true;
|
||||
if(base1 == spell.skill)
|
||||
if(base_value == spell.skill)
|
||||
SpellSkill_Found = true;
|
||||
break;
|
||||
case SE_LimitClass:
|
||||
//Do not use this limit more then once per spell. If multiple class, treat value like items would.
|
||||
if (!PassLimitClass(base1, GetClass()))
|
||||
if (!PassLimitClass(base_value, GetClass()))
|
||||
LimitFound = true;
|
||||
break;
|
||||
//Handle Focus Effects
|
||||
case SE_ImprovedDamage:
|
||||
if (type == focusImprovedDamage && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusImprovedDamage && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_ImprovedDamage2:
|
||||
if (type == focusImprovedDamage2 && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusImprovedDamage2 && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_ImprovedHeal:
|
||||
if (type == focusImprovedHeal && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusImprovedHeal && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_ReduceManaCost:
|
||||
if (type == focusManaCost)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_IncreaseSpellHaste:
|
||||
if (type == focusSpellHaste && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusSpellHaste && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_IncreaseSpellDuration:
|
||||
if (type == focusSpellDuration && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusSpellDuration && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_SpellDurationIncByTic:
|
||||
if (type == focusSpellDurByTic && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusSpellDurByTic && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_SwarmPetDuration:
|
||||
if (type == focusSwarmPetDuration && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusSwarmPetDuration && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_IncreaseRange:
|
||||
if (type == focusRange && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusRange && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_ReduceReagentCost:
|
||||
if (type == focusReagentCost && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusReagentCost && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_PetPowerIncrease:
|
||||
if (type == focusPetPower && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusPetPower && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_SpellResistReduction:
|
||||
if (type == focusResistRate && base1 > value)
|
||||
value = base1;
|
||||
if (type == focusResistRate && base_value > value)
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_SpellHateMod:
|
||||
if (type == focusSpellHateMod) {
|
||||
if(value != 0) {
|
||||
if(value > 0) {
|
||||
if(base1 > value)
|
||||
value = base1;
|
||||
if(base_value > value)
|
||||
value = base_value;
|
||||
} else {
|
||||
if(base1 < value)
|
||||
value = base1;
|
||||
if(base_value < value)
|
||||
value = base_value;
|
||||
}
|
||||
}
|
||||
else
|
||||
value = base1;
|
||||
value = base_value;
|
||||
}
|
||||
break;
|
||||
|
||||
case SE_ReduceReuseTimer: {
|
||||
if(type == focusReduceRecastTime)
|
||||
value = (base1 / 1000);
|
||||
value = (base_value / 1000);
|
||||
break;
|
||||
}
|
||||
case SE_TriggerOnCast: {
|
||||
if(type == focusTriggerOnCast) {
|
||||
if(zone->random.Int(0, 100) <= base1)
|
||||
value = base2;
|
||||
if(zone->random.Int(0, 100) <= base_value)
|
||||
value = limit_value;
|
||||
else {
|
||||
value = 0;
|
||||
LimitFound = true;
|
||||
@@ -5159,19 +5159,19 @@ int32 Bot::CalcBotAAFocus(focusType type, uint32 aa_ID, uint32 points, uint16 sp
|
||||
}
|
||||
case SE_FcSpellVulnerability: {
|
||||
if(type == focusSpellVulnerability)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
}
|
||||
case SE_BlockNextSpellFocus: {
|
||||
if(type == focusBlockNextSpell) {
|
||||
if(zone->random.Int(1, 100) <= base1)
|
||||
if(zone->random.Int(1, 100) <= base_value)
|
||||
value = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_FcTwincast: {
|
||||
if(type == focusTwincast)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
}
|
||||
//case SE_SympatheticProc:
|
||||
@@ -5193,57 +5193,57 @@ int32 Bot::CalcBotAAFocus(focusType type, uint32 aa_ID, uint32 points, uint16 sp
|
||||
//}
|
||||
case SE_FcDamageAmt: {
|
||||
if(type == focusFcDamageAmt)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
}
|
||||
case SE_FcDamageAmt2: {
|
||||
if(type == focusFcDamageAmt2)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
}
|
||||
case SE_FcDamageAmtCrit: {
|
||||
if(type == focusFcDamageAmtCrit)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
}
|
||||
case SE_FcDamageAmtIncoming: {
|
||||
if(type == focusFcDamageAmtIncoming)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
}
|
||||
case SE_FcHealAmtIncoming:
|
||||
if(type == focusFcHealAmtIncoming)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_FcHealPctCritIncoming:
|
||||
if (type == focusFcHealPctCritIncoming)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_FcHealAmtCrit:
|
||||
if(type == focusFcHealAmtCrit)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_FcHealAmt:
|
||||
if(type == focusFcHealAmt)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_FcHealPctIncoming:
|
||||
if(type == focusFcHealPctIncoming)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
case SE_FcBaseEffects: {
|
||||
if (type == focusFcBaseEffects)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
}
|
||||
case SE_FcDamagePctCrit: {
|
||||
if(type == focusFcDamagePctCrit)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
}
|
||||
case SE_FcIncreaseNumHits: {
|
||||
if(type == focusIncreaseNumHits)
|
||||
value = base1;
|
||||
value = base_value;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -5375,7 +5375,7 @@ int32 Bot::GetBotFocusEffect(focusType bottype, uint16 spell_id) {
|
||||
realTotal2 = CalcBotFocusEffect(bottype, focusspell_tracker, spell_id);
|
||||
|
||||
// For effects like gift of mana that only fire once, save the spellid into an array that consists of all available buff slots.
|
||||
if(buff_tracker >= 0 && buffs[buff_tracker].numhits > 0)
|
||||
if(buff_tracker >= 0 && buffs[buff_tracker].hit_number > 0)
|
||||
m_spellHitsLeft[buff_tracker] = focusspell_tracker;
|
||||
}
|
||||
|
||||
@@ -5432,18 +5432,18 @@ int32 Bot::CalcBotFocusEffect(focusType bottype, uint16 focus_id, uint16 spell_i
|
||||
bool LimitSpellSkill = false;
|
||||
bool SpellSkill_Found = false;
|
||||
for (int i = 0; i < EFFECT_COUNT; i++) {
|
||||
switch (focus_spell.effectid[i]) {
|
||||
switch (focus_spell.effect_id[i]) {
|
||||
case SE_Blank:
|
||||
break;
|
||||
case SE_LimitResist:{
|
||||
if(focus_spell.base[i]) {
|
||||
if(spell.resisttype != focus_spell.base[i])
|
||||
if(focus_spell.base_value[i]) {
|
||||
if(spell.resist_type != focus_spell.base_value[i])
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_LimitInstant: {
|
||||
if(spell.buffduration)
|
||||
if(spell.buff_duration)
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
@@ -5451,10 +5451,10 @@ int32 Bot::CalcBotFocusEffect(focusType bottype, uint16 focus_id, uint16 spell_i
|
||||
if (IsNPC())
|
||||
break;
|
||||
spell_level = spell.classes[(GetClass() % 17) - 1];
|
||||
lvldiff = (spell_level - focus_spell.base[i]);
|
||||
lvldiff = (spell_level - focus_spell.base_value[i]);
|
||||
if(lvldiff > 0 && (spell_level <= RuleI(Character, MaxLevel) || RuleB(Character, ItemCastsUseFocus) == false)) {
|
||||
if(focus_spell.base2[i] > 0) {
|
||||
lvlModifier -= (focus_spell.base2[i] * lvldiff);
|
||||
if(focus_spell.limit_value[i] > 0) {
|
||||
lvlModifier -= (focus_spell.limit_value[i] * lvldiff);
|
||||
if(lvlModifier < 1)
|
||||
return 0;
|
||||
}
|
||||
@@ -5466,44 +5466,44 @@ int32 Bot::CalcBotFocusEffect(focusType bottype, uint16 focus_id, uint16 spell_i
|
||||
case SE_LimitMinLevel:
|
||||
if (IsNPC())
|
||||
break;
|
||||
if (spell.classes[(GetClass() % 17) - 1] < focus_spell.base[i])
|
||||
if (spell.classes[(GetClass() % 17) - 1] < focus_spell.base_value[i])
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case SE_LimitCastTimeMin:
|
||||
if (spells[spell_id].cast_time < (uint32)focus_spell.base[i])
|
||||
if (spells[spell_id].cast_time < (uint32)focus_spell.base_value[i])
|
||||
return 0;
|
||||
break;
|
||||
case SE_LimitSpell:
|
||||
if(focus_spell.base[i] < 0) {
|
||||
if (spell_id == (focus_spell.base[i] * -1))
|
||||
if(focus_spell.base_value[i] < 0) {
|
||||
if (spell_id == (focus_spell.base_value[i] * -1))
|
||||
return 0;
|
||||
} else {
|
||||
if (spell_id != focus_spell.base[i])
|
||||
if (spell_id != focus_spell.base_value[i])
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case SE_LimitMinDur:
|
||||
if (focus_spell.base[i] > CalcBuffDuration_formula(GetLevel(), spell.buffdurationformula, spell.buffduration))
|
||||
if (focus_spell.base_value[i] > CalcBuffDuration_formula(GetLevel(), spell.buff_duration_formula, spell.buff_duration))
|
||||
return 0;
|
||||
break;
|
||||
case SE_LimitEffect:
|
||||
if(focus_spell.base[i] < 0) {
|
||||
if(IsEffectInSpell(spell_id,focus_spell.base[i]))
|
||||
if(focus_spell.base_value[i] < 0) {
|
||||
if(IsEffectInSpell(spell_id,focus_spell.base_value[i]))
|
||||
return 0;
|
||||
} else {
|
||||
if(focus_spell.base[i] == SE_SummonPet) {
|
||||
if(focus_spell.base_value[i] == SE_SummonPet) {
|
||||
if(!IsEffectInSpell(spell_id, SE_SummonPet) && !IsEffectInSpell(spell_id, SE_NecPet) && !IsEffectInSpell(spell_id, SE_SummonBSTPet)) {
|
||||
return 0;
|
||||
}
|
||||
} else if(!IsEffectInSpell(spell_id,focus_spell.base[i]))
|
||||
} else if(!IsEffectInSpell(spell_id,focus_spell.base_value[i]))
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SE_LimitSpellType:
|
||||
switch(focus_spell.base[i]) {
|
||||
switch(focus_spell.base_value[i]) {
|
||||
case 0:
|
||||
if (!IsDetrimentalSpell(spell_id))
|
||||
return 0;
|
||||
@@ -5513,153 +5513,153 @@ int32 Bot::CalcBotFocusEffect(focusType bottype, uint16 focus_id, uint16 spell_i
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
LogInfo("CalcFocusEffect: unknown limit spelltype [{}]", focus_spell.base[i]);
|
||||
LogInfo("CalcFocusEffect: unknown limit spelltype [{}]", focus_spell.base_value[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case SE_LimitManaMin:
|
||||
if(spell.mana < focus_spell.base[i])
|
||||
if(spell.mana < focus_spell.base_value[i])
|
||||
return 0;
|
||||
break;
|
||||
case SE_LimitTarget:
|
||||
if((focus_spell.base[i] < 0) && -focus_spell.base[i] == spell.targettype)
|
||||
if((focus_spell.base_value[i] < 0) && -focus_spell.base_value[i] == spell.target_type)
|
||||
return 0;
|
||||
else if (focus_spell.base[i] > 0 && focus_spell.base[i] != spell.targettype)
|
||||
else if (focus_spell.base_value[i] > 0 && focus_spell.base_value[i] != spell.target_type)
|
||||
return 0;
|
||||
break;
|
||||
case SE_LimitCombatSkills:
|
||||
if(focus_spell.base[i] == 1 && !IsDiscipline(spell_id))
|
||||
if(focus_spell.base_value[i] == 1 && !IsDiscipline(spell_id))
|
||||
return 0;
|
||||
else if(focus_spell.base[i] == 0 && IsDiscipline(spell_id))
|
||||
else if(focus_spell.base_value[i] == 0 && IsDiscipline(spell_id))
|
||||
return 0;
|
||||
break;
|
||||
case SE_LimitSpellGroup:
|
||||
if(focus_spell.base[i] > 0 && focus_spell.base[i] != spell.spellgroup)
|
||||
if(focus_spell.base_value[i] > 0 && focus_spell.base_value[i] != spell.spell_group)
|
||||
return 0;
|
||||
else if(focus_spell.base[i] < 0 && focus_spell.base[i] == spell.spellgroup)
|
||||
else if(focus_spell.base_value[i] < 0 && focus_spell.base_value[i] == spell.spell_group)
|
||||
return 0;
|
||||
break;
|
||||
case SE_LimitCastingSkill:
|
||||
LimitSpellSkill = true;
|
||||
if(focus_spell.base[i] == spell.skill)
|
||||
if(focus_spell.base_value[i] == spell.skill)
|
||||
SpellSkill_Found = true;
|
||||
break;
|
||||
case SE_LimitClass:
|
||||
if (!PassLimitClass(focus_spell.base[i], GetClass()))
|
||||
if (!PassLimitClass(focus_spell.base_value[i], GetClass()))
|
||||
return 0;
|
||||
break;
|
||||
case SE_ImprovedDamage:
|
||||
if (bottype == focusImprovedDamage) {
|
||||
if(best_focus) {
|
||||
if (focus_spell.base2[i] != 0)
|
||||
value = focus_spell.base2[i];
|
||||
if (focus_spell.limit_value[i] != 0)
|
||||
value = focus_spell.limit_value[i];
|
||||
else
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
}
|
||||
else if (focus_spell.base2[i] == 0 || focus_spell.base[i] == focus_spell.base2[i])
|
||||
value = focus_spell.base[i];
|
||||
else if (focus_spell.limit_value[i] == 0 || focus_spell.base_value[i] == focus_spell.limit_value[i])
|
||||
value = focus_spell.base_value[i];
|
||||
else
|
||||
value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]);
|
||||
value = zone->random.Int(focus_spell.base_value[i], focus_spell.limit_value[i]);
|
||||
}
|
||||
break;
|
||||
case SE_ImprovedDamage2:
|
||||
if (bottype == focusImprovedDamage2) {
|
||||
if(best_focus) {
|
||||
if (focus_spell.base2[i] != 0)
|
||||
value = focus_spell.base2[i];
|
||||
if (focus_spell.limit_value[i] != 0)
|
||||
value = focus_spell.limit_value[i];
|
||||
else
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
}
|
||||
else if (focus_spell.base2[i] == 0 || focus_spell.base[i] == focus_spell.base2[i])
|
||||
value = focus_spell.base[i];
|
||||
else if (focus_spell.limit_value[i] == 0 || focus_spell.base_value[i] == focus_spell.limit_value[i])
|
||||
value = focus_spell.base_value[i];
|
||||
else
|
||||
value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]);
|
||||
value = zone->random.Int(focus_spell.base_value[i], focus_spell.limit_value[i]);
|
||||
}
|
||||
break;
|
||||
case SE_ImprovedHeal:
|
||||
if (bottype == focusImprovedHeal) {
|
||||
if(best_focus) {
|
||||
if (focus_spell.base2[i] != 0)
|
||||
value = focus_spell.base2[i];
|
||||
if (focus_spell.limit_value[i] != 0)
|
||||
value = focus_spell.limit_value[i];
|
||||
else
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
}
|
||||
else if (focus_spell.base2[i] == 0 || focus_spell.base[i] == focus_spell.base2[i])
|
||||
value = focus_spell.base[i];
|
||||
else if (focus_spell.limit_value[i] == 0 || focus_spell.base_value[i] == focus_spell.limit_value[i])
|
||||
value = focus_spell.base_value[i];
|
||||
else
|
||||
value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]);
|
||||
value = zone->random.Int(focus_spell.base_value[i], focus_spell.limit_value[i]);
|
||||
}
|
||||
break;
|
||||
case SE_ReduceManaCost:
|
||||
if (bottype == focusManaCost) {
|
||||
if(best_focus) {
|
||||
if (focus_spell.base2[i] != 0)
|
||||
value = focus_spell.base2[i];
|
||||
if (focus_spell.limit_value[i] != 0)
|
||||
value = focus_spell.limit_value[i];
|
||||
else
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
}
|
||||
else if (focus_spell.base2[i] == 0 || focus_spell.base[i] == focus_spell.base2[i])
|
||||
value = focus_spell.base[i];
|
||||
else if (focus_spell.limit_value[i] == 0 || focus_spell.base_value[i] == focus_spell.limit_value[i])
|
||||
value = focus_spell.base_value[i];
|
||||
else
|
||||
value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]);
|
||||
value = zone->random.Int(focus_spell.base_value[i], focus_spell.limit_value[i]);
|
||||
}
|
||||
break;
|
||||
case SE_IncreaseSpellHaste:
|
||||
if (bottype == focusSpellHaste && focus_spell.base[i] > value)
|
||||
value = focus_spell.base[i];
|
||||
if (bottype == focusSpellHaste && focus_spell.base_value[i] > value)
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_IncreaseSpellDuration:
|
||||
if (bottype == focusSpellDuration && focus_spell.base[i] > value)
|
||||
value = focus_spell.base[i];
|
||||
if (bottype == focusSpellDuration && focus_spell.base_value[i] > value)
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_SpellDurationIncByTic:
|
||||
if (bottype == focusSpellDurByTic && focus_spell.base[i] > value)
|
||||
value = focus_spell.base[i];
|
||||
if (bottype == focusSpellDurByTic && focus_spell.base_value[i] > value)
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_SwarmPetDuration:
|
||||
if (bottype == focusSwarmPetDuration && focus_spell.base[i] > value)
|
||||
value = focus_spell.base[i];
|
||||
if (bottype == focusSwarmPetDuration && focus_spell.base_value[i] > value)
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_IncreaseRange:
|
||||
if (bottype == focusRange && focus_spell.base[i] > value)
|
||||
value = focus_spell.base[i];
|
||||
if (bottype == focusRange && focus_spell.base_value[i] > value)
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_ReduceReagentCost:
|
||||
if (bottype == focusReagentCost && focus_spell.base[i] > value)
|
||||
value = focus_spell.base[i];
|
||||
if (bottype == focusReagentCost && focus_spell.base_value[i] > value)
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_PetPowerIncrease:
|
||||
if (bottype == focusPetPower && focus_spell.base[i] > value)
|
||||
value = focus_spell.base[i];
|
||||
if (bottype == focusPetPower && focus_spell.base_value[i] > value)
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_SpellResistReduction:
|
||||
if (bottype == focusResistRate && focus_spell.base[i] > value)
|
||||
value = focus_spell.base[i];
|
||||
if (bottype == focusResistRate && focus_spell.base_value[i] > value)
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_SpellHateMod:
|
||||
if (bottype == focusSpellHateMod) {
|
||||
if(value != 0) {
|
||||
if(value > 0) {
|
||||
if(focus_spell.base[i] > value)
|
||||
value = focus_spell.base[i];
|
||||
if(focus_spell.base_value[i] > value)
|
||||
value = focus_spell.base_value[i];
|
||||
}
|
||||
else {
|
||||
if(focus_spell.base[i] < value)
|
||||
value = focus_spell.base[i];
|
||||
if(focus_spell.base_value[i] < value)
|
||||
value = focus_spell.base_value[i];
|
||||
}
|
||||
} else
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
}
|
||||
break;
|
||||
case SE_ReduceReuseTimer: {
|
||||
if(bottype == focusReduceRecastTime)
|
||||
value = (focus_spell.base[i] / 1000);
|
||||
value = (focus_spell.base_value[i] / 1000);
|
||||
break;
|
||||
}
|
||||
case SE_TriggerOnCast: {
|
||||
if(bottype == focusTriggerOnCast) {
|
||||
if(zone->random.Int(0, 100) <= focus_spell.base[i])
|
||||
value = focus_spell.base2[i];
|
||||
if(zone->random.Int(0, 100) <= focus_spell.base_value[i])
|
||||
value = focus_spell.limit_value[i];
|
||||
else
|
||||
value = 0;
|
||||
}
|
||||
@@ -5667,24 +5667,24 @@ int32 Bot::CalcBotFocusEffect(focusType bottype, uint16 focus_id, uint16 spell_i
|
||||
}
|
||||
case SE_FcSpellVulnerability: {
|
||||
if(bottype == focusSpellVulnerability)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
}
|
||||
case SE_BlockNextSpellFocus: {
|
||||
if(bottype == focusBlockNextSpell) {
|
||||
if(zone->random.Int(1, 100) <= focus_spell.base[i])
|
||||
if(zone->random.Int(1, 100) <= focus_spell.base_value[i])
|
||||
value = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_FcTwincast: {
|
||||
if(bottype == focusTwincast)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
}
|
||||
case SE_SympatheticProc: {
|
||||
if(bottype == focusSympatheticProc) {
|
||||
float ProcChance = GetSympatheticProcChances(spell_id, focus_spell.base[i]);
|
||||
float ProcChance = GetSympatheticProcChances(spell_id, focus_spell.base_value[i]);
|
||||
if(zone->random.Real(0, 1) <= ProcChance)
|
||||
value = focus_id;
|
||||
else
|
||||
@@ -5694,59 +5694,59 @@ int32 Bot::CalcBotFocusEffect(focusType bottype, uint16 focus_id, uint16 spell_i
|
||||
}
|
||||
case SE_FcDamageAmt: {
|
||||
if(bottype == focusFcDamageAmt)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
}
|
||||
case SE_FcDamageAmt2: {
|
||||
if(bottype == focusFcDamageAmt2)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
}
|
||||
case SE_FcDamageAmtCrit: {
|
||||
if(bottype == focusFcDamageAmtCrit)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
}
|
||||
case SE_FcHealAmtIncoming:
|
||||
if(bottype == focusFcHealAmtIncoming)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_FcHealPctCritIncoming:
|
||||
if (bottype == focusFcHealPctCritIncoming)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_FcHealAmtCrit:
|
||||
if(bottype == focusFcHealAmtCrit)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_FcHealAmt:
|
||||
if(bottype == focusFcHealAmt)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_FcHealPctIncoming:
|
||||
if(bottype == focusFcHealPctIncoming)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
break;
|
||||
case SE_FcBaseEffects: {
|
||||
if (bottype == focusFcBaseEffects)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
|
||||
break;
|
||||
}
|
||||
case SE_FcDamagePctCrit: {
|
||||
if(bottype == focusFcDamagePctCrit)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
|
||||
break;
|
||||
}
|
||||
case SE_FcIncreaseNumHits: {
|
||||
if(bottype == focusIncreaseNumHits)
|
||||
value = focus_spell.base[i];
|
||||
value = focus_spell.base_value[i];
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LogSpells("CalcFocusEffect: unknown effectid [{}]", focus_spell.effectid[i]);
|
||||
LogSpells("CalcFocusEffect: unknown effectid [{}]", focus_spell.effect_id[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -6673,7 +6673,7 @@ void Bot::SetAttackTimer() {
|
||||
}
|
||||
|
||||
int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
|
||||
if (spells[spell_id].targettype == ST_Self)
|
||||
if (spells[spell_id].target_type == ST_Self)
|
||||
return value;
|
||||
|
||||
bool Critical = false;
|
||||
@@ -6757,7 +6757,7 @@ int32 Bot::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
|
||||
value_BaseEffect = (value + (value*GetBotFocusEffect(focusFcBaseEffects, spell_id) / 100));
|
||||
value = value_BaseEffect;
|
||||
value += int(value_BaseEffect*GetBotFocusEffect(focusImprovedHeal, spell_id) / 100);
|
||||
if(spells[spell_id].buffduration < 1) {
|
||||
if(spells[spell_id].buff_duration < 1) {
|
||||
chance += (itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance);
|
||||
chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id);
|
||||
if (spellbonuses.CriticalHealDecay)
|
||||
@@ -6798,7 +6798,7 @@ int32 Bot::GetActSpellCasttime(uint16 spell_id, int32 casttime) {
|
||||
auto min_cap = casttime / 2;
|
||||
uint8 botlevel = GetLevel();
|
||||
uint8 botclass = GetClass();
|
||||
if (botlevel >= 51 && casttime >= 3000 && !spells[spell_id].goodEffect &&
|
||||
if (botlevel >= 51 && casttime >= 3000 && !spells[spell_id].good_effect &&
|
||||
(botclass == SHADOWKNIGHT || botclass == RANGER || botclass == PALADIN || botclass == BEASTLORD)) {
|
||||
int level_mod = std::min(15, botlevel - 50);
|
||||
cast_reducer += level_mod * 3;
|
||||
@@ -6994,7 +6994,7 @@ int32 Bot::GetActSpellDuration(uint16 spell_id, int32 duration) {
|
||||
|
||||
float Bot::GetAOERange(uint16 spell_id) {
|
||||
float range;
|
||||
range = spells[spell_id].aoerange;
|
||||
range = spells[spell_id].aoe_range;
|
||||
if(range == 0)
|
||||
range = spells[spell_id].range;
|
||||
|
||||
@@ -7099,7 +7099,7 @@ bool Bot::SpellOnTarget(uint16 spell_id, Mob* spelltar) {
|
||||
return false;
|
||||
|
||||
if(spelltar) {
|
||||
if(spelltar->IsBot() && (spells[spell_id].targettype == ST_GroupTeleport)) {
|
||||
if(spelltar->IsBot() && (spells[spell_id].target_type == ST_GroupTeleport)) {
|
||||
switch(spell_id) {
|
||||
// Paladin
|
||||
case 3577: // Wave of Life
|
||||
@@ -7175,7 +7175,7 @@ bool Bot::SpellOnTarget(uint16 spell_id, Mob* spelltar) {
|
||||
|
||||
if(spelltar->IsPet()) {
|
||||
for(int i= 0; i < EFFECT_COUNT; ++i) {
|
||||
if(spells[spell_id].effectid[i] == SE_Illusion)
|
||||
if(spells[spell_id].effect_id[i] == SE_Illusion)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -7193,13 +7193,13 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) {
|
||||
Result = Mob::IsImmuneToSpell(spell_id, caster);
|
||||
if(!Result) {
|
||||
if(caster->IsBot()) {
|
||||
if(spells[spell_id].targettype == ST_Undead) {
|
||||
if(spells[spell_id].target_type == ST_Undead) {
|
||||
if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Undead) && (GetBodyType() != BT_Vampire)) {
|
||||
LogSpells("Bot's target is not an undead");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(spells[spell_id].targettype == ST_Summoned) {
|
||||
if(spells[spell_id].target_type == ST_Summoned) {
|
||||
if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Summoned) && (GetBodyType() != BT_Summoned2) && (GetBodyType() != BT_Summoned3)) {
|
||||
LogSpells("Bot's target is not a summoned creature");
|
||||
return true;
|
||||
@@ -7216,7 +7216,7 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) {
|
||||
|
||||
bool Bot::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_center, CastAction_type &CastAction, EQ::spells::CastingSlot slot) {
|
||||
bool Result = false;
|
||||
SpellTargetType targetType = spells[spell_id].targettype;
|
||||
SpellTargetType targetType = spells[spell_id].target_type;
|
||||
if(targetType == ST_GroupClientAndPet) {
|
||||
if((spell_id == 1768 && zone->GetZoneID() == 202) || (!IsDetrimentalSpell(spell_id))) {
|
||||
CastAction = SingleTarget;
|
||||
@@ -7351,13 +7351,13 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQ::spe
|
||||
int spelltype = BotGetSpellType(i);
|
||||
bool spellequal = (j == thespell);
|
||||
bool spelltypeequal = ((spelltype == 2) || (spelltype == 16) || (spelltype == 32));
|
||||
bool spelltypetargetequal = ((spelltype == 8) && (spells[thespell].targettype == ST_Self));
|
||||
bool spelltypetargetequal = ((spelltype == 8) && (spells[thespell].target_type == ST_Self));
|
||||
bool spelltypeclassequal = ((spelltype == 1024) && (GetClass() == SHAMAN));
|
||||
bool slotequal = (slot == EQ::spells::CastingSlot::Item);
|
||||
if(spellequal || slotequal) {
|
||||
if((spelltypeequal || spelltypetargetequal) || spelltypeclassequal || slotequal) {
|
||||
if(((spells[thespell].effectid[0] == 0) && (spells[thespell].base[0] < 0)) &&
|
||||
(spellTarget->GetHP() < ((spells[thespell].base[0] * (-1)) + 100))) {
|
||||
if(((spells[thespell].effect_id[0] == 0) && (spells[thespell].base_value[0] < 0)) &&
|
||||
(spellTarget->GetHP() < ((spells[thespell].base_value[0] * (-1)) + 100))) {
|
||||
LogSpells("Bot::DoFinishedSpellSingleTarget - GroupBuffing failure");
|
||||
return false;
|
||||
}
|
||||
@@ -8040,7 +8040,7 @@ void Bot::DoEnduranceUpkeep() {
|
||||
uint32 buff_count = GetMaxTotalSlots();
|
||||
for (buffs_i = 0; buffs_i < buff_count; buffs_i++) {
|
||||
if (buffs[buffs_i].spellid != SPELL_UNKNOWN) {
|
||||
int upkeep = spells[buffs[buffs_i].spellid].EndurUpkeep;
|
||||
int upkeep = spells[buffs[buffs_i].spellid].endurance_upkeep;
|
||||
if(upkeep > 0) {
|
||||
if(cost_redux > 0) {
|
||||
if(upkeep <= cost_redux)
|
||||
@@ -9523,17 +9523,17 @@ bool Bot::UseDiscipline(uint32 spell_id, uint32 target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(GetEndurance() > spell.EndurCost)
|
||||
SetEndurance(GetEndurance() - spell.EndurCost);
|
||||
if(GetEndurance() > spell.endurance_cost)
|
||||
SetEndurance(GetEndurance() - spell.endurance_cost);
|
||||
else
|
||||
return false;
|
||||
|
||||
if(spell.recast_time > 0) {
|
||||
if(CheckDisciplineRecastTimers(this, spells[spell_id].EndurTimerIndex)) {
|
||||
if(spells[spell_id].EndurTimerIndex > 0 && spells[spell_id].EndurTimerIndex < MAX_DISCIPLINE_TIMERS)
|
||||
SetDisciplineRecastTimer(spells[spell_id].EndurTimerIndex, spell.recast_time);
|
||||
if(CheckDisciplineRecastTimers(this, spells[spell_id].timer_id)) {
|
||||
if(spells[spell_id].timer_id > 0 && spells[spell_id].timer_id < MAX_DISCIPLINE_TIMERS)
|
||||
SetDisciplineRecastTimer(spells[spell_id].timer_id, spell.recast_time);
|
||||
} else {
|
||||
uint32 remain = (GetDisciplineRemainingTime(this, spells[spell_id].EndurTimerIndex) / 1000);
|
||||
uint32 remain = (GetDisciplineRemainingTime(this, spells[spell_id].timer_id) / 1000);
|
||||
GetOwner()->Message(Chat::White, "%s can use this discipline in %d minutes %d seconds.", GetCleanName(), (remain / 60), (remain % 60));
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user