Advertisement
Guest User

Arcanum ManaBarrel fix

a guest
Nov 20th, 2023
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | Source Code | 0 0
  1. override bool Used(Actor user)
  2. {  
  3.     if (Distance3D(user) > radius + user.radius * 2)
  4.     {
  5.         return false;
  6.     }
  7.  
  8.     if (ManaLeft == 0)
  9.     {
  10.         user.A_Log("This barrel is empty.", true);
  11.         return false;
  12.     }
  13.     //if (!(user.player.ReadyWeapon is 'HDHealingBottler' ||self.countinv('HDHealingPotion') >> 0))
  14.     let potion = HDWeapon(user.FindInventory('HDHealingPotion'));
  15.     if (!potion)
  16.     {
  17.         return false;
  18.     }
  19.     if (!(user.player.ReadyWeapon is 'HDHealingPotion'))
  20.     {
  21.         double maxSipFac = HDPlayerPawn(user) && HDPlayerPawn(user).incapacitated > 0 ? 0.9 : 0.8;
  22.         if (ManaLeft >= TotalMana * maxSipFac)
  23.         {
  24.             user.A_GiveInventory('HealingMagic', HDHM_MOUTH);
  25.             user.A_Log("You take a sip.", true);
  26.             user.A_StartSound("potion/chug", 15);
  27.             ManaLeft--;
  28.         }
  29.         else
  30.         {
  31.             user.A_Log("You can't reach anything.", true);
  32.         }
  33.         return false;
  34.     }
  35.     else if (potion.weaponstatus[HDHM_AMOUNT] < HDHM_BOTTLE)
  36.     {
  37.         int toFill = min(ManaLeft, HDHM_BOTTLE - potion.weaponstatus[HDHM_AMOUNT]);
  38.        
  39.         potion.weaponstatus[HDHM_AMOUNT] += toFill;
  40.         ManaLeft -= toFill;
  41.  
  42.         double potsLeft = ManaLeft / double(HDHM_BOTTLE);
  43.         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.";
  44.         user.A_Log("You filled a potion."..extra, true);
  45.         user.A_StartSound("potion/swish", 15);
  46.     }
  47.  
  48.     return false;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement