Core/Scripts: fix Nightfall proc chance and reduce it for victims with level above 60. (#3304)
* Core/Scripts: fix Nightfall proc chance and reduce it for victims with level above 60 Adding a TrinityCore commit https://github.com/TrinityCore/TrinityCore/commit/eac9c1f0b992fd3622fd7dd864b2acc2781ec778 * Update rev_1597581112860069800.sql * Update rev_1597581112860069800.sql Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com> Co-authored-by: Stefano Borzì <stefanoborzi32@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1597581112860069800');
|
||||||
|
|
||||||
|
-- Nightfall
|
||||||
|
UPDATE `item_template` SET `spellppmRate_1`=2.5, `ScriptName`='item_generic_limit_chance_above_60' WHERE `entry`=19169;
|
||||||
|
|
||||||
@@ -8564,7 +8564,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
|
|||||||
chance = GetWeaponProcChance();
|
chance = GetWeaponProcChance();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roll_chance_f(chance))
|
if (roll_chance_f(chance) && sScriptMgr->OnCastItemCombatSpell(this, target, spellInfo, item))
|
||||||
CastSpell(target, spellInfo->Id, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD), item);
|
CastSpell(target, spellInfo->Id, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD), item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -722,6 +722,17 @@ bool ScriptMgr::OnItemRemove(Player * player, Item * item)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScriptMgr::OnCastItemCombatSpell(Player* player, Unit* victim, SpellInfo const* spellInfo, Item* item)
|
||||||
|
{
|
||||||
|
ASSERT(player);
|
||||||
|
ASSERT(victim);
|
||||||
|
ASSERT(spellInfo);
|
||||||
|
ASSERT(item);
|
||||||
|
|
||||||
|
GET_SCRIPT_RET(ItemScript, item->GetScriptId(), tmpscript, true);
|
||||||
|
return tmpscript->OnCastItemCombatSpell(player, victim, spellInfo, item);
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptMgr::OnGossipSelect(Player* player, Item* item, uint32 sender, uint32 action)
|
void ScriptMgr::OnGossipSelect(Player* player, Item* item, uint32 sender, uint32 action)
|
||||||
{
|
{
|
||||||
ASSERT(player);
|
ASSERT(player);
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class Quest;
|
|||||||
class ScriptMgr;
|
class ScriptMgr;
|
||||||
class Spell;
|
class Spell;
|
||||||
class SpellScript;
|
class SpellScript;
|
||||||
|
class SpellInfo;
|
||||||
class SpellCastTargets;
|
class SpellCastTargets;
|
||||||
class Transport;
|
class Transport;
|
||||||
class StaticTransport;
|
class StaticTransport;
|
||||||
@@ -425,6 +426,9 @@ class ItemScript : public ScriptObject
|
|||||||
// Called when the item is destroyed.
|
// Called when the item is destroyed.
|
||||||
virtual bool OnRemove(Player* /*player*/, Item* /*item*/) { return false; }
|
virtual bool OnRemove(Player* /*player*/, Item* /*item*/) { return false; }
|
||||||
|
|
||||||
|
// Called before casting a combat spell from this item (chance on hit spells of item template, can be used to prevent cast if returning false)
|
||||||
|
virtual bool OnCastItemCombatSpell(Player* /*player*/, Unit* /*victim*/, SpellInfo const* /*spellInfo*/, Item* /*item*/) { return true; }
|
||||||
|
|
||||||
// Called when the item expires (is destroyed).
|
// Called when the item expires (is destroyed).
|
||||||
virtual bool OnExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return false; }
|
virtual bool OnExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return false; }
|
||||||
|
|
||||||
@@ -1304,6 +1308,7 @@ class ScriptMgr
|
|||||||
bool OnItemUse(Player* player, Item* item, SpellCastTargets const& targets);
|
bool OnItemUse(Player* player, Item* item, SpellCastTargets const& targets);
|
||||||
bool OnItemExpire(Player* player, ItemTemplate const* proto);
|
bool OnItemExpire(Player* player, ItemTemplate const* proto);
|
||||||
bool OnItemRemove(Player* player, Item* item);
|
bool OnItemRemove(Player* player, Item* item);
|
||||||
|
bool OnCastItemCombatSpell(Player* player, Unit* victim, SpellInfo const* spellInfo, Item* item);
|
||||||
void OnGossipSelect(Player* player, Item* item, uint32 sender, uint32 action);
|
void OnGossipSelect(Player* player, Item* item, uint32 sender, uint32 action);
|
||||||
void OnGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code);
|
void OnGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code);
|
||||||
|
|
||||||
|
|||||||
@@ -234,6 +234,30 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Only used currently for
|
||||||
|
// 19169: Nightfall
|
||||||
|
class item_generic_limit_chance_above_60 : public ItemScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
item_generic_limit_chance_above_60() : ItemScript("item_generic_limit_chance_above_60") { }
|
||||||
|
|
||||||
|
bool OnCastItemCombatSpell(Player* /*player*/, Unit* victim, SpellInfo const* /*spellInfo*/, Item* /*item*/) override
|
||||||
|
{
|
||||||
|
// spell proc chance gets severely reduced on victims > 60 (formula unknown)
|
||||||
|
if (victim->getLevel() > 60)
|
||||||
|
{
|
||||||
|
// gives ~0.1% proc chance at lvl 70
|
||||||
|
float const lvlPenaltyFactor = 9.93f;
|
||||||
|
float const failureChance = (victim->getLevel() - 60) * lvlPenaltyFactor;
|
||||||
|
|
||||||
|
// base ppm chance was already rolled, only roll success chance
|
||||||
|
return !roll_chance_f(failureChance);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void AddSC_item_scripts()
|
void AddSC_item_scripts()
|
||||||
{
|
{
|
||||||
new item_only_for_flight();
|
new item_only_for_flight();
|
||||||
@@ -244,4 +268,5 @@ void AddSC_item_scripts()
|
|||||||
new item_disgusting_jar();
|
new item_disgusting_jar();
|
||||||
new item_petrov_cluster_bombs();
|
new item_petrov_cluster_bombs();
|
||||||
new item_captured_frog();
|
new item_captured_frog();
|
||||||
|
new item_generic_limit_chance_above_60();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user