Kayen: Implemented additional functionality for SE_CurrentHP utilizing base2 values. (ie limit to body type)

Kayen: Implemented SE_MitigateMeleeDamageSP (Partial Melee Rune that only is lowered if melee hits are over X amount of damage)
Kayen: Implemented SE_SpellOnAmtDmgTaken (Effect is triggered when X amount of damage is taken)
Kayen: Fix for various spell triggers/procs to now properly use their resist modifier.
Kayen: Fix to mob->ModSkillDmgTaken(skill_num, value), setting value to -1 will now properly effect all skills.
This commit is contained in:
KayenEQ
2013-12-13 21:29:35 -05:00
parent cd2825288d
commit f6d5e8031f
10 changed files with 283 additions and 14 deletions
+146 -1
View File
@@ -214,6 +214,84 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
int32 dmg = effect_value;
if(dmg < 0)
{
/*Special Cases where Base2 is defined
Range 105 : Plant
Range 120 : Undead
Range 123 : Humanoid
Range 190 : No Raid boss flag *not implemented
Range 191 : This spell will deal less damage to 'exceptionally strong targets' - Raid boss flag *not implemented
Range 201 : Damage if HP > 75%
Range 221 - 299 : Causing damage dependent on how many pets/swarmpets are attacking your target.
Range 300 - 303 : UNKOWN *not implemented
Range 399 - 499 : Heal if HP within a specified range (400 = 0-25% 401 = 25 - 35% 402 = 35-45% ect)
Range 500 - 599 : Heal if HP less than a specified value
Range 600 - 699 : Limit to Body Type [base2 - 600 = Body]
Range 818 - 819 : If Undead/If Not Undead
Range 835 - : Unknown *not implemented
Range 836 - 837 : Progression Server / Live Server *not implemented
Range 839 - : Unknown *not implemented
Range 10000+ : Limit to Race [base2 - 10000 = Race] (*Not on live: Too useful a function to not implement)
*/
if (spells[spell_id].base2[i] > 0){
//It is unlikely these effects would give a fail message (Need to confirm)
if (spells[spell_id].base2[i] == 105){
if (GetBodyType() != BT_Plant)
break;
}
else if (spells[spell_id].base2[i] == 120){
if (GetBodyType() != BT_Undead)
break;
}
else if (spells[spell_id].base2[i] == 123){
if (GetBodyType() != BT_Humanoid)
break;
}
//Limit to Body Type.
else if (spells[spell_id].base2[i] >= 600 && spells[spell_id].base2[i] <= 699){
if (GetBodyType() != (spells[spell_id].base2[i] - 600)){
//caster->Message_StringID(13,CANNOT_AFFECT_NPC);
break;
}
}
else if (spells[spell_id].base2[i] == 201){
if (GetHPRatio() < 75)
break;
}
//Limit to Race. *Not implemented on live
else if (spells[spell_id].base2[i] >= 10000 && spells[spell_id].base2[i] <= 11000){
if (GetRace() != (spells[spell_id].base2[i] - 10000)){
break;
}
}
//Limit to amount of pets
else if (spells[spell_id].base2[i] >= 221 && spells[spell_id].base2[i] <= 299){
bool allow_spell = false;
int count = hate_list.SummonedPetCount(this);
for (int base2_value = 221; base2_value <= 233; ++base2_value){
if (spells[spell_id].base2[i] == base2_value){
if (count >= (base2_value - 220)){
allow_spell = true;
break;
}
}
}
if (!allow_spell)
break;
}
}
// take partial damage into account
dmg = (int32) (dmg * partial / 100);
@@ -229,6 +307,60 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
}
else if(dmg > 0) {
//healing spell...
if (spells[spell_id].base2[i] > 0)
{
bool allow_spell = false;
//Heal only if HP within specified range. [Doesn't follow a set forumla for all values...]
if (spells[spell_id].base2[i] >= 400 && spells[spell_id].base2[i] <= 408){
for (int base2_value = 400; base2_value <= 408; ++base2_value){
if (spells[spell_id].base2[i] == base2_value){
if (spells[spell_id].base2[i] == 400){
if (GetHPRatio() <= 25){
allow_spell = true;
break;
}
}
else if (spells[spell_id].base2[i] == base2_value){
if (GetHPRatio() > 25+((base2_value - 401)*10) && GetHPRatio() <= 35+((base2_value - 401)*10)){
allow_spell = true;
break;
}
}
}
}
}
else if (spells[spell_id].base2[i] >= 500 && spells[spell_id].base2[i] <= 520){
for (int base2_value = 500; base2_value <= 520; ++base2_value){
if (spells[spell_id].base2[i] == base2_value){
if (spells[spell_id].base2[i] == base2_value){
if (GetHPRatio() < (base2_value - 500)*5) {
allow_spell = true;
break;
}
}
}
}
}
else if (spells[spell_id].base2[i] == 399){
if (GetHPRatio() > 15 && GetHPRatio() <= 25){
allow_spell = true;
break;
}
}
if(!allow_spell)
break;
}
if(caster)
dmg = caster->GetActSpellHealing(spell_id, dmg);
@@ -1230,6 +1362,12 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
break;
}
case SE_MitigateMeleeDamageSP:
{
buffs[buffslot].melee_rune = spells[spell_id].max[i];
break;
}
case SE_MitigateSpellDamage:
{
buffs[buffslot].magic_rune = GetPartialMagicRuneAmount(spell_id);
@@ -1237,6 +1375,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
break;
}
//Using the melee_rune variable, however it will be calculated for both spell and melee.
case SE_SpellOnAmtDmgTaken:
{
buffs[buffslot].melee_rune = spells[spell_id].base2[i];
break;
}
case SE_Levitate:
{
#ifdef SPELL_EFFECT_SPAM
@@ -5075,7 +5220,7 @@ bool Mob::CheckHitsRemaining(uint32 buff_slot, bool when_spell_done, bool negate
}
// For lowering numhits when we already know the effects buff_slot
// Effects: SE_SpellVulnerability,SE_MitigateMeleeDamage,SE_NegateAttacks,SE_MitigateSpellDamage,SE_ManaAbsorbPercentDamage
// Effects: SE_SpellVulnerability,SE_MitigateMeleeDamage,SE_MitigateMeleeDamage2,SE_NegateAttacks,SE_MitigateSpellDamage,SE_ManaAbsorbPercentDamage
if(spells[buffs[buff_slot].spellid].numhits > 0 || negate) {
if(buffs[buff_slot].numhits > 1) {
buffs[buff_slot].numhits--;