Scripts/Spells: Implemented various rogue spells

Port From (https://github.com/TrinityCore/TrinityCore/commit/a3d06f2f329a6d21b9a79aed8b39f1d56fa933e6)
This commit is contained in:
hondacrx
2022-01-07 16:42:42 -05:00
parent 5bb553b0e3
commit cb7438506f
4 changed files with 794 additions and 25 deletions
+5 -1
View File
@@ -1703,16 +1703,20 @@ namespace Game.Entities
public int CalcSpellDuration(SpellInfo spellInfo)
{
int comboPoints = 0;
int maxComboPoints = 5;
Unit unit = ToUnit();
if (unit != null)
{
comboPoints = unit.GetPower(PowerType.ComboPoints);
maxComboPoints = unit.GetMaxPower(PowerType.ComboPoints);
}
int minduration = spellInfo.GetDuration();
int maxduration = spellInfo.GetMaxDuration();
int duration;
if (comboPoints != 0 && minduration != -1 && minduration != maxduration)
duration = minduration + ((maxduration - minduration) * comboPoints / 5);
duration = minduration + ((maxduration - minduration) * comboPoints / maxComboPoints);
else
duration = minduration;
+1 -1
View File
@@ -50,7 +50,7 @@ namespace Game.Scripting
{
if (!Global.SpellMgr.HasSpellInfo(spellId, Difficulty.None))
{
Log.outError(LogFilter.Scripts, "BaseSpellScript.ValidateSpellInfo: Spell {0} does not exist.", spellId);
Log.outError(LogFilter.Scripts, "BaseSpellScript::ValidateSpellInfo: Spell {0} does not exist.", spellId);
allValid = false;
}
}
+11 -2
View File
@@ -6165,7 +6165,7 @@ namespace Game.Spells
if (spellEffectInfo.ItemType != 0)
{
List<ItemPosCount> dest = new();
InventoryResult msg = target.ToPlayer().CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, spellEffectInfo.ItemType, spellEffectInfo.CalcValue());
InventoryResult msg = target.ToPlayer().CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, spellEffectInfo.ItemType, (uint)spellEffectInfo.CalcValue());
if (msg != InventoryResult.Ok)
{
ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(spellEffectInfo.ItemType);
@@ -6591,7 +6591,16 @@ namespace Game.Spells
public bool HasPowerTypeCost(PowerType power)
{
return m_powerCost.Any(cost => cost.Power == power);
return GetPowerTypeCostAmount(power).HasValue;
}
public int? GetPowerTypeCostAmount(PowerType power)
{
var powerCost = m_powerCost.Find(cost => cost.Power == power);
if (powerCost == null)
return null;
return powerCost.Amount;
}
bool UpdatePointers()