Merge pull request #120 from KayenEQ/master

Spell effect addition / fixes
This commit is contained in:
Michael Cook 2014-02-26 14:15:17 -05:00
commit ea31a29f8a
12 changed files with 88 additions and 58 deletions

View File

@ -1,5 +1,10 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 02/26/2014 ==
Kayen: Implemented SE_FrenziedDevestation - increase critical spell chacnce and 2x mana cost for DD spells
Kayen: Fixed SE_SpellProcChance - Now works on spell dervived procs
== 02/24/2014 ==
Sorvani: Updated GetUnusedInstanceID to not recycle instance ID's unless it has reached max (65535)

View File

@ -359,7 +359,7 @@ typedef enum {
#define SE_DispelBeneficial 209 // implemented
//#define SE_PetShield 210 // *not implemented
#define SE_AEMelee 211 // implemented
//#define SE_CastingSkills 212 // *not implemented -Include/Exclude Casting Skill type. (*no longer used on live)
#define SE_FrenziedDevastation 212 // implemented - increase spell criticals + all DD spells cast 2x mana.
#define SE_PetMaxHP 213 // implemented[AA] - increases the maximum hit points of your pet
#define SE_MaxHPChange 214 // implemented
#define SE_PetAvoidance 215 // implemented[AA] - increases pet ability to avoid melee damage
@ -397,7 +397,7 @@ typedef enum {
#define SE_RaiseSkillCap 247 // *not implemented[AA] - adds skill over the skill cap.
//#define SE_SecondaryForte 248 // not implemented as bonus(gives you a 2nd specialize skill that can go past 50 to 100)
#define SE_SecondaryDmgInc 249 // implemented[AA] Allows off hand weapon to recieve a damage bonus (Sinister Strikes)
#define SE_SpellProcChance 250 // implemented - Increase chance to sympathetic proc by %
#define SE_SpellProcChance 250 // implemented - Increase chance to proc from melee proc spells (ie Spirit of Panther)
#define SE_ConsumeProjectile 251 // implemented[AA] - chance to not consume an arrow (ConsumeProjectile = 100)
#define SE_FrontalBackstabChance 252 // implemented[AA] - chance to perform a full damage backstab from front.
#define SE_FrontalBackstabMinDmg 253 // implemented[AA] - allow a frontal backstab for mininum damage.

View File

@ -0,0 +1,8 @@
-- Virulent Venom
INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1, `base2`) VALUES ('888', '1', '250', '10', '0');
INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1, `base2`) VALUES ('889', '1', '250', '20', '0');
INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1, `base2`) VALUES ('890', '1', '250', '30', '0');
INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1, `base2`) VALUES ('891', '1', '250', '40', '0');
INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1, `base2`) VALUES ('892', '1', '250', '50', '0');

View File

@ -1414,7 +1414,7 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
if (caster->IsClient())
{
//3: At maxed ability, Total Domination has a 50% chance of preventing the charm break that otherwise would have occurred.
uint16 TotalDominationBonus = caster->aabonuses.CharmBreakChance + caster->spellbonuses.CharmBreakChance + caster->itembonuses.CharmBreakChance;
int16 TotalDominationBonus = caster->aabonuses.CharmBreakChance + caster->spellbonuses.CharmBreakChance + caster->itembonuses.CharmBreakChance;
if (MakeRandomInt(0, 99) < TotalDominationBonus)
return true;

View File

@ -3888,14 +3888,14 @@ void Mob::HealDamage(uint32 amount, Mob* caster) {
//proc chance includes proc bonus
float Mob::GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed, uint16 hand) {
float Mob::GetProcChances(float &BaseProcChance, float &ProcBonus, float &ProcChance, uint16 weapon_speed, uint16 hand) {
int mydex = GetDEX();
float AABonus = 0;
ProcBonus = 0;
ProcChance = 0;
BaseProcChance = 0;
if (aabonuses.ProcChance)
AABonus = float(aabonuses.ProcChance) / 100.0f;
ProcBonus = float(aabonuses.ProcChanceSPA + spellbonuses.ProcChanceSPA + itembonuses.ProcChanceSPA); //Spell Effects
ProcBonus += float(itembonuses.ProcChance)/10.0f; //Combat Effects
switch(hand){
case 13:
@ -3915,18 +3915,18 @@ float Mob::GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_spe
if(weapon_speed < RuleI(Combat, MinHastedDelay)) // fast as a client can swing, so should be the floor of the proc chance
weapon_speed = RuleI(Combat, MinHastedDelay);
ProcBonus += (float(itembonuses.ProcChance + spellbonuses.ProcChance) / 1000.0f + AABonus);
if(RuleB(Combat, AdjustProcPerMinute) == true)
{
ProcChance = ((float)weapon_speed * RuleR(Combat, AvgProcsPerMinute) / 60000.0f); // compensate for weapon_speed being in ms
ProcBonus += float(mydex) * RuleR(Combat, ProcPerMinDexContrib) / 100.0f;
ProcChance = ProcChance + (ProcChance * ProcBonus);
BaseProcChance = ProcChance;
ProcBonus += float(mydex) * RuleR(Combat, ProcPerMinDexContrib);
ProcChance += ProcChance*ProcBonus/100.0f;
}
else
{
ProcChance = RuleR(Combat, BaseProcChance) + float(mydex) / RuleR(Combat, ProcDexDivideBy);
ProcChance = ProcChance + (ProcChance * ProcBonus);
BaseProcChance = ProcChance;
ProcChance += ProcChance*ProcBonus/100.0f;
}
mlog(COMBAT__PROCS, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
@ -3950,16 +3950,6 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 w
break;
}
/*
float PermaHaste;
if(GetHaste() > 0)
PermaHaste = 1 / (1 + (float)GetHaste()/100);
else if(GetHaste() < 0)
PermaHaste = 1 * (1 - (float)GetHaste()/100);
else
PermaHaste = 1.0f;
*/
//calculate the weapon speed in ms, so we can use the rule to compare against.
//weapon_speed = ((int)(weapon_speed*(100.0f+attack_speed)*PermaHaste));
if(weapon_speed < RuleI(Combat, MinHastedDelay)) // fast as a client can swing, so should be the floor of the proc chance
@ -4054,8 +4044,8 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) {
//we have to calculate these again, oh well
int ourlevel = GetLevel();
float ProcChance, ProcBonus;
GetProcChances(ProcBonus, ProcChance, weapon_g->GetItem()->Delay, hand);
float ProcChance, ProcBonus, BaseProcChance;
GetProcChances(BaseProcChance, ProcBonus, ProcChance, weapon_g->GetItem()->Delay, hand);
if(hand != 13)
{
ProcChance /= 2;
@ -4092,11 +4082,11 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) {
void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct* weapon, Mob *on, uint16 hand) {
uint16 skillinuse = 28;
int ourlevel = GetLevel();
float ProcChance, ProcBonus;
float ProcChance, ProcBonus, BaseProcChance;
if(weapon!=nullptr)
GetProcChances(ProcBonus, ProcChance, weapon->Delay, hand);
GetProcChances(BaseProcChance, ProcBonus, ProcChance, weapon->Delay, hand);
else
GetProcChances(ProcBonus, ProcChance);
GetProcChances(BaseProcChance, ProcBonus, ProcChance);
if(hand != 13) //Is Archery intended to proc at 50% rate?
ProcChance /= 2;
@ -4149,10 +4139,11 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct* weapon, Mob *on
}
}
int16 SpellProcChance = spellbonuses.SpellProcChance + itembonuses.SpellProcChance + aabonuses.SpellProcChance;
uint32 i;
for(i = 0; i < MAX_PROCS; i++) {
if (PermaProcs[i].spellID != SPELL_UNKNOWN) {
if(MakeRandomInt(0, 100) < PermaProcs[i].chance) {
if(MakeRandomInt(0, 100) < PermaProcs[i].chance) { //TODO: Unclear if these are treated like Spells or WeaponProcs
mlog(COMBAT__PROCS, "Permanent proc %d procing spell %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance);
ExecWeaponProc(nullptr, PermaProcs[i].spellID, on);
} else {
@ -4168,7 +4159,8 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct* weapon, Mob *on
}
else
{
int chance = ProcChance * (SpellProcs[i].chance);
int chance = BaseProcChance * (SpellProcs[i].chance);
chance += chance*SpellProcChance/100;
if(MakeRandomInt(0, 100) < chance) {
mlog(COMBAT__PROCS, "Spell proc %d procing spell %d (%d percent chance)", i, SpellProcs[i].spellID, chance);
ExecWeaponProc(nullptr, SpellProcs[i].spellID, on);
@ -4179,7 +4171,8 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct* weapon, Mob *on
}
}
if (bRangedAttack) {
int chance = ProcChance * RangedProcs[i].chance;
int chance = BaseProcChance * RangedProcs[i].chance;
chance += chance*SpellProcChance/100;
if(MakeRandomInt(0, 100) < chance) {
mlog(COMBAT__PROCS, "Ranged proc %d procing spell %d", i, RangedProcs[i].spellID, RangedProcs[i].chance);
ExecWeaponProc(nullptr, RangedProcs[i].spellID, on);

View File

@ -963,7 +963,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
newbon->GiveDoubleAttack += base1;
break;
case SE_ProcChance:
newbon->ProcChance += base1;
newbon->ProcChanceSPA += base1;
break;
case SE_RiposteChance:
newbon->RiposteChance += base1;
@ -1228,6 +1228,14 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon)
break;
}
case SE_FrenziedDevastation:
newbon->FrenziedDevastation += base2;
break;
case SE_SpellProcChance:
newbon->SpellProcChance += base1;
break;
}
}
}
@ -1882,17 +1890,14 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
case SE_ProcChance:
{
//multiplier is to be compatible with item effects,watching for overflow too
effect_value = effect_value<3000? effect_value : 3000;
if (RuleB(Spells, AdditiveBonusValues) && item_bonus)
newbon->ProcChance += effect_value;
newbon->ProcChanceSPA += effect_value;
else if((effect_value < 0) && (newbon->DoubleAttackChance > effect_value))
newbon->ProcChance = effect_value;
else if((effect_value < 0) && (newbon->ProcChanceSPA > effect_value))
newbon->ProcChanceSPA = effect_value;
if(newbon->ProcChance < effect_value)
newbon->ProcChance = effect_value;
if(newbon->ProcChanceSPA < effect_value)
newbon->ProcChanceSPA = effect_value;
break;
}
@ -2524,6 +2529,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
newbon->DistanceRemoval = true;
break;
case SE_FrenziedDevastation:
newbon->FrenziedDevastation += spells[spell_id].base2[i];
break;
}
}
}
@ -3311,9 +3320,9 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
break;
case SE_ProcChance:
spellbonuses.ProcChance = effect_value;
aabonuses.ProcChance = effect_value;
itembonuses.ProcChance = effect_value;
spellbonuses.ProcChanceSPA = effect_value;
aabonuses.ProcChanceSPA = effect_value;
itembonuses.ProcChanceSPA = effect_value;
break;
case SE_ExtraAttackChance:
@ -3866,7 +3875,13 @@ void Mob::NegateSpellsBonuses(uint16 spell_id)
spellbonuses.ImprovedTaunt[0] = effect_value;
spellbonuses.ImprovedTaunt[1] = effect_value;
spellbonuses.ImprovedTaunt[2] = -1;
break;
case SE_FrenziedDevastation:
spellbonuses.FrenziedDevastation += effect_value;
aabonuses.FrenziedDevastation += effect_value;
itembonuses.FrenziedDevastation += effect_value;
break;
}
}
}

View File

@ -7705,14 +7705,14 @@ int16 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
}
//proc chance includes proc bonus
float Bot::GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed, uint16 hand) {
float Bot::GetProcChances(float &BaseProcChance, float &ProcBonus, float &ProcChance, uint16 weapon_speed, uint16 hand) {
int mydex = GetDEX();
float AABonus = 0;
ProcBonus = 0;
ProcChance = 0;
BaseProcChance = 0;
if (aabonuses.ProcChance)
AABonus = float(aabonuses.ProcChance) / 100.0f;
ProcBonus = float(aabonuses.ProcChanceSPA + spellbonuses.ProcChanceSPA + itembonuses.ProcChanceSPA); //Spell Effects
ProcBonus += float(itembonuses.ProcChance)/10.0f; //Combat Effects
switch(hand){
case SLOT_PRIMARY:
@ -7732,18 +7732,18 @@ float Bot::GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_spe
if(weapon_speed < RuleI(Combat, MinHastedDelay)) // fast as a client can swing, so should be the floor of the proc chance
weapon_speed = RuleI(Combat, MinHastedDelay);
ProcBonus += (float(itembonuses.ProcChance + spellbonuses.ProcChance) / 1000.0f + AABonus);
if(RuleB(Combat, AdjustProcPerMinute) == true)
{
ProcChance = ((float)weapon_speed * RuleR(Combat, AvgProcsPerMinute) / 60000.0f); // compensate for weapon_speed being in ms
ProcBonus += float(mydex) * RuleR(Combat, ProcPerMinDexContrib) / 100.0f;
ProcChance = ProcChance + (ProcChance * ProcBonus);
ProcChance = BaseProcChance;
ProcBonus += float(mydex) * RuleR(Combat, ProcPerMinDexContrib);
ProcChance += ProcChance*ProcBonus / 100.0f;
}
else
{
ProcChance = RuleR(Combat, BaseProcChance) + float(mydex) / RuleR(Combat, ProcDexDivideBy);
ProcChance = ProcChance + (ProcChance * ProcBonus);
ProcChance = BaseProcChance;
ProcChance += ProcChance*ProcBonus / 100.0f;
}
mlog(COMBAT__PROCS, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);

View File

@ -167,7 +167,7 @@ public:
uint16 BotGetSpells(int spellslot) { return AIspells[spellslot].spellid; }
uint16 BotGetSpellType(int spellslot) { return AIspells[spellslot].type; }
uint16 BotGetSpellPriority(int spellslot) { return AIspells[spellslot].priority; }
virtual float GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed, uint16 hand);
virtual float GetProcChances(float &BaseProcChance, float &ProcBonus, float &ProcChance, uint16 weapon_speed, uint16 hand);
virtual bool AvoidDamage(Mob* other, int32 &damage, bool CanRiposte);
virtual int GetMonkHandToHandDamage(void);
virtual bool TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse);

View File

@ -274,6 +274,7 @@ struct StatBonuses {
int16 DamageModifier[HIGHEST_SKILL+2]; //i
int16 MinDamageModifier[HIGHEST_SKILL+2]; //i
int16 ProcChance; // ProcChance/10 == % increase i = CombatEffects
int16 ProcChanceSPA; // ProcChance from spell effects
int16 ExtraAttackChance;
int16 DoTShielding;
int16 DivineSaveChance[2]; // Second Chance (base1 = chance, base2 = spell on trigger)
@ -311,8 +312,8 @@ struct StatBonuses {
//uint16 BlockSpellEffect[EFFECT_COUNT]; // Prevents spells with certain effects from landing on you *no longer used
bool ImmuneToFlee; // Bypass the fleeing flag
uint16 VoiceGraft; // Stores the ID of the mob with which to talk through
uint16 SpellProcChance; // chance to proc from sympathetic spell effects
uint16 CharmBreakChance; // chance to break charm
int16 SpellProcChance; // chance to proc from sympathetic spell effects
int16 CharmBreakChance; // chance to break charm
int16 SongRange; // increases range of beneficial bard songs
uint16 HPToManaConvert; // Uses HP to cast spells at specific conversion
uint16 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have.
@ -335,6 +336,7 @@ struct StatBonuses {
bool DivineAura; // invulnerability
bool DistanceRemoval; // Check if Cancle if Moved effect is present
int16 ImprovedTaunt[3]; // 0 = Max Level 1 = Aggro modifier 2 = buffid
int16 FrenziedDevastation; // base1= AArank(used) base2= chance increase spell criticals + all DD spells 2x mana.
//bool AbsorbMagicAtt; // Magic Rune *Need to be implemented for NegateEffect
//bool MeleeRune; // Melee Rune *Need to be implemented for NegateEffect

View File

@ -81,6 +81,8 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
int chance = RuleI(Spells, BaseCritChance);
chance += itembonuses.CriticalSpellChance + spellbonuses.CriticalSpellChance + aabonuses.CriticalSpellChance;
chance += itembonuses.FrenziedDevastation + spellbonuses.FrenziedDevastation + aabonuses.FrenziedDevastation;
if (chance > 0){
@ -321,6 +323,12 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
int32 Client::GetActSpellCost(uint16 spell_id, int32 cost)
{
//FrenziedDevastation doubles mana cost of all DD spells
int16 FrenziedDevastation = itembonuses.FrenziedDevastation + spellbonuses.FrenziedDevastation + aabonuses.FrenziedDevastation;
if (FrenziedDevastation && IsPureNukeSpell(spell_id))
cost *= 2;
// Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell
if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5)
{

View File

@ -971,7 +971,7 @@ protected:
void TryWeaponProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = 13);
void TryWeaponProc(const ItemInst* weapon, Mob *on, uint16 hand = 13);
void ExecWeaponProc(const ItemInst* weapon, uint16 spell_id, Mob *on);
virtual float GetProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed = 30, uint16 hand = 13);
virtual float GetProcChances(float &BaseProcChance, float &ProcBonus, float &ProcChance, uint16 weapon_speed = 30, uint16 hand = 13);
virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 weapon_speed = 30, uint16 hand = 13);
int GetWeaponDamage(Mob *against, const Item_Struct *weapon_item);
int GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate = nullptr);

View File

@ -2826,6 +2826,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
case SE_CriticalMend:
case SE_LimitCastTimeMax:
case SE_TriggerOnReqCaster:
case SE_FrenziedDevastation:
{
break;
}
@ -5396,14 +5397,12 @@ bool Mob::AffectedBySpellExcludingSlot(int slot, int effect)
float Mob::GetSympatheticProcChances(float &ProcBonus, float &ProcChance, int32 cast_time, int16 ProcRateMod) {
ProcBonus = spellbonuses.SpellProcChance + itembonuses.SpellProcChance;
ProcChance = 0;
if(cast_time > 0)
{
ProcChance = ((float)cast_time * RuleR(Casting, AvgSpellProcsPerMinute) / 60000.0f);
ProcChance = ProcChance * (float)(ProcRateMod/100);
ProcChance = ProcChance+(ProcChance*ProcBonus/100);
}
return ProcChance;
}