Skip to content

Commit

Permalink
[9450] Implement item set 887, 251, 232 spell effects.
Browse files Browse the repository at this point in the history
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
laise authored and VladimirMangos committed Feb 25, 2010
1 parent aebeeb5 commit 80531d4
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 13 deletions.
5 changes: 3 additions & 2 deletions sql/mangos.sql
Expand Up @@ -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';

--
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions 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);
2 changes: 2 additions & 0 deletions sql/updates/Makefile.am
Expand Up @@ -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'
Expand Down Expand Up @@ -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
9 changes: 8 additions & 1 deletion src/game/SpellAuras.cpp
Expand Up @@ -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;
}
}

Expand Down
84 changes: 77 additions & 7 deletions src/game/Unit.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -12774,14 +12796,62 @@ Unit* Unit::SelectNearbyTarget(Unit* except /*= NULL*/) const

std::list<Unit *> targets;

MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, ATTACK_DISTANCE);
MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, radius);
MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck> searcher(this, targets, u_check);

TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, 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<Unit *>::iterator tIter = targets.begin(); tIter != targets.end();)
{
if(!IsWithinLOSInMap(*tIter))
{
std::list<Unit *>::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<Unit *>::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<Unit *> targets;

MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(this, this, radius);
MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(this, targets, u_check);

TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, 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)
Expand Down
3 changes: 2 additions & 1 deletion src/game/Unit.h
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion 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__
2 changes: 1 addition & 1 deletion 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__

0 comments on commit 80531d4

Please sign in to comment.