|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
07-11-2010, 03:53 PM
|
Dragon
|
|
Join Date: May 2009
Location: Milky Way
Posts: 539
|
|
COMMITTED: SE_SkillDamageTaken
The melee equivalent of the Spell Vulernability effect, its on things like the Anguish Warrior BP and this line of rogue disciplines. Also can use it to replicate things like the MPG Trial of Weaponry(mobs weak to different types of weapons).
spell effects
Code:
Index: spell_effects.cpp
===================================================================
--- spell_effects.cpp (revision 1596)
+++ spell_effects.cpp (working copy)
@@ -2812,6 +2812,7 @@
case SE_LimitCastTime:
case SE_NoCombatSkills:
case SE_TriggerOnCast:
+ case SE_SkillDamageTaken:
{
break;
}
mob.h
Code:
Index: mob.h
===================================================================
--- mob.h (revision 1596)
+++ mob.h (working copy)
@@ -838,7 +838,7 @@
inline bool IsSilenced() const { return silenced; }
inline int16 GetErrorNumber() const {return adverrorinfo;}
- sint32 ReduceDamage(sint32 damage);
+ sint32 AffectMeleeDamage(sint32 damage, const SkillType skill_used);
sint32 ReduceMagicalDamage(sint32 damage);
virtual void DoSpecialAttackDamage(Mob *who, SkillType skill, sint32 max_damage, sint32 min_damage = 1, sint32 hate_override = -1);
attack.cpp
Code:
Index: attack.cpp
===================================================================
--- attack.cpp (revision 1596)
+++ attack.cpp (working copy)
@@ -2861,13 +2861,14 @@
}
}
-sint32 Mob::ReduceDamage(sint32 damage)
+sint32 Mob::AffectMeleeDamage(sint32 damage, const SkillType skill_used)
{
- if(damage <= 0 || (!HasRune() && !HasPartialMeleeRune()))
+ if(damage <= 0)
{
return damage;
}
-
+
+ // Block attack first
int slot = GetBuffSlotFromType(SE_NegateAttacks);
if(slot >= 0 && buffs[slot].melee_rune > 0)
{
@@ -2878,7 +2879,23 @@
}
return -6;
}
-
+
+ // Affect melee damage
+ slot = GetBuffSlotFromType(SE_SkillDamageTaken);
+ if(slot >= 0)
+ {
+ for(int i = 0; i < EFFECT_COUNT; i++)
+ {
+ // Check the skill against the spell, or allow all melee skills.
+ if(skill_used == spells[buffs[slot].spellid].base2[i] || spells[buffs[slot].spellid].base2[i] == -1)
+ {
+ damage += damage * spells[buffs[slot].spellid].base[i] / 100;
+ break;
+ }
+ }
+ }
+
+ // Do Runes...
slot = GetBuffSlotFromType(SE_MitigateMeleeDamage);
if(slot >= 0)
{
@@ -3155,7 +3172,7 @@
//see if any runes want to reduce this damage
if(spell_id == SPELL_UNKNOWN) {
- damage = ReduceDamage(damage);
+ damage = AffectMeleeDamage(damage, skill_used);
mlog(COMBAT__HITS, "Melee Damage reduced to %d", damage);
} else {
sint32 origdmg = damage;
|
|
|
|
|
|
|
07-11-2010, 05:19 PM
|
Dragon
|
|
Join Date: May 2009
Location: Milky Way
Posts: 539
|
|
missed one line in the attack.cpp... new one
Code:
Index: attack.cpp
===================================================================
--- attack.cpp (revision 1596)
+++ attack.cpp (working copy)
@@ -2861,13 +2861,14 @@
}
}
-sint32 Mob::ReduceDamage(sint32 damage)
+sint32 Mob::AffectMeleeDamage(sint32 damage, const SkillType skill_used)
{
- if(damage <= 0 || (!HasRune() && !HasPartialMeleeRune()))
+ if(damage <= 0)
{
return damage;
}
-
+
+ // Block attack first
int slot = GetBuffSlotFromType(SE_NegateAttacks);
if(slot >= 0 && buffs[slot].melee_rune > 0)
{
@@ -2878,7 +2879,26 @@
}
return -6;
}
-
+
+ // Affect melee damage
+ slot = GetBuffSlotFromType(SE_SkillDamageTaken);
+ if(slot >= 0)
+ {
+ for(int i = 0; i < EFFECT_COUNT; i++)
+ {
+ if (spells[buffs[slot].spellid].effectid[i] == SE_SkillDamageTaken)
+ {
+ // Check the skill against the spell, or allow all melee skills.
+ if(skill_used == spells[buffs[slot].spellid].base2[i] || spells[buffs[slot].spellid].base2[i] == -1)
+ {
+ damage += damage * spells[buffs[slot].spellid].base[i] / 100;
+ break;
+ }
+ }
+ }
+ }
+
+ // Do Runes...
slot = GetBuffSlotFromType(SE_MitigateMeleeDamage);
if(slot >= 0)
{
@@ -3155,7 +3175,7 @@
//see if any runes want to reduce this damage
if(spell_id == SPELL_UNKNOWN) {
- damage = ReduceDamage(damage);
+ damage = AffectMeleeDamage(damage, skill_used);
mlog(COMBAT__HITS, "Melee Damage reduced to %d", damage);
} else {
sint32 origdmg = damage;
|
|
|
|
07-11-2010, 09:24 PM
|
Developer
|
|
Join Date: Mar 2009
Location: -
Posts: 228
|
|
I extended my personal thanks.
Been waiting for this spell effect to be working forever!
Kayen
GM Stormhaven
|
|
|
|
07-12-2010, 11:10 PM
|
Dragon
|
|
Join Date: May 2009
Location: Milky Way
Posts: 539
|
|
OK new fixed code, crits match dmg and such. Also modified the GetBuffSlotByType function so that it can return values above 254(since spell effects go above this, the function is not usable on a majority of effects) and added a new function GetSpellIDFromSlot, not sure if its 100% needed but couldn't get it working without it and think it will make further effects easier to do.
code...
attack.cpp
Code:
Index: attack.cpp
===================================================================
--- attack.cpp (revision 1597)
+++ attack.cpp (working copy)
@@ -1252,6 +1252,7 @@
other->AvoidDamage(this, damage);
other->MeleeMitigation(this, damage, min_hit);
ApplyMeleeDamageBonus(skillinuse, damage);
+ damage = GetSkillDmgTaken(skillinuse, damage);
TryCriticalHit(other, skillinuse, damage);
mlog(COMBAT__DAMAGE, "Final damage after all reductions: %d", damage);
}
@@ -1828,6 +1829,7 @@
if(other->IsClient() && other->CastToClient()->IsSitting()) {
mlog(COMBAT__DAMAGE, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane));
damage = (max_dmg+eleBane);
+ damage = GetSkillDmgTaken(skillinuse, damage);
mlog(COMBAT__HITS, "Generating hate %d towards %s", hate, GetName());
// now add done damage to the hate list
@@ -1839,6 +1841,7 @@
other->AvoidDamage(this, damage);
other->MeleeMitigation(this, damage, min_dmg+eleBane);
ApplyMeleeDamageBonus(skillinuse, damage);
+ damage = GetSkillDmgTaken(skillinuse, damage);
TryCriticalHit(other, skillinuse, damage);
mlog(COMBAT__HITS, "Generating hate %d towards %s", hate, GetName());
mob.h
Code:
Index: mob.h
===================================================================
--- mob.h (revision 1597)
+++ mob.h (working copy)
@@ -533,7 +533,8 @@
void DamageShield(Mob* other);
bool FindBuff(int16 spellid);
bool FindType(int8 type, bool bOffensive = false, int16 threshold = 100);
- sint8 GetBuffSlotFromType(int8 type);
+ sint8 GetBuffSlotFromType(int16 type);
+ int16 GetSpellIDFromSlot(int8 slot);
int CountDispellableBuffs();
bool HasBuffIcon(Mob* caster, Mob* target, int16 spell_id);
@@ -778,6 +779,7 @@
bool TryDeathSave();
void DoBuffWearOffEffect(uint32 index);
void TryTriggerOnCast(Mob *target, uint32 spell_id);
+ sint32 GetSkillDmgTaken(const SkillType skill_used, sint32 damage);
static int32 GetAppearanceValue(EmuAppearance iAppearance);
void SendAppearancePacket(int32 type, int32 value, bool WholeZone = true, bool iIgnoreSelf = false, Client *specific_target=NULL);
mob.cpp
Code:
Index: mob.cpp
===================================================================
--- mob.cpp (revision 1597)
+++ mob.cpp (working copy)
@@ -3036,4 +3036,29 @@
}
}
}
+}
+
+sint32 Mob::GetSkillDmgTaken(const SkillType skill_used, sint32 damage)
+{
+ int slot = this->GetTarget()->GetBuffSlotFromType(SE_SkillDamageTaken);
+ if(slot >= 0)
+ {
+ int spell_id = this->GetTarget()->GetSpellIDFromSlot(slot);
+ if (spell_id)
+ {
+ for(int i = 0; i < EFFECT_COUNT; i++)
+ {
+ if (spells[spell_id].effectid[i] == SE_SkillDamageTaken)
+ {
+ // Check the skill against the spell, or allow all melee skills.
+ if(skill_used == spells[spell_id].base2[i] || spells[spell_id].base2[i] == -1)
+ {
+ damage += damage * spells[spell_id].base[i] / 100;
+ return damage;
+ }
+ }
+ }
+ }
+ }
+ return damage;
}
\ No newline at end of file
spell effects.cpp
Code:
Index: spell_effects.cpp
===================================================================
--- spell_effects.cpp (revision 1597)
+++ spell_effects.cpp (working copy)
@@ -2812,6 +2812,7 @@
case SE_LimitCastTime:
case SE_NoCombatSkills:
case SE_TriggerOnCast:
+ case SE_SkillDamageTaken:
{
break;
}
spells.cpp
Code:
Index: spells.cpp
===================================================================
--- spells.cpp (revision 1597)
+++ spells.cpp (working copy)
@@ -4434,7 +4434,7 @@
*/
// solar: TODO get rid of this
-sint8 Mob::GetBuffSlotFromType(int8 type) {
+sint8 Mob::GetBuffSlotFromType(int16 type) {
uint32 buff_count = GetMaxTotalSlots();
for (int i = 0; i < buff_count; i++) {
if (buffs[i].spellid != SPELL_UNKNOWN) {
@@ -4447,6 +4447,12 @@
return -1;
}
+int16 Mob::GetSpellIDFromSlot(int8 slot)
+{
+ if (buffs[slot].spellid != SPELL_UNKNOWN)
+ return buffs[slot].spellid;
+ return 0;
+}
bool Mob::FindType(int8 type, bool bOffensive, int16 threshold) {
uint32 buff_count = GetMaxTotalSlots();
|
|
|
|
|
|
|
11-05-2010, 02:59 PM
|
Dragon
|
|
Join Date: May 2009
Location: Milky Way
Posts: 539
|
|
Updated this effect to use the bonus system as well. Decided to use an array to store the various different skills that might get modified so that people/mobs could be affected by spells that affect many different skills(eg archery, BS, 1 hd slash all at once). I made the effect additive(not just the highest value for a specific skill) since it fits this effect better.
Code:
Index: EQEmuServer/zone/attack.cpp
===================================================================
--- EQEmuServer/zone/attack.cpp (revision 1714)
+++ EQEmuServer/zone/attack.cpp (working copy)
@@ -1270,7 +1270,8 @@
other->AvoidDamage(this, damage);
other->MeleeMitigation(this, damage, min_hit);
ApplyMeleeDamageBonus(skillinuse, damage);
- damage = GetSkillDmgTaken(skillinuse, damage);
+ damage += damage * other->GetSkillDmgTaken(skillinuse) / 100;
+
TryCriticalHit(other, skillinuse, damage);
mlog(COMBAT__DAMAGE, "Final damage after all reductions: %d", damage);
}
@@ -1863,7 +1864,7 @@
if(other->IsClient() && other->CastToClient()->IsSitting()) {
mlog(COMBAT__DAMAGE, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane));
damage = (max_dmg+eleBane);
- damage = GetSkillDmgTaken(skillinuse, damage);
+ damage += damage * other->GetSkillDmgTaken(skillinuse) / 100;
mlog(COMBAT__HITS, "Generating hate %d towards %s", hate, GetName());
// now add done damage to the hate list
@@ -1875,7 +1876,8 @@
other->AvoidDamage(this, damage);
other->MeleeMitigation(this, damage, min_dmg+eleBane);
ApplyMeleeDamageBonus(skillinuse, damage);
- damage = GetSkillDmgTaken(skillinuse, damage);
+ damage += damage * other->GetSkillDmgTaken(skillinuse) / 100;
+
TryCriticalHit(other, skillinuse, damage);
mlog(COMBAT__HITS, "Generating hate %d towards %s", hate, GetName());
Index: EQEmuServer/zone/bonuses.cpp
===================================================================
--- EQEmuServer/zone/bonuses.cpp (revision 1714)
+++ EQEmuServer/zone/bonuses.cpp (working copy)
@@ -1206,8 +1206,15 @@
newbon->Accuracy = effect_value;
break;
}
-
-
+ case SE_SkillDamageTaken:
+ {
+ int index_skill = spells[spell_id].base2[i];
+ if(index_skill == -1)
+ index_skill = 75;
+
+ newbon->SkillDmgTaken[index_skill] += effect_value;
+ break;
+ }
}
}
}
Index: EQEmuServer/zone/mob.cpp
===================================================================
--- EQEmuServer/zone/mob.cpp (revision 1714)
+++ EQEmuServer/zone/mob.cpp (working copy)
@@ -3295,32 +3295,18 @@
return damage;
}
-sint32 Mob::GetSkillDmgTaken(const SkillType skill_used, sint32 damage)
+sint16 Mob::GetSkillDmgTaken(const SkillType skill_used)
{
- if (this->GetTarget())
- {
- int slot = this->GetTarget()->GetBuffSlotFromType(SE_SkillDamageTaken);
- if(slot >= 0)
- {
- int spell_id = this->GetTarget()->GetSpellIDFromSlot(slot);
- if (spell_id)
- {
- for(int i = 0; i < EFFECT_COUNT; i++)
- {
- if (spells[spell_id].effectid[i] == SE_SkillDamageTaken)
- {
- // Check the skill against the spell, or allow all melee skills.
- if(skill_used == spells[spell_id].base2[i] || spells[spell_id].base2[i] == -1)
- {
- damage += damage * spells[spell_id].base[i] / 100;
- return damage;
- }
- }
- }
- }
- }
- }
- return damage;
+ int skilldmg_mod = 0;
+
+ // All skill dmg mod + Skill specific
+ skilldmg_mod += this->itembonuses.SkillDmgTaken[75] + this->spellbonuses.SkillDmgTaken[75] +
+ this->itembonuses.SkillDmgTaken[skill_used] + this->spellbonuses.SkillDmgTaken[skill_used];
+
+ if(skilldmg_mod < -100)
+ skilldmg_mod = -100;
+
+ return skilldmg_mod;
}
int32 Mob::GetHealRate(uint32 amount, Mob *target)
@@ -4033,3 +4019,4 @@
CastToClient()->FastQueuePacket(&outapp_push);
}
}
+
Index: EQEmuServer/zone/mob.h
===================================================================
--- EQEmuServer/zone/mob.h (revision 1714)
+++ EQEmuServer/zone/mob.h (working copy)
@@ -275,6 +275,7 @@
sint8 HundredHands; //extra haste, stacks with all other haste i
sint8 MeleeLifetap;
+ sint16 SkillDmgTaken[HIGHEST_SKILL+1];
int XPRateMod;
sint8 Packrat; //weight reduction for items, 1 point = 10%
@@ -798,7 +799,7 @@
bool TryFadeEffect(int slot);
int32 GetHealRate(uint32 amount, Mob *target);
sint32 GetVulnerability(sint32 damage, Mob *caster, uint32 spell_id, int32 ticsremaining);
- sint32 GetSkillDmgTaken(const SkillType skill_used, sint32 damage);
+ sint16 GetSkillDmgTaken(const SkillType skill_used);
void DoKnockback(Mob *caster, uint32 pushback, uint32 pushup);
static int32 GetAppearanceValue(EmuAppearance iAppearance);
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 01:46 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|