diff --git a/sql/mangos.sql b/sql/mangos.sql index 2249be5e1..0e3d21a25 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9385_01_mangos_command` bit(1) default NULL + `required_9450_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -18666,7 +18666,8 @@ INSERT INTO `spell_proc_event` VALUES (67667, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), (67672, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 50), (67702, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), -(67771, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); +(67771, 0x00000000, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(70664, 0x00000000, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 2.000000, 0); /*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/updates/9450_01_mangos_spell_proc_event.sql b/sql/updates/9450_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..3f8078852 --- /dev/null +++ b/sql/updates/9450_01_mangos_spell_proc_event.sql @@ -0,0 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_9385_01_mangos_command required_9450_01_mangos_spell_proc_event bit; + +DELETE FROM `spell_proc_event` WHERE `entry` = 70664; +INSERT INTO `spell_proc_event` VALUES +(70664, 0x00000000, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000, 2.000000, 0); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index acd524919..e7744fb06 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -75,6 +75,7 @@ pkgdata_DATA = \ 9380_01_mangos_command.sql \ 9382_01_mangos_command.sql \ 9385_01_mangos_command.sql \ + 9450_01_mangos_spell_proc_event.sql \ README ## Additional files to include when running 'make dist' @@ -130,4 +131,5 @@ EXTRA_DIST = \ 9380_01_mangos_command.sql \ 9382_01_mangos_command.sql \ 9385_01_mangos_command.sql \ + 9450_01_mangos_spell_proc_event.sql \ README diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index f24ae9a60..dff18d0cf 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6902,7 +6902,14 @@ void Aura::PeriodicTick() { int32 ticks = GetAuraMaxTicks(); int32 remainingTicks = ticks - GetAuraTicks(); - pdamage = int32(pdamage) + int32(amount)*ticks*(-6+2*remainingTicks)/100; + int32 addition = int32(amount)*ticks*(-6+2*remainingTicks)/100; + + if (GetAuraTicks() != 1) + // Item - Druid T10 Restoration 2P Bonus + if (Aura *aura = pCaster->GetAura(70658, EFFECT_INDEX_0)) + addition += abs(int32((addition * aura->GetModifier()->m_amount) / ((ticks-1)* 100))); + + pdamage = int32(pdamage) + addition; } } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 5f14ffbde..cbe69fd7b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4928,7 +4928,7 @@ bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 13877: case 33735: { - target = SelectNearbyTarget(pVictim); + target = SelectRandomUnfriendlyTarget(pVictim); if(!target) return false; basepoints0 = damage; @@ -5071,7 +5071,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if(procSpell && procSpell->Id == 26654) return false; - target = SelectNearbyTarget(pVictim); + target = SelectRandomUnfriendlyTarget(pVictim); if(!target) return false; @@ -5646,7 +5646,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if(procSpell && procSpell->Id == 26654) return false; - target = SelectNearbyTarget(pVictim); + target = SelectRandomUnfriendlyTarget(pVictim); if(!target) return false; @@ -6009,6 +6009,28 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu triggered_spell_id = 54755; break; } + // Item - Druid T10 Restoration 4P Bonus (Rejuvenation) + case 70664: + { + if (!procSpell || GetTypeId() != TYPEID_PLAYER) + return false; + + float radius; + if (procSpell->EffectRadiusIndex[EFFECT_INDEX_0]) + radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(procSpell->EffectRadiusIndex[EFFECT_INDEX_0])); + else + radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(procSpell->rangeIndex)); + + ((Player*)this)->ApplySpellMod(procSpell->Id, SPELLMOD_RADIUS, radius,NULL); + + Unit *second = pVictim->SelectRandomFriendlyTarget(pVictim, radius); + + if (!second) + return false; + + pVictim->CastSpell(second, procSpell, true, NULL, triggeredByAura, GetGUID()); + return true; + } } // Eclipse if (dummySpell->SpellIconID == 2856) @@ -12765,7 +12787,7 @@ void Unit::UpdateReactives( uint32 p_time ) } } -Unit* Unit::SelectNearbyTarget(Unit* except /*= NULL*/) const +Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= NULL*/, float radius /*= ATTACK_DISTANCE*/) const { CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); @@ -12774,14 +12796,62 @@ Unit* Unit::SelectNearbyTarget(Unit* except /*= NULL*/) const std::list targets; - MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, ATTACK_DISTANCE); + MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, radius); MaNGOS::UnitListSearcher searcher(this, targets, u_check); TypeContainerVisitor, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); - cell.Visit(p, world_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE); - cell.Visit(p, grid_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE); + cell.Visit(p, world_unit_searcher, *GetMap(), *this, radius); + cell.Visit(p, grid_unit_searcher, *GetMap(), *this, radius); + + // remove current target + if(except) + targets.remove(except); + + // remove not LoS targets + for(std::list::iterator tIter = targets.begin(); tIter != targets.end();) + { + if(!IsWithinLOSInMap(*tIter)) + { + std::list::iterator tIter2 = tIter; + ++tIter; + targets.erase(tIter2); + } + else + ++tIter; + } + + // no appropriate targets + if(targets.empty()) + return NULL; + + // select random + uint32 rIdx = urand(0,targets.size()-1); + std::list::const_iterator tcIter = targets.begin(); + for(uint32 i = 0; i < rIdx; ++i) + ++tcIter; + + return *tcIter; +} + +Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= NULL*/, float radius /*= ATTACK_DISTANCE*/) const +{ + CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + std::list targets; + + MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(this, this, radius); + MaNGOS::UnitListSearcher searcher(this, targets, u_check); + + TypeContainerVisitor, WorldTypeMapContainer > world_unit_searcher(searcher); + TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); + + cell.Visit(p, world_unit_searcher, *GetMap(), *this, radius); + cell.Visit(p, grid_unit_searcher, *GetMap(), *this, radius); // remove current target if(except) diff --git a/src/game/Unit.h b/src/game/Unit.h index 158903a68..fac7911e7 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1128,7 +1128,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void CombatStop(bool includingCast = false); void CombatStopWithPets(bool includingCast = false); void StopAttackFaction(uint32 faction_id); - Unit* SelectNearbyTarget(Unit* except = NULL) const; + Unit* SelectRandomUnfriendlyTarget(Unit* except = NULL, float radius = ATTACK_DISTANCE) const; + Unit* SelectRandomFriendlyTarget(Unit* except = NULL, float radius = ATTACK_DISTANCE) const; bool hasNegativeAuraWithInterruptFlag(uint32 flag); void SendMeleeAttackStop(Unit* victim); void SendMeleeAttackStart(Unit* pVictim); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e4a87bcdf..ffa9507f8 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9449" + #define REVISION_NR "9450" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 82e040ec7..5b08b671b 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9375_01_characters_character_glyphs" - #define REVISION_DB_MANGOS "required_9385_01_mangos_command" + #define REVISION_DB_MANGOS "required_9450_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_9010_01_realmd_realmlist" #endif // __REVISION_SQL_H__