mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-24 23:13:52 +00:00
[Spells] Update to SPA 442 and 443 (SE_TriggerOnReqTarget, SE_TriggerOnReqCaster) (#1543)
* Update to SPA 442 and 443 Use SpellRestriction Id's and updated PassCastRestriction code * Update mob.cpp
This commit is contained in:
parent
f715ccd368
commit
71870cbd1c
@ -1125,8 +1125,8 @@ typedef enum {
|
||||
#define SE_Assassinate 439 // implemented[AA] - Assassinate damage
|
||||
#define SE_FinishingBlowLvl 440 // implemented[AA] - Sets the level Finishing blow can be triggered on an NPC
|
||||
#define SE_DistanceRemoval 441 // implemented - Buff is removed from target when target moves X amount of distance away from where initially hit.
|
||||
#define SE_TriggerOnReqTarget 442 // implemented - triggers a spell which a certain criteria are met (below X amount of hp,mana,end, number of pets on hatelist)
|
||||
#define SE_TriggerOnReqCaster 443 // implemented - triggers a spell which a certain criteria are met (below X amount of hp,mana,end, number of pets on hatelist)
|
||||
#define SE_TriggerOnReqTarget 442 // implemented, @SpellTrigger, triggers a spell when Target Requirement conditions are met (see enum SpellRestriction for IDs), base: spellid, limit: SpellRestriction ID, max: none, Note: Usually cast on a target
|
||||
#define SE_TriggerOnReqCaster 443 // implemented, @SpellTrigger, triggers a spell when Caster Requirement conditions are met (see enum SpellRestriction for IDs), base: spellid, limit: SpellRestriction ID, max: none, Note: Usually self only
|
||||
#define SE_ImprovedTaunt 444 // implemented - Locks Aggro On Caster and Decrease other Players Aggro by X% on NPC targets below level Y
|
||||
//#define SE_AddMercSlot 445 // *not implemented[AA] - [Hero's Barracks] Allows you to conscript additional mercs.
|
||||
#define SE_AStacker 446 // implementet - bufff stacking blocker (26219 | Qirik's Watch)
|
||||
|
||||
@ -2701,8 +2701,9 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
|
||||
}
|
||||
}
|
||||
|
||||
if (other->IsNPC() && (other->IsPet() || other->CastToNPC()->GetSwarmOwner() > 0))
|
||||
TryTriggerOnValueAmount(false, false, false, true);
|
||||
if (other->IsNPC() && (other->IsPet() || other->CastToNPC()->GetSwarmOwner() > 0)) {
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
|
||||
if (IsClient() && !IsAIControlled())
|
||||
return;
|
||||
@ -3343,7 +3344,7 @@ int32 Mob::ReduceAllDamage(int32 damage)
|
||||
if (GetMana() >= mana_reduced) {
|
||||
damage -= mana_reduced;
|
||||
SetMana(GetMana() - mana_reduced);
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3356,7 +3357,7 @@ int32 Mob::ReduceAllDamage(int32 damage)
|
||||
if (IsClient() && CastToClient()->GetEndurance() >= endurance_drain) {
|
||||
damage -= damage_reduced;
|
||||
CastToClient()->SetEndurance(CastToClient()->GetEndurance() - endurance_drain);
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3646,7 +3647,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
|
||||
TryDeathSave();
|
||||
}
|
||||
|
||||
TryTriggerOnValueAmount(true);
|
||||
TryTriggerOnCastRequirement();
|
||||
|
||||
//fade mez if we are mezzed
|
||||
if (IsMezzed() && attacker) {
|
||||
|
||||
@ -3208,7 +3208,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
|
||||
|
||||
case SE_TriggerOnReqTarget:
|
||||
case SE_TriggerOnReqCaster:
|
||||
new_bonus->TriggerOnValueAmount = true;
|
||||
new_bonus->TriggerOnCastRequirement = true;
|
||||
break;
|
||||
|
||||
case SE_DivineAura:
|
||||
|
||||
@ -1866,7 +1866,7 @@ void Client::DoEnduranceUpkeep() {
|
||||
|
||||
if(upkeep_sum != 0){
|
||||
SetEndurance(GetEndurance() - upkeep_sum);
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
|
||||
if (!has_effect)
|
||||
|
||||
@ -603,7 +603,7 @@ struct StatBonuses {
|
||||
int32 FinishingBlow[2]; // Chance to do a finishing blow for specified damage amount.
|
||||
uint32 FinishingBlowLvl[2]; // Sets max level an NPC can be affected by FB. (base1 = lv, base2= ???)
|
||||
int32 ShieldEquipDmgMod; // Increases weapon's base damage by base1 % when shield is equipped (indirectly increasing hate)
|
||||
bool TriggerOnValueAmount; // Triggers off various different conditions, bool to check if client has effect.
|
||||
bool TriggerOnCastRequirement; // Triggers off various different conditions defined as emum SpellRestrictions
|
||||
int8 StunBashChance; // chance to stun with bash.
|
||||
int8 IncreaseChanceMemwipe; // increases chance to memory wipe
|
||||
int8 CriticalMend; // chance critical monk mend
|
||||
|
||||
@ -987,7 +987,7 @@ int32 Lua_StatBonuses::GetShieldEquipDmgMod() const {
|
||||
|
||||
bool Lua_StatBonuses::GetTriggerOnValueAmount() const {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->TriggerOnValueAmount;
|
||||
return self->TriggerOnCastRequirement;
|
||||
}
|
||||
|
||||
int8 Lua_StatBonuses::GetStunBashChance() const {
|
||||
|
||||
80
zone/mob.cpp
80
zone/mob.cpp
@ -3602,81 +3602,20 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Mob::TryTriggerOnValueAmount(bool IsHP, bool IsMana, bool IsEndur, bool IsPet)
|
||||
void Mob::TryTriggerOnCastRequirement()
|
||||
{
|
||||
/*
|
||||
At present time there is no obvious difference between ReqTarget and ReqCaster
|
||||
ReqTarget is typically used in spells cast on a target where the trigger occurs on that target.
|
||||
ReqCaster is typically self only spells where the triggers on self.
|
||||
Regardless both trigger on the owner of the buff.
|
||||
*/
|
||||
|
||||
/*
|
||||
Base2 Range: 1004 = Below < 80% HP
|
||||
Base2 Range: 500-520 = Below (base2 - 500)*5 HP
|
||||
Base2 Range: 521 = Below (?) Mana UKNOWN - Will assume its 20% unless proven otherwise
|
||||
Base2 Range: 522 = Below (40%) Endurance
|
||||
Base2 Range: 523 = Below (40%) Mana
|
||||
Base2 Range: 220-? = Number of pets on hatelist to trigger (base2 - 220) (Set at 30 pets max for now)
|
||||
38311 = < 10% mana;
|
||||
*/
|
||||
|
||||
if (!spellbonuses.TriggerOnValueAmount)
|
||||
return;
|
||||
|
||||
if (spellbonuses.TriggerOnValueAmount){
|
||||
|
||||
if (spellbonuses.TriggerOnCastRequirement) {
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
|
||||
for(int e = 0; e < buff_count; e++){
|
||||
|
||||
uint32 spell_id = buffs[e].spellid;
|
||||
|
||||
if (IsValidSpell(spell_id)){
|
||||
|
||||
for(int i = 0; i < EFFECT_COUNT; i++){
|
||||
|
||||
for (int e = 0; e < buff_count; e++) {
|
||||
int spell_id = buffs[e].spellid;
|
||||
if (IsValidSpell(spell_id)) {
|
||||
for (int i = 0; i < EFFECT_COUNT; i++) {
|
||||
if ((spells[spell_id].effectid[i] == SE_TriggerOnReqTarget) || (spells[spell_id].effectid[i] == SE_TriggerOnReqCaster)) {
|
||||
|
||||
int base2 = spells[spell_id].base2[i];
|
||||
bool use_spell = false;
|
||||
|
||||
if (IsHP){
|
||||
if ((base2 >= 500 && base2 <= 520) && GetHPRatio() < (base2 - 500)*5)
|
||||
use_spell = true;
|
||||
|
||||
else if (base2 == 1004 && GetHPRatio() < 80)
|
||||
use_spell = true;
|
||||
}
|
||||
|
||||
else if (IsMana){
|
||||
if ( (base2 = 521 && GetManaRatio() < 20) || (base2 = 523 && GetManaRatio() < 40))
|
||||
use_spell = true;
|
||||
|
||||
else if (base2 == 38311 && GetManaRatio() < 10)
|
||||
use_spell = true;
|
||||
}
|
||||
|
||||
else if (IsEndur){
|
||||
if (base2 == 522 && GetEndurancePercent() < 40){
|
||||
use_spell = true;
|
||||
}
|
||||
}
|
||||
|
||||
else if (IsPet){
|
||||
int count = hate_list.GetSummonedPetCountOnHateList(this);
|
||||
if ((base2 >= 220 && base2 <= 250) && count >= (base2 - 220)){
|
||||
use_spell = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (use_spell){
|
||||
if (PassCastRestriction(spells[spell_id].base2[i])) {
|
||||
SpellFinished(spells[spell_id].base[i], this, EQ::spells::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff);
|
||||
|
||||
if(!TryFadeEffect(e))
|
||||
if (!TryFadeEffect(e)) {
|
||||
BuffFadeBySlot(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3685,7 +3624,6 @@ void Mob::TryTriggerOnValueAmount(bool IsHP, bool IsMana, bool IsEndur, bool IsP
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Twincast Focus effects should stack across different types (Spell, AA - when implemented ect)
|
||||
void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id)
|
||||
{
|
||||
|
||||
@ -796,7 +796,7 @@ public:
|
||||
void TryTriggerOnCastFocusEffect(focusType type, uint16 spell_id);
|
||||
bool TryTriggerOnCastProc(uint16 focusspellid, uint16 spell_id, uint16 proc_spellid);
|
||||
bool TrySpellTrigger(Mob *target, uint32 spell_id, int effect);
|
||||
void TryTriggerOnValueAmount(bool IsHP = false, bool IsMana = false, bool IsEndur = false, bool IsPet = false);
|
||||
void TryTriggerOnCastRequirement();
|
||||
void TryTwincast(Mob *caster, Mob *target, uint32 spell_id);
|
||||
void TrySympatheticProc(Mob *target, uint32 spell_id);
|
||||
bool TryFadeEffect(int slot);
|
||||
|
||||
@ -369,7 +369,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
caster->SetMana(caster->GetMana() + std::abs(effect_value));
|
||||
|
||||
if (effect_value < 0)
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
#ifdef SPELL_EFFECT_SPAM
|
||||
if (caster)
|
||||
caster->Message(Chat::White, "You have gained %+i mana!", effect_value);
|
||||
@ -385,7 +385,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
|
||||
SetMana(GetMana() + effect_value);
|
||||
if (effect_value < 0)
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
|
||||
break;
|
||||
@ -2440,8 +2440,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
#endif
|
||||
if(IsClient()) {
|
||||
CastToClient()->SetEndurance(CastToClient()->GetEndurance() + effect_value);
|
||||
if (effect_value < 0)
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
if (effect_value < 0) {
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2452,10 +2453,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
snprintf(effect_desc, _EDLEN, "Current Endurance Once: %+i", effect_value);
|
||||
#endif
|
||||
|
||||
if(IsClient()) {
|
||||
if (IsClient()) {
|
||||
CastToClient()->SetEndurance(CastToClient()->GetEndurance() + effect_value);
|
||||
if (effect_value < 0)
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
if (effect_value < 0) {
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2634,7 +2636,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
int32 mana_to_use = GetMana() - spell.base[i];
|
||||
if(mana_to_use > -1) {
|
||||
SetMana(GetMana() - spell.base[i]);
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
// we take full dmg(-10 to make the damage the right sign)
|
||||
mana_damage = spell.base[i] / -10 * spell.base2[i];
|
||||
Damage(caster, mana_damage, spell_id, spell.skill, false, i, true);
|
||||
@ -2654,7 +2656,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
int32 end_to_use = CastToClient()->GetEndurance() - spell.base[i];
|
||||
if(end_to_use > -1) {
|
||||
CastToClient()->SetEndurance(CastToClient()->GetEndurance() - spell.base[i]);
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
// we take full dmg(-10 to make the damage the right sign)
|
||||
end_damage = spell.base[i] / -10 * spell.base2[i];
|
||||
Damage(caster, end_damage, spell_id, spell.skill, false, i, true);
|
||||
@ -2736,7 +2738,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
else {
|
||||
dmg = ratio*max_mana/10;
|
||||
caster->SetMana(caster->GetMana() - max_mana);
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
|
||||
if(IsDetrimentalSpell(spell_id)) {
|
||||
|
||||
@ -383,7 +383,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
|
||||
GetName()
|
||||
);
|
||||
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
return(false);
|
||||
}
|
||||
|
||||
@ -2467,7 +2467,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui
|
||||
LogSpells("Spell [{}]: consuming [{}] mana", spell_id, mana_used);
|
||||
if (!DoHPToManaCovert(mana_used)) {
|
||||
SetMana(GetMana() - mana_used);
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
}
|
||||
// one may want to check if this is a disc or not, but we actually don't, there are non disc stuff that have end cost
|
||||
@ -2478,7 +2478,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui
|
||||
if (mgb)
|
||||
end_cost *= 2;
|
||||
SetEndurance(GetEndurance() - EQ::ClampUpper(end_cost, GetEndurance()));
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
if (mgb)
|
||||
SetMGB(false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user