mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-18 22:09:40 -04:00
*Allow pet to have combo points.
--HG-- branch : trunk
This commit is contained in:
+9
-1
@@ -463,6 +463,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
|
||||
//m_unit_movement_flags = 0;
|
||||
|
||||
m_mover = this;
|
||||
m_movedPlayer = this;
|
||||
m_seer = this;
|
||||
|
||||
m_contestedPvPTimer = 0;
|
||||
@@ -19172,7 +19173,14 @@ void Player::SendComboPoints()
|
||||
Unit *combotarget = ObjectAccessor::GetUnit(*this, m_comboTarget);
|
||||
if (combotarget)
|
||||
{
|
||||
WorldPacket data(SMSG_UPDATE_COMBO_POINTS, combotarget->GetPackGUID().size()+1);
|
||||
WorldPacket data;
|
||||
if(m_mover != this)
|
||||
{
|
||||
data.Initialize(SMSG_PET_UPDATE_COMBO_POINTS, m_mover->GetPackGUID().size()+combotarget->GetPackGUID().size()+1);
|
||||
data.append(m_mover->GetPackGUID());
|
||||
}
|
||||
else
|
||||
data.Initialize(SMSG_UPDATE_COMBO_POINTS, combotarget->GetPackGUID().size()+1);
|
||||
data.append(combotarget->GetPackGUID());
|
||||
data << uint8(m_comboPoints);
|
||||
GetSession()->SendPacket(&data);
|
||||
|
||||
+6
-1
@@ -2062,7 +2062,12 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||
|
||||
void SetClientControl(Unit* target, uint8 allowMove);
|
||||
|
||||
void SetMover(Unit* target) { m_mover = target; }
|
||||
void SetMover(Unit* target)
|
||||
{
|
||||
m_mover->m_movedPlayer = NULL;
|
||||
m_mover = target;
|
||||
m_mover->m_movedPlayer = this;
|
||||
}
|
||||
void SetSeer(WorldObject *target) { m_seer = target; }
|
||||
void SetViewpoint(WorldObject *target, bool apply);
|
||||
WorldObject* GetViewpoint() const;
|
||||
|
||||
+10
-7
@@ -2675,7 +2675,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
|
||||
prepareDataForTriggerSystem(triggeredByAura);
|
||||
|
||||
// Set combo point requirement
|
||||
if (m_IsTriggeredSpell || m_CastItem || m_caster->GetTypeId()!=TYPEID_PLAYER)
|
||||
if (m_IsTriggeredSpell || m_CastItem || !m_caster->m_movedPlayer)
|
||||
m_needComboPoints = false;
|
||||
|
||||
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
|
||||
@@ -3173,13 +3173,16 @@ void Spell::_handle_immediate_phase()
|
||||
|
||||
void Spell::_handle_finish_phase()
|
||||
{
|
||||
// Take for real after all targets are processed
|
||||
if (m_needComboPoints)
|
||||
((Player*)m_caster)->ClearComboPoints();
|
||||
if(m_caster->m_movedPlayer)
|
||||
{
|
||||
// Take for real after all targets are processed
|
||||
if (m_needComboPoints)
|
||||
m_caster->m_movedPlayer->ClearComboPoints();
|
||||
|
||||
// Real add combo points from effects
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||
((Player*)m_caster)->GainSpellComboPoints(m_comboPointGain);
|
||||
// Real add combo points from effects
|
||||
if (m_comboPointGain)
|
||||
m_caster->m_movedPlayer->GainSpellComboPoints(m_comboPointGain);
|
||||
}
|
||||
|
||||
// spell log
|
||||
if(m_needSpellLog)
|
||||
|
||||
@@ -5524,7 +5524,7 @@ void AuraEffect::HandleAuraAllowFlight(bool apply, bool Real, bool /*changeAmoun
|
||||
if(m_target->GetTypeId() == TYPEID_UNIT)
|
||||
m_target->SetFlying(apply);
|
||||
|
||||
if(Player *plr = m_target->GetMoverSource())
|
||||
if(Player *plr = m_target->m_movedPlayer)
|
||||
{
|
||||
// allow fly
|
||||
WorldPacket data;
|
||||
|
||||
@@ -5737,13 +5737,13 @@ void Spell::EffectAddComboPoints(uint32 /*i*/)
|
||||
if(!unitTarget)
|
||||
return;
|
||||
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if(!m_caster->m_movedPlayer)
|
||||
return;
|
||||
|
||||
if(damage <= 0)
|
||||
return;
|
||||
|
||||
((Player*)m_caster)->AddComboPoints(unitTarget, damage, this);
|
||||
m_caster->m_movedPlayer->AddComboPoints(unitTarget, damage, this);
|
||||
}
|
||||
|
||||
void Spell::EffectDuel(uint32 i)
|
||||
|
||||
+10
-11
@@ -94,6 +94,7 @@ Unit::Unit()
|
||||
, m_NotifyListPos(-1), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false)
|
||||
, i_AI(NULL), i_disabledAI(NULL), m_removedAurasCount(0), m_vehicle(NULL), m_transport(NULL)
|
||||
, m_ControlledByPlayer(false), m_procDeep(0), m_unitTypeMask(UNIT_MASK_NONE), m_vehicleKit(NULL)
|
||||
, m_movedPlayer(NULL)
|
||||
{
|
||||
m_objectType |= TYPEMASK_UNIT;
|
||||
m_objectTypeId = TYPEID_UNIT;
|
||||
@@ -8921,6 +8922,7 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
|
||||
return nearMembers[randTarget];
|
||||
}
|
||||
|
||||
/*
|
||||
Player * Unit::GetMoverSource() const
|
||||
{
|
||||
if(GetTypeId() == TYPEID_PLAYER && ((Player*)this)->m_mover == this)
|
||||
@@ -8930,6 +8932,7 @@ Player * Unit::GetMoverSource() const
|
||||
return (Player*)charmer;
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
//only called in Player::SetSeer
|
||||
void Unit::AddPlayerToVision(Player* plr)
|
||||
@@ -11340,10 +11343,6 @@ Unit* Creature::SelectVictim()
|
||||
|
||||
int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 effBasePoints, Unit const* /*target*/)
|
||||
{
|
||||
Player* unitPlayer = (GetTypeId() == TYPEID_PLAYER) ? (Player*)this : NULL;
|
||||
|
||||
uint8 comboPoints = unitPlayer ? unitPlayer->GetComboPoints() : 0;
|
||||
|
||||
int32 level = int32(getLevel());
|
||||
if (level > (int32)spellProto->maxLevel && spellProto->maxLevel > 0)
|
||||
level = (int32)spellProto->maxLevel;
|
||||
@@ -11355,7 +11354,6 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde
|
||||
float randomPointsPerLevel = spellProto->EffectDicePerLevel[effect_index];
|
||||
int32 basePoints = int32(effBasePoints + level * basePointsPerLevel);
|
||||
int32 randomPoints = int32(spellProto->EffectDieSides[effect_index] + level * randomPointsPerLevel);
|
||||
float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index];
|
||||
|
||||
// range can have possitive and negative values, so order its for irand
|
||||
int32 randvalue = int32(spellProto->EffectBaseDice[effect_index]) >= randomPoints
|
||||
@@ -11364,8 +11362,11 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde
|
||||
|
||||
int32 value = basePoints + randvalue;
|
||||
//random damage
|
||||
if(comboDamage != 0 && unitPlayer /*&& target && (target->GetGUID() == unitPlayer->GetComboTarget())*/)
|
||||
value += (int32)(comboDamage * comboPoints);
|
||||
//if(comboDamage != 0 && unitPlayer /*&& target && (target->GetGUID() == unitPlayer->GetComboTarget())*/)
|
||||
if(m_movedPlayer)
|
||||
if(uint8 comboPoints = m_movedPlayer->GetComboPoints())
|
||||
if(float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index])
|
||||
value += (int32)(comboDamage * comboPoints);
|
||||
|
||||
if(Player* modOwner = GetSpellModOwner())
|
||||
{
|
||||
@@ -11400,16 +11401,14 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde
|
||||
|
||||
int32 Unit::CalcSpellDuration(SpellEntry const* spellProto)
|
||||
{
|
||||
Player* unitPlayer = (GetTypeId() == TYPEID_PLAYER) ? (Player*)this : NULL;
|
||||
|
||||
uint8 comboPoints = unitPlayer ? unitPlayer->GetComboPoints() : 0;
|
||||
uint8 comboPoints = m_movedPlayer ? m_movedPlayer->GetComboPoints() : 0;
|
||||
|
||||
int32 minduration = GetSpellDuration(spellProto);
|
||||
int32 maxduration = GetSpellMaxDuration(spellProto);
|
||||
|
||||
int32 duration;
|
||||
|
||||
if( minduration != -1 && minduration != maxduration )
|
||||
if(comboPoints && minduration != -1 && minduration != maxduration)
|
||||
duration = minduration + int32((maxduration - minduration) * comboPoints / 5);
|
||||
else
|
||||
duration = minduration;
|
||||
|
||||
+2
-1
@@ -1458,7 +1458,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
CharmInfo* InitCharmInfo();
|
||||
void DeleteCharmInfo();
|
||||
void UpdateCharmAI();
|
||||
Player * GetMoverSource() const;
|
||||
//Player * GetMoverSource() const;
|
||||
Player *m_movedPlayer;
|
||||
SharedVisionList const& GetSharedVisionList() { return m_sharedVision; }
|
||||
void AddPlayerToVision(Player* plr);
|
||||
void RemovePlayerFromVision(Player* plr);
|
||||
|
||||
@@ -140,7 +140,9 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
|
||||
TeamId teamId = x > POS_X_CENTER ? m_defender : OTHER_TEAM(m_defender);
|
||||
m_buildingStates[guid] = new BuildingState((*poi)->worldState, teamId, m_defender != TEAM_ALLIANCE);
|
||||
if((*poi)->id == 2246)
|
||||
{
|
||||
m_gate = m_buildingStates[guid];
|
||||
}
|
||||
areaPOIs.erase(poi);
|
||||
|
||||
//disable for now
|
||||
@@ -229,6 +231,12 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
|
||||
}while(result->NextRow());
|
||||
delete result;
|
||||
|
||||
if(!m_gate)
|
||||
{
|
||||
sLog.outError("Cannot find wintergrasp fortress gate!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load Graveyard
|
||||
GraveYardMap::const_iterator graveLow = objmgr.mGraveYardMap.lower_bound(ZONE_WINTERGRASP);
|
||||
GraveYardMap::const_iterator graveUp = objmgr.mGraveYardMap.upper_bound(ZONE_WINTERGRASP);
|
||||
@@ -286,7 +294,7 @@ void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId)
|
||||
{
|
||||
if(eventId == 19982)
|
||||
{
|
||||
if(m_wartime && m_gate->damageState == DAMAGE_DESTROYED)
|
||||
if(m_wartime && m_gate && m_gate->damageState == DAMAGE_DESTROYED)
|
||||
{
|
||||
m_changeDefender = true;
|
||||
m_timer = 0;
|
||||
|
||||
Reference in New Issue
Block a user