:: moodletTest[test]
<<set $pc.mood = 48>>

:: moodletWidgets[widget]
<<widget 'mood'>>
	<<set _moodletId = _args[0]>>
	<<set _moodletTimeIncrease = _args[1]>>

	<<if _moodletTimeIncrease > 0>>
		<<run $pc.moodletIncTime(_moodletId,_moodletTimeIncrease)>><!-- Make sure that this moodlet does not detoriate -->
		<<addtime _moodletTimeIncrease>>
	<<else>>
		<<set _moodletTimeIncrease = Math.abs(_moodletTimeIncrease)>>
	<</if>>
	<<run $pc.moodletApplyById(_moodletId,_moodletTimeIncrease)>>
	<<moodDisplay _moodletId>>
<</widget>>
<<widget 'moodDisplay'>>
	<<set _moodletId = _args[0]>>
	<<set _moodletData = setup.Moodlet.get(_moodletId)>>
	<<set _moodletGroupData = setup.MoodletGroup.get(_moodletData.group ?? 'none')>>

	<<set _moodletStyleClass="moodlet">>
	<<if _moodletData.effect == 0>>
		<<set _moodletStyleClass+=" neutral">>
	<<elseif _moodletData.effect < 0>>
		<<set _moodletStyleClass+=" negative">>
	<<else>>
		<<set _moodletStyleClass+=" positive">>
	<</if>>

	<div @class="_moodletStyleClass">
		<span class="effectStrength"><<if _moodletData.effect > 0>>+<</if>>_moodletData.effect</span>
		<span class="title">_moodletData.title</span>
		<span class="description">_moodletData.description</span>
		<span class="symbols">
			<<switch _moodletGroupData.accumulationMode>>
				<<case 1>>
					<<textWithTooltip "🔝">>
						<h3>Top only</h3>
						This mood effect is part of a group where only the strongest positive effect is applied.
						For example, if you watch TV on a bad TV and then on a good TV, only the stronger effect of the good TV is applied (the weak effect might still be in effect after the stronger ended, though).
					<</textWithTooltip>>
				<<case 2>>
					<<textWithTooltip "🔝">>
						<h3>Top only</h3>
						This mood effect is part of a group where only the strongest negative effect is applied.
						For example, being insulted is not taken into account if you are also bullied.
					<</textWithTooltip>>
				<<case 3>>
					<<textWithTooltip "🔼">>
						<h3>Diminishing return on investment</h3>
						This mood effect is part of a group where the strongest effect is taken into full account, while all other effects have reduced effects.
						For example, in the group <i>Candy</i>, eating chocolate gives you the same mood bonus as eating cake. Eating both gives you the bonus of eating chocolate and 50% of the effect of eating cake.
					<</textWithTooltip>>
				<<case 0>>
					<<textWithTooltip "🔃">>
						<h3>Summed up effect</h3>
						This mood effect is part of a group where all effects are summed up.
						This is usually the case for effects which have very little in common with other effects.
					<</textWithTooltip>>
			<</switch>>
			<<switch _moodletData.timeMode>>
				<<case 0>>
					<<textWithTooltip "🔁">>
						<h3>Repeatable</h3>
						This mood effect can be gained multiple times. This will increase the time it is active, up to a maximum number of minutes.
						For example, you can make the effect of watching TV last longer by watching more TV.
					<</textWithTooltip>>
				<<case 1>>
					<<textWithTooltip "🔂">>
						<h3>Resetting</h3>
						When this mood effect is gained, it resets the time it is active.
						For example, the effect of gaining a compliment lasts for 4 hours. If you get another compliment 2 hours after you got the first one, the effect will last for 6 hours (2 of the first and 4 of the second compliment).
					<</textWithTooltip>>
				<<case 2>>
					<<textWithTooltip "🔚">>
						<h3>Lasting</h3>
						This mood effect will last until canceled. Depending on the effect, this might be an interaction with a NPC, sleeping for a specified amount of time, random chance or anything else.
					<</textWithTooltip>>
			<</switch>>
		</span>
	</div>

<</widget>>