[indent]#2 алхимия для начинающих : непредсказуемая игра
[indent]событие с подраками после открытия форума

Одна из ведьм ковена пообещала научить нескольким рецептам отваров, но не стоило ей верить! Все, что осталось - это ее книга с неаккуратными каракулями, которые слишком путано описывали результат, да и зарисовки от руки. Чтож, остается только действовать наугад, сверяться с картинками в книге и надеятся, что котел выдержит экспериментальное варево.
[indent]правила игры
нажми на кнопку "добавить ингредиенты", чтобы увидеть результат алхимии
при совпадении 4 одинаковых бутылок - суперприз, 3х - отличная награда, 2х - приятный бонус, все разные - увы, ничего не получилось.
приз будет выдан моментально в блоке с игрой
получить подарок можно только 1 раз в сутки
пришлите результат в этой теме под хайдом
ивент продлится до 05.11.2025
для выдачи приза пришлите скриншот амс на форуме после открытия в теме магазина
мы надеемся на вашу честность, удачи! 🔮
Код:[hide=99999][img]ссылка на скриншот[/img][/hide]
[html]<script>
function slotMachine() {
const customImages = [
{ url: "https://forumstatic.ru/files/0016/f1/95/84325.png", probability: 39 },
{ url: "https://forumstatic.ru/files/0016/f1/95/34356.png", probability: 30 },
{ url: "https://forumstatic.ru/files/0016/f1/95/84393.png", probability: 15 },
{ url: "https://forumstatic.ru/files/0016/f1/95/33006.png", probability: 10 },
{ url: "https://forumstatic.ru/files/0016/f1/95/84325.png", probability: 5 }
];
function getRandomImage() {
const randomNum = Math.random() * 100;
let cumulativeProbability = 0;
for (const image of customImages) {
cumulativeProbability += image.probability;
if (randomNum <= cumulativeProbability) {
return image.url;
}
}
return customImages[0].url;
}const isJackpot = Math.random() < 0.01;
let slot1, slot2, slot3, slot4;
if (isJackpot) {
const jackpotImage = customImages[Math.floor(Math.random() * customImages.length)].url;
slot1 = jackpotImage;
slot2 = jackpotImage;
slot3 = jackpotImage;
slot4 = jackpotImage;
} else {
slot1 = getRandomImage();
slot2 = getRandomImage();
slot3 = getRandomImage();
slot4 = getRandomImage();
}
const slots = [slot1, slot2, slot3, slot4];
const counts = {};
slots.forEach(slot => {
counts[slot] = (counts[slot] || 0) + 1;
});
const maxMatches = Math.max(...Object.values(counts));
let result = "";
let prize = "";
if (maxMatches === 4) {
result = "🎉 Ого, 4 совпадения, да ты прирожденный зельевар!";
prize = "твой приз - 3 товара из магазина совершенно бесплатно";
} else if (maxMatches === 3) {
result = "🎊 3 из 4 - отличный результат для начинающего алхимика!";
prize = "забери любую плашку из магазина";
} else if (maxMatches === 2) {
result = "🎁 2 из 4 - молодец!";
prize = "100 £ твои";
} else {
result = "😢 Увы, ничего не получилось";
prize = "попробуйте еще раз завтра!";
}
const slotsContainer = document.getElementById('slotsResult');
const resultContainer = document.getElementById('gameResult');
slotsContainer.innerHTML = "сверяемся с книгой зелий...";
resultContainer.innerHTML = "";
setTimeout(() => {
slotsContainer.innerHTML = `
<div style="display: flex; justify-content: center; gap: 8px; margin: 10px 0; filter: brightness(0.9);">
<img src="${slot1}" style="width: 70px; height: 70px; object-fit: cover;">
<img src="${slot2}" style="width: 70px; height: 70px; object-fit: cover;">
<img src="${slot3}" style="width: 70px; height: 70px; object-fit: cover;">
<img src="${slot4}" style="width: 70px; height: 70px; object-fit: cover;">
</div>
`;
resultContainer.innerHTML = `
<div style="margin: 10px 0;
padding: 10px;
border-radius: 10px;
background: var(--body_quote);
color: var(--text);
font: 11px Inter;">
<strong>${result}</strong><br>
${prize}
</div>
`;
}, 1000);
}
</script><!-- HTML -->
<div style="text-align: center; padding: 20px; background: var(--body_prof); color: var(--text); max-width: 450px; margin: 20px auto; border-radius: 10px;">
<img src="https://forumstatic.ru/files/001b/7a/c4/50739.png" style="filter: brightness(0.9);">
<div id="slotsResult" style="font: 400 11px inter; margin: 20px 0; padding: 15px; background: var(--body_quote); border-radius: 10px;">
Нажмите "добавить ингредиенты" чтобы начать!
</div>
<button onclick="slotMachine()" style="padding: 6px 15px;
text-transform: lowercase;
letter-spacing: 0.5px;
cursor: pointer;
background: var(--cite);
border: none;
color: var(--link_code);
-webkit-transition: 0.25s;
transition: 0.25s;
border-radius: 20px;
outline: none;
font: 500 11px Inter;">
добавить ингредиенты
</button>
<div id="gameResult" style="margin-top: 15px; font-size: 14px;"></div></div>
[/html]
[hideprofile]
[hideprofile]