aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Unit
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-04-25 22:03:34 +0200
committerShauren <shauren.trinity@gmail.com>2016-05-20 23:49:53 +0200
commit70102f32fe38ae7d49acbd5ddee0239602d3cb94 (patch)
tree22dcecc33942c7f60e2edb5402f6f7feaf559ece /src/server/game/Entities/Unit
parent885d9b53c38662e00e3b4977b82e9cf36d197f94 (diff)
Core/DataStores: Updated opcodes and db2 to 7.0.3.21414
Diffstat (limited to 'src/server/game/Entities/Unit')
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp13
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp27
-rw-r--r--src/server/game/Entities/Unit/Unit.h25
3 files changed, 34 insertions, 31 deletions
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index da04c39c289..ed6b9ec3696 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -20,6 +20,7 @@
#include "Player.h"
#include "Pet.h"
#include "Creature.h"
+#include "GameTables.h"
#include "SharedDefines.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
@@ -265,8 +266,8 @@ float Player::GetHealthBonusFromStamina()
{
// Taken from PaperDollFrame.lua - 6.0.3.19085
float ratio = 10.0f;
- if (GtOCTHpPerStaminaEntry const* hpBase = sGtOCTHpPerStaminaStore.EvaluateTable(getLevel() - 1, 0))
- ratio = hpBase->ratio;
+ if (GtHpPerStaEntry const* hpBase = sHpPerStaGameTable.GetRow(getLevel()))
+ ratio = hpBase->Health;
float stamina = GetStat(STAT_STAMINA);
@@ -512,7 +513,7 @@ void Player::UpdateCritPercentage(WeaponAttackType attType)
void Player::UpdateAllCritPercentages()
{
- float value = GetMeleeCritFromAgility();
+ float value = 5.0f;
SetBaseModValue(CRIT_PERCENTAGE, PCT_MOD, value);
SetBaseModValue(OFFHAND_CRIT_PERCENTAGE, PCT_MOD, value);
@@ -654,9 +655,7 @@ void Player::UpdateSpellCritChance(uint32 school)
return;
}
// For others recalculate it from:
- float crit = 0.0f;
- // Crit from Intellect
- crit += GetSpellCritFromIntellect();
+ float crit = 5.0f;
// Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
crit += GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
// Increase crit from SPELL_AURA_MOD_CRIT_PCT
@@ -754,7 +753,7 @@ void Player::UpdateManaRegen()
return;
// Mana regen from spirit
- float spirit_regen = OCTRegenMPPerSpirit();
+ float spirit_regen = 0.0f;
// Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
spirit_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 2bf8d161798..964572e5f02 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -1430,7 +1430,7 @@ void Unit::HandleEmoteCommand(uint32 anim_id)
SendMessageToSet(packet.Write(), true);
}
-bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo const* spellInfo, uint8 effIndex)
+bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo const* spellInfo /*= nullptr*/, int8 effIndex /*= -1*/)
{
// only physical spells damage gets reduced by armor
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
@@ -1441,13 +1441,16 @@ bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo const* s
if (spellInfo->HasAttribute(SPELL_ATTR0_CU_IGNORE_ARMOR))
return false;
- // bleeding effects are not reduced by armor
- if (SpellEffectInfo const* effect = spellInfo->GetEffect(GetMap()->GetDifficultyID(), effIndex))
+ if (effIndex != -1)
{
- if (effect->ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
- effect->Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
- if (spellInfo->GetEffectMechanicMask(effIndex) & (1<<MECHANIC_BLEED))
- return false;
+ // bleeding effects are not reduced by armor
+ if (SpellEffectInfo const* effect = spellInfo->GetEffect(GetMap()->GetDifficultyID(), effIndex))
+ {
+ if (effect->ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
+ effect->Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
+ if (spellInfo->GetEffectMechanicMask(effIndex) & (1 << MECHANIC_BLEED))
+ return false;
+ }
}
}
return true;
@@ -6733,11 +6736,11 @@ ReputationRank Unit::GetFactionReactionTo(FactionTemplateEntry const* factionTem
}
// common faction based check
- if (factionTemplateEntry->IsHostileTo(*targetFactionTemplateEntry))
+ if (factionTemplateEntry->IsHostileTo(targetFactionTemplateEntry))
return REP_HOSTILE;
- if (factionTemplateEntry->IsFriendlyTo(*targetFactionTemplateEntry))
+ if (factionTemplateEntry->IsFriendlyTo(targetFactionTemplateEntry))
return REP_FRIENDLY;
- if (targetFactionTemplateEntry->IsFriendlyTo(*factionTemplateEntry))
+ if (targetFactionTemplateEntry->IsFriendlyTo(factionTemplateEntry))
return REP_FRIENDLY;
if (factionTemplateEntry->Flags & FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT)
return REP_HOSTILE;
@@ -8952,7 +8955,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
{
if (Player* player = ToPlayer())
{
- float mod = player->GetRatingBonusValue(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN) * (-8.0f);
+ float mod = player->GetRatingBonusValue(CR_RESILIENCE_PLAYER_DAMAGE) * (-8.0f);
AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
}
@@ -15739,7 +15742,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
{
FactionTemplateEntry const* ft1 = GetFactionTemplateEntry();
FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
- if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
+ if (ft1 && ft2 && !ft1->IsFriendlyTo(ft2))
{
if (index == UNIT_FIELD_BYTES_2)
// Allow targetting opposite faction in party when enabled in config
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 5ba84c271be..68b27049f71 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -19,7 +19,6 @@
#ifndef __UNIT_H
#define __UNIT_H
-#include "DBCStructure.h"
#include "EventProcessor.h"
#include "FollowerReference.h"
#include "FollowerRefManager.h"
@@ -381,6 +380,7 @@ enum InventorySlot
};
struct FactionTemplateEntry;
+struct LiquidTypeEntry;
struct MountCapabilityEntry;
struct SpellValue;
@@ -623,8 +623,8 @@ enum WeaponAttackType : uint8
enum CombatRating
{
- CR_UNUSED_1 = 0,
- CR_DEFENSE_SKILL = 1, // Removed in 4.0.1
+ CR_AMPLIFY = 0,
+ CR_DEFENSE_SKILL = 1,
CR_DODGE = 2,
CR_PARRY = 3,
CR_BLOCK = 4,
@@ -638,22 +638,23 @@ enum CombatRating
CR_READINESS = 12,
CR_SPEED = 13,
CR_RESILIENCE_CRIT_TAKEN = 14,
- CR_RESILIENCE_PLAYER_DAMAGE_TAKEN = 15,
+ CR_RESILIENCE_PLAYER_DAMAGE = 15,
CR_LIFESTEAL = 16,
CR_HASTE_MELEE = 17,
CR_HASTE_RANGED = 18,
CR_HASTE_SPELL = 19,
CR_AVOIDANCE = 20,
- CR_UNUSED_2 = 21,
- CR_WEAPON_SKILL_RANGED = 22,
+ CR_STURDINESS = 21,
+ CR_UNUSED_7 = 22,
CR_EXPERTISE = 23,
CR_ARMOR_PENETRATION = 24,
CR_MASTERY = 25,
- CR_UNUSED_3 = 26,
- CR_UNUSED_4 = 27,
+ CR_PVP_POWER = 26,
+ CR_CLEAVE = 27,
CR_VERSATILITY_DAMAGE_DONE = 28,
- // placeholder = 29,
- CR_VERSATILITY_DAMAGE_TAKEN = 30
+ CR_VERSATILITY_HEALING_DONE = 29,
+ CR_VERSATILITY_DAMAGE_TAKEN = 30,
+ CR_UNUSED_12 = 31
};
#define MAX_COMBAT_RATING 31
@@ -1539,7 +1540,7 @@ class TC_GAME_API Unit : public WorldObject
void DealSpellDamage(SpellNonMeleeDamage const* damageInfo, bool durabilityLoss);
// player or player's pet resilience (-1%)
- uint32 GetDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN, 1.0f, 100.0f, damage); }
+ uint32 GetDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_RESILIENCE_PLAYER_DAMAGE, 1.0f, 100.0f, damage); }
void ApplyResilience(Unit const* victim, int32* damage) const;
@@ -2079,7 +2080,7 @@ class TC_GAME_API Unit : public WorldObject
bool IsImmunedToDamage(SpellInfo const* spellInfo) const;
virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // redefined in Creature
- bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS);
+ bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = nullptr, int8 effIndex = -1);
uint32 CalcArmorReducedDamage(Unit* attacker, Unit* victim, const uint32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType = MAX_ATTACK);
uint32 CalcSpellResistance(Unit* victim, SpellSchoolMask schoolMask, SpellInfo const* spellInfo) const;
void CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32* absorb, uint32* resist, SpellInfo const* spellInfo = NULL);