Move health potion implementation to a power

This commit is contained in:
Crypto137 2023-01-13 10:14:03 +03:00
parent 1babc5cfd4
commit e65446a734
2 changed files with 25 additions and 2 deletions

View File

@ -927,8 +927,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem
if (player.Attributes[GameAttribute.Hitpoints_Cur] == player.Attributes[GameAttribute.Hitpoints_Max])
return;
player.AddPercentageHP(60);
player.World.BuffManager.AddBuff(this, player, new PowerSystem.Implementations.CooldownBuff(30211, TickTimer.WaitSeconds(player.World.Game, 30f)));
player.World.PowerManager.RunPower(player, 30211);
if (this.Attributes[GameAttribute.ItemStackQuantityLo] <= 1)
player.Inventory.DestroyInventoryItem(this); // No more potions!

View File

@ -0,0 +1,24 @@
//Blizzless Project 2022
using System.Collections.Generic;
using DiIiS_NA.GameServer.GSSystem.PlayerSystem;
using DiIiS_NA.GameServer.GSSystem.TickerSystem;
namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations.General
{
//30211 class DrinkHealthPotion
[ImplementsPowerSNO(30211)]
public class DrinkHealthPotion : PowerScript
{
public override IEnumerable<TickTimer> Run()
{
if (User is Player)
{
Player player = (Player)User;
player.AddPercentageHP(60);
AddBuff(player, player, new CooldownBuff(30211, TickTimer.WaitSeconds(player.World.Game, 30f)));
}
yield break;
}
}
}