Core/Player: Implemented Titan's Grip damage reduction
This commit is contained in:
1 parent
b18477f80f
commit
d9ae70396b
3 files changed
+59
-3
No files matched your search
@@ -412,6 +412,7 @@ Player::Player(WorldSession* session): Unit(true)
|
||||
m_canParry = false;
|
||||
m_canBlock = false;
|
||||
m_canTitanGrip = false;
|
||||
m_titanGripPenaltySpellId = 0;
|
||||
|
||||
m_temporaryUnsummonedPetNumber = 0;
|
||||
//cache for UNIT_CREATED_BY_SPELL to allow
|
||||
@@ -11942,6 +11943,9 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
|
||||
return pItem2;
|
||||
}
|
||||
|
||||
if (slot == EQUIPMENT_SLOT_MAINHAND || slot == EQUIPMENT_SLOT_OFFHAND)
|
||||
CheckTitanGripPenalty();
|
||||
|
||||
// only for full equip instead adding to stack
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
|
||||
@@ -11965,6 +11969,9 @@ void Player::QuickEquipItem(uint16 pos, Item* pItem)
|
||||
pItem->SendUpdateToPlayer(this);
|
||||
}
|
||||
|
||||
if (slot == EQUIPMENT_SLOT_MAINHAND || slot == EQUIPMENT_SLOT_OFFHAND)
|
||||
CheckTitanGripPenalty();
|
||||
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
|
||||
}
|
||||
@@ -12085,7 +12092,11 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
|
||||
SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty);
|
||||
|
||||
if (slot < EQUIPMENT_SLOT_END)
|
||||
{
|
||||
SetVisibleItemSlot(slot, nullptr);
|
||||
if (slot == EQUIPMENT_SLOT_MAINHAND || slot == EQUIPMENT_SLOT_OFFHAND)
|
||||
CheckTitanGripPenalty();
|
||||
}
|
||||
}
|
||||
else if (Bag* pBag = GetBagByPos(bag))
|
||||
pBag->RemoveItem(slot, update);
|
||||
@@ -13125,12 +13136,54 @@ bool Player::IsUseEquipedWeapon(bool mainhand) const
|
||||
return !IsInFeralForm() && (!mainhand || !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED));
|
||||
}
|
||||
|
||||
void Player::SetCanTitanGrip(bool value, uint32 penaltySpellId /*= 0*/)
|
||||
{
|
||||
if (value == m_canTitanGrip)
|
||||
return;
|
||||
|
||||
if (!value)
|
||||
CheckTitanGripPenalty();
|
||||
|
||||
m_canTitanGrip = value;
|
||||
m_titanGripPenaltySpellId = penaltySpellId;
|
||||
}
|
||||
|
||||
void Player::CheckTitanGripPenalty()
|
||||
{
|
||||
if (!CanTitanGrip())
|
||||
return;
|
||||
|
||||
bool apply = IsUsingTwoHandedWeaponInOneHand();
|
||||
if (apply)
|
||||
{
|
||||
if (!HasAura(m_titanGripPenaltySpellId))
|
||||
CastSpell((Unit*)nullptr, m_titanGripPenaltySpellId, true);
|
||||
}
|
||||
else
|
||||
RemoveAurasDueToSpell(m_titanGripPenaltySpellId);
|
||||
}
|
||||
|
||||
bool Player::IsTwoHandUsed() const
|
||||
{
|
||||
Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
return mainItem && mainItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
|
||||
}
|
||||
|
||||
bool Player::IsUsingTwoHandedWeaponInOneHand() const
|
||||
{
|
||||
Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
|
||||
if (!mainItem || !offItem)
|
||||
return false;
|
||||
|
||||
if (mainItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON &&
|
||||
offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Player::TradeCancel(bool sendback)
|
||||
{
|
||||
if (m_trade)
|
||||
|
||||
@@ -1466,6 +1466,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
uint32 GetArmorProficiency() const { return m_ArmorProficiency; }
|
||||
bool IsUseEquipedWeapon(bool mainhand) const;
|
||||
bool IsTwoHandUsed() const;
|
||||
bool IsUsingTwoHandedWeaponInOneHand() const;
|
||||
void SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast = false);
|
||||
bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
|
||||
bool BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot, uint32 currency, uint32 count);
|
||||
@@ -2152,7 +2153,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
bool CanBlock() const { return m_canBlock; }
|
||||
void SetCanBlock(bool value);
|
||||
bool CanTitanGrip() const { return m_canTitanGrip; }
|
||||
void SetCanTitanGrip(bool value) { m_canTitanGrip = value; }
|
||||
void SetCanTitanGrip(bool value, uint32 penaltySpellId = 0);
|
||||
void CheckTitanGripPenalty();
|
||||
bool CanTameExoticPets() const { return IsGameMaster() || HasAuraType(SPELL_AURA_ALLOW_TAME_PET_TYPE); }
|
||||
|
||||
void SetRegularAttackTime();
|
||||
@@ -2746,6 +2748,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
bool m_canParry;
|
||||
bool m_canBlock;
|
||||
bool m_canTitanGrip;
|
||||
uint32 m_titanGripPenaltySpellId;
|
||||
uint8 m_swingErrorMsg;
|
||||
|
||||
////////////////////Rest System/////////////////////
|
||||
|
||||
@@ -5274,13 +5274,13 @@ void Spell::EffectDiscoverTaxi(SpellEffIndex effIndex)
|
||||
unitTarget->ToPlayer()->GetSession()->SendDiscoverNewTaxiNode(nodeid);
|
||||
}
|
||||
|
||||
void Spell::EffectTitanGrip(SpellEffIndex /*effIndex*/)
|
||||
void Spell::EffectTitanGrip(SpellEffIndex effIndex)
|
||||
{
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
m_caster->ToPlayer()->SetCanTitanGrip(true);
|
||||
m_caster->ToPlayer()->SetCanTitanGrip(true, m_spellInfo->Effects[effIndex].MiscValue);
|
||||
}
|
||||
|
||||
void Spell::EffectRedirectThreat(SpellEffIndex /*effIndex*/)
|
||||
|
||||
Reference in new issue
Block a user