Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override bool Used(Actor user)
- {
- if (Distance3D(user) > radius + user.radius * 2)
- {
- return false;
- }
- if (ManaLeft == 0)
- {
- user.A_Log("This barrel is empty.", true);
- return false;
- }
- //if (!(user.player.ReadyWeapon is 'HDHealingBottler' ||self.countinv('HDHealingPotion') >> 0))
- let potion = HDWeapon(user.FindInventory('HDHealingPotion'));
- if (!potion)
- {
- return false;
- }
- if (!(user.player.ReadyWeapon is 'HDHealingPotion'))
- {
- double maxSipFac = HDPlayerPawn(user) && HDPlayerPawn(user).incapacitated > 0 ? 0.9 : 0.8;
- if (ManaLeft >= TotalMana * maxSipFac)
- {
- user.A_GiveInventory('HealingMagic', HDHM_MOUTH);
- user.A_Log("You take a sip.", true);
- user.A_StartSound("potion/chug", 15);
- ManaLeft--;
- }
- else
- {
- user.A_Log("You can't reach anything.", true);
- }
- return false;
- }
- else if (potion.weaponstatus[HDHM_AMOUNT] < HDHM_BOTTLE)
- {
- int toFill = min(ManaLeft, HDHM_BOTTLE - potion.weaponstatus[HDHM_AMOUNT]);
- potion.weaponstatus[HDHM_AMOUNT] += toFill;
- ManaLeft -= toFill;
- double potsLeft = ManaLeft / double(HDHM_BOTTLE);
- string extra = potsLeft > 0 ? String.Format(" There is still enough mana to fill \c[LightBlue]%.1f\c- bottles.", potsLeft) : " That was the last of the mana.";
- user.A_Log("You filled a potion."..extra, true);
- user.A_StartSound("potion/swish", 15);
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement