<commit_before>--ds_059_rote_flasche
--Druidensystem in Arbeit
--Falk
--Delay added by Blay09
--rework by Merung

require("base.common")
require("alchemy.base.alchemy")

module("alchemy.item.id_59_red_bottle",package.seeall)

-- UPDATE common SET com_script='alchemy.item.id_59_red_bottle' WHERE com_itemid = 59;

taste = {}
attribList   ={"strength","intelligence","dexterity"       ,"perception"  ,"constitution","essence","agility"      ,"willpower"}
attribListDe ={"Strke"  ,"Intelligenz" ,"Geschicklichkeit","Wahrnehmung" ,"Ausdauer"    ,"Essenz" ,"Schnelligkeit","Willenskraft"}
taste[0]     ={"fruchtig","herb"        ,"bitter"          ,"faulig"      ,"sauer"       ,"salzig" ,"scharf"       ,"s"}
taste[1]     ={"fruity"  ,"tartly"      ,"bitter"          ,"putrefactive","acidly"      ,"salt"   ,"hot"          ,"sweet"}

intensityListDe = {"stark"   ,"merkbar"  ,"leicht"  ,"kaum merklich"   ,"","kaum merklich"   ,"leicht"  ,"merkbar"  ,"stark"}
intensityListEn = {"strongly","noticably","slightly","barely noticably","","barely noticable","slightly","noticably","strongly"}

function DrinkPotion(User,SourceItem)
    local potionEffectId = tonumber(SourceItem:getData("potionEffectId"))
	
	if potionEffectId == 0 or potionEffectId == nil  then -- no effect	
	    base.common.InformNLS(User, "Du hast nicht das Gefhl, dass etwas passiert.", 
		"You don't have the feeling that something happens.")
	    return
	
	elseif potionEffectId >= 11111111 and potionEffectId <= 99999999 then -- it's an attribute changer  
		  -- there is already an effect, we remove it
		local foundEffect, myEffect = User.effects:find(59);
		if foundEffect then
			local effectRemoved = User.effects:removeEffect(59)
		    base.common.InformNLS(User, "Du sprst, dass der alte Strkungstrank seine Wirkung verliert und wie der neue zu wirken einsetzt.", 
		    "You feel that the old strengthening potion looses its effect and how the new one takes effect.")
		end
		local myEffectDuration = math.floor(SourceItem.quality/100)*600*4 -- quality 1 = 4 minutes duration, quality 9 = 36 minutes duration
		local myEffect=LongTimeEffect(59,myEffectDuration) -- new effect
		
		local dataZList = alchemy.base.alchemy.SplitData(User,potionEffectId)
		alchemy.base.alchemy.generateTasteMessage(User,dataZList) -- potion taste
	    GenerateEffectMessage(User,dataZList) -- inform about the effects
		
		local attribValue, bottomBorder
		local logmsg = ""..User.name.." ("..User.id..") used an attribute potion, giving: "
		for i=1,8 do
			
			attribValue = User:increaseAttrib(attribList[i],0);

			bottomBorder = 1
			
			if (attribValue + dataZList[i] - 5) < bottomBorder then
				dataZList[i] = (bottomBorder - attribValue) + 5;
			end

			if dataZList[i] ~= 5 then
				User:increaseAttrib(attribList[i],dataZList[i]-5);
				local emptystring = " ";
				if(dataZList[i]-5>0) then
					emptystring = " +";
				end
				logmsg = logmsg..emptystring..(dataZList[i]-5).."to "..attribList[i]..", and"
				myEffect:addValue(""..attribList[i],dataZList[i]);
			end
			
		end<commit_msg>Tweak<commit_after>--ds_059_rote_flasche
--Druidensystem in Arbeit
--Falk
--Delay added by Blay09
--rework by Merung

require("base.common")
require("alchemy.base.alchemy")

module("alchemy.item.id_59_red_bottle",package.seeall)

-- UPDATE common SET com_script='alchemy.item.id_59_red_bottle' WHERE com_itemid = 59;

taste = {}
attribList   ={"strength","intelligence","dexterity"       ,"perception"  ,"constitution","essence","agility"      ,"willpower"}
attribListDe ={"Strke"  ,"Intelligenz" ,"Geschicklichkeit","Wahrnehmung" ,"Ausdauer"    ,"Essenz" ,"Schnelligkeit","Willenskraft"}
taste[0]     ={"fruchtig","herb"        ,"bitter"          ,"faulig"      ,"sauer"       ,"salzig" ,"scharf"       ,"s"}
taste[1]     ={"fruity"  ,"tartly"      ,"bitter"          ,"putrefactive","acidly"      ,"salt"   ,"hot"          ,"sweet"}

intensityListDe = {"stark"   ,"merkbar"  ,"leicht"  ,"kaum merklich"   ,"","kaum merklich"   ,"leicht"  ,"merkbar"  ,"stark"}
intensityListEn = {"strongly","noticably","slightly","barely noticably","","barely noticable","slightly","noticably","strongly"}

function DrinkPotion(User,SourceItem)
    local potionEffectId = tonumber(SourceItem:getData("potionEffectId"))
	
	if potionEffectId == 0 or potionEffectId == nil  then -- no effect	
	    base.common.InformNLS(User, "Du hast nicht das Gefhl, dass etwas passiert.", 
		"You don't have the feeling that something happens.")
	    return
	
	elseif potionEffectId >= 11111111 and potionEffectId <= 99999999 then -- it's an attribute changer  
		  -- there is already an effect, we remove it
		local foundEffect, myEffect = User.effects:find(59);
		if foundEffect then
			local effectRemoved = User.effects:removeEffect(59)
		    base.common.InformNLS(User, "Du sprst, dass der alte Strkungstrank seine Wirkung verliert und wie der neue zu wirken einsetzt.", 
		    "You feel that the old strengthening potion looses its effect and how the new one takes effect.")
		end
		local myEffectDuration = math.floor(SourceItem.quality/100)*600*4 -- quality 1 = 4 minutes duration, quality 9 = 36 minutes duration
		local myEffect=LongTimeEffect(59,myEffectDuration) -- new effect
		
		local dataZList = alchemy.base.alchemy.SplitData(User,potionEffectId)
		alchemy.base.alchemy.generateTasteMessage(User,dataZList) -- potion taste
	    GenerateEffectMessage(User,dataZList) -- inform about the effects
		
		local attribValue, bottomBorder
		local logmsg = ""..User.name.." ("..User.id..") used an attribute potion, giving: "
		for i=1,8 do
			
			attribValue = User:increaseAttrib(attribList[i],0);

			bottomBorder = 1
			
			if (attribValue + dataZList[i] - 5) < bottomBorder then
				dataZList[i] = (bottomBorder - attribValue) + 5;
			end

			if dataZList[i] ~= 5 then
				User:increaseAttrib(attribList[i],dataZList[i]-5);
				local emptystring = " ";
				if(dataZList[i]-5>0) then
					emptystring = " +";
				end
				logmsg = logmsg..emptystring..(dataZList[i]-5).." to "..attribList[i]..", and"
				myEffect:addValue(""..attribList[i],dataZList[i]);
			end
			
		end
{'fraction_non_alphanumeric': 0.14007527409589265, 'fraction_numerical': 0.019309441989854362, 'mean_word_length': 4.001636661211129, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2264165', 'n_tokens_mistral': 2358, 'n_tokens_neox': 2059, 'n_words': 476}