on my mock i got barely got a 5 projected doing good on the mcq and frq. is there any tools that would help me mainly frq based. I have barely studied and is watching heimler and mr sinn enough for me to guarntee the 5
u/ImportantBluejay7163
<!--
ap cpt project
html only used for font and texts while game logic is js
-->
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Arena Fighting</title>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet"> <style>*{box-sizing:border-box;margin:0;padding:0}body{background:#0a0a1a;color:#eee;font-family:'Press Start 2P',monospace;display:flex;flex-direction:column;align-items:center;padding:20px 12px;min-height:100vh}h1{font-size:15px;color:#4ade80;letter-spacing:3px;margin-bottom:4px}#sub{font-size:7px;color:#444;letter-spacing:2px;margin-bottom:18px}#box{width:100%;max-width:560px;border:3px solid #1e3a5f;border-radius:10px;overflow:hidden;background:#0f1635}#arena{height:190px;background:linear-gradient(#06091a 54%,#1a2a10 54%);position:relative;overflow:hidden}.star{position:absolute;background:#fff;border-radius:50%}#moon{position:absolute;top:10px;right:28px;width:16px;height:16px;border-radius:50%;background:#ddd8a0;box-shadow:0 0 6px #ffffc0}#ground{position:absolute;bottom:0;left:0;right:0;height:3px;background:#2d4a1a;border-top:2px solid #3d6a22}.torch{position:absolute;bottom:3px;width:5px;height:18px;background:#7a3a10}.flame{position:absolute;top:-8px;left:-3px;width:10px;height:10px;background:#f97316;border-radius:50% 50% 30% 30%;animation:flicker .7s infinite alternate;box-shadow:0 0 7px #f97316}@keyframes flicker{to{transform:scale(1.15);opacity:.8}}#fighters{position:absolute;bottom:3px;left:0;right:0;display:flex;justify-content:space-between;align-items:flex-end;padding:0 36px}.slot{display:flex;flex-direction:column;align-items:center;gap:3px}.fname{font-size:8px}.pname{color:#4ade80}.ename{color:#f87171}.hpwrap{width:110px}.hprow{display:flex;justify-content:space-between;font-size:7px;color:#999;margin-bottom:2px}.hpbg{height:8px;background:#111;border:2px solid #333}.hpfill{height:100%;transition:width .4s,background .4s}.sarea{height:105px;display:flex;align-items:flex-end;justify-content:center}#vs{font-size:9px;color:#f44;text-shadow:0 0 7px #f448;align-self:center;padding-bottom:24px}.pop{position:absolute;font-size:11px;text-shadow:1px 1px 0 #000;pointer-events:none;animation:floatup .9s ease-out forwards;z-index:30}.pop-dmg{color:#f55}.pop-heal{color:#4ade80}@keyframes floatup{to{transform:translateY(-32px);opacity:0}}#dots{display:flex;justify-content:center;gap:7px;padding:7px 0;background:#060912;border-top:2px solid #1e3a5f}.dot{width:8px;height:8px;border-radius:50%;border:1px solid #333;transition:all .3s}#ctrl{padding:14px 18px 18px;background:#060912}#statbar{font-size:7px;color:#7eb3ff;text-align:center;padding:8px;background:#080e20;border:1px solid #1e3a5f;border-radius:4px;margin-bottom:10px;line-height:1.9}#buffbar{font-size:7px;color:#f97316;text-align:center;margin-bottom:8px;min-height:13px}.badge{display:inline-block;padding:2px 5px;background:#1a0f35;border:1px solid #7c3aed;border-radius:3px;color:#c084fc;margin:0 2px;font-size:6px}#grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:10px}.mbtn{font-family:'Press Start 2P',monospace;font-size:7px;padding:10px 4px;border-radius:5px;border:2px solid;cursor:pointer;line-height:1.6;transition:filter .15s}.mbtn:hover:not(:disabled){filter:brightness(1.3)}.mbtn:disabled{opacity:.4;cursor:not-allowed}.atk{background:#0f1635;border-color:#3b5bdb;color:#7eb3ff}.hln{background:#0f2a1a;border-color:#16a34a;color:#4ade80}#rbtn{font-family:'Press Start 2P',monospace;font-size:7px;padding:8px 14px;background:#1a0f35;border:2px solid #7c3aed;border-radius:5px;color:#c084fc;cursor:pointer;display:block;margin:0 auto 10px}#rbtn:hover{filter:brightness(1.3)}#go{display:none;flex-direction:column;align-items:center;gap:12px;padding:16px 0;text-align:center}#go.show{display:flex}#gotitle{font-size:13px;letter-spacing:2px}#gomsg{font-size:7px;color:#777;line-height:1.9}#logbox{width:100%;max-width:560px;margin-top:14px;background:#060912;border:2px solid #1e3a5f;border-radius:8px;overflow:hidden}#loghdr{font-size:7px;color:#f97316;letter-spacing:2px;padding:9px 14px;background:#080e20;border-bottom:1px solid #1e3a5f}#log{height:150px;overflow-y:auto;padding:8px 12px;display:flex;flex-direction:column;gap:3px}.ll{font-family:monospace;font-size:12px;padding:1px 0}.lnorm{color:#666}.lgood{color:#4ade80}.lbad{color:#f87171}.lbuff{color:#f97316}.h-head{width:16px;height:16px;background:#f9d89c;border:2px solid #222;margin:0 auto;position:relative}.h-eye{position:absolute;top:4px;width:3px;height:3px;background:#222}.h-body{width:20px;height:18px;background:#4ade80;border:2px solid #222;margin:0 auto;position:relative}.h-belt{position:absolute;bottom:4px;left:0;right:0;height:3px;background:#166534}.h-arms{display:flex;justify-content:center;margin-top:-18px}.h-arm{width:6px;height:14px;background:#4ade80;border:2px solid #222;margin-top:2px}.h-gap{width:20px}.h-swrd{width:4px;height:20px;background:#aaa;border:1px solid #222;margin-top:-6px;margin-left:1px}.h-legs{display:flex;justify-content:center;gap:4px;margin-top:2px}.h-leg{width:8px;height:14px;background:#1e40af;border:2px solid #222}.h-boot{width:10px;height:6px;background:#7c3e11;border:2px solid #222}.g-ear{width:0;height:0;border-bottom:10px solid #86efac;border-left:6px solid transparent;border-right:6px solid transparent}.g-head{width:20px;height:16px;background:#86efac;border:2px solid #222;margin:0 auto;position:relative}.g-eye{position:absolute;top:4px;width:3px;height:3px;background:red}.g-mth{position:absolute;bottom:2px;left:5px;right:5px;height:2px;background:#222}.g-body{width:18px;height:16px;background:#86efac;border:2px solid #222;margin:0 auto;position:relative}.g-strp{position:absolute;top:4px;left:0;right:0;height:2px;background:#4b7c3e}.g-arms{display:flex;justify-content:center;margin-top:-16px}.g-arm{width:5px;height:12px;background:#86efac;border:2px solid #222;margin-top:2px}.g-gap{width:18px}.g-club{width:3px;height:16px;background:#92400e;border:1px solid #222;margin-top:-4px;margin-left:1px}.g-legs{display:flex;justify-content:center;gap:4px;margin-top:2px}.g-leg{width:7px;height:10px;background:#86efac;border:2px solid #222}.s-skul{width:18px;height:18px;background:#f0f0f0;border:2px solid #222;margin:0 auto;position:relative;border-radius:2px}.s-eye{position:absolute;top:5px;width:4px;height:4px;background:#222}.s-tth{position:absolute;bottom:0;left:2px;right:2px;height:5px;display:flex;gap:2px}.s-tth>div:nth-child(odd){flex:1;background:#222}.s-tth>div:nth-child(even){flex:1;background:#f0f0f0}.s-ribs{width:14px;height:16px;margin:0 auto;display:flex;flex-direction:column;gap:3px}.s-row{display:flex;justify-content:space-between}.s-rib{width:6px;height:3px;background:#f0f0f0;border:1px solid #222}.s-sp{width:2px;height:3px;background:#ccc;border:1px solid #222}.s-arms{display:flex;justify-content:center;margin-top:-16px}.s-arm{width:4px;height:12px;background:#f0f0f0;border:2px solid #222}.s-gap{width:14px}.s-swrd{width:3px;height:18px;background:#aaa;border:1px solid #222;margin-top:-6px;margin-left:1px}.s-legs{display:flex;justify-content:center;gap:6px;margin-top:2px}.s-leg{width:4px;height:14px;background:#f0f0f0;border:2px solid #222}.o-head{width:24px;height:20px;background:#5a8f3c;border:2px solid #222;margin:0 auto;position:relative;border-radius:2px}.o-eye{position:absolute;top:5px;width:4px;height:4px;background:#ff0}.o-tsk{position:absolute;bottom:-4px;width:5px;height:6px;background:#fffde7;border:1px solid #222;border-radius:0 0 3px 3px}.o-body{width:28px;height:22px;background:#5a8f3c;border:2px solid #222;margin:2px auto 0;position:relative}.o-armr{position:absolute;top:3px;left:3px;right:3px;height:8px;background:#444;border:1px solid #666}.o-arms{display:flex;justify-content:center;margin-top:-22px}.o-arm{width:7px;height:16px;background:#5a8f3c;border:2px solid #222;margin-top:2px}.o-gap{width:28px}.o-axh{width:4px;height:20px;background:#92400e;border:1px solid #222;margin-top:-8px;margin-left:1px}.o-axe{width:8px;height:8px;background:#888;border:1px solid #555;margin-top:-8px;margin-left:-2px;border-radius:2px 4px 2px 2px}.o-legs{display:flex;justify-content:center;gap:4px;margin-top:2px}.o-leg{width:10px;height:14px;background:#3a5f25;border:2px solid #222}.o-boot{width:12px;height:6px;background:#5c3a11;border:2px solid #222}.w-htop{width:12px;height:16px;background:#2a0a5a;border:2px solid #111;margin:0 auto}.w-hbrm{width:28px;height:5px;background:#2a0a5a;border:2px solid #111;margin:0 auto}.w-head{width:18px;height:16px;background:#ffe0b2;border:2px solid #222;margin:0 auto;position:relative}.w-eye{position:absolute;top:4px;width:3px;height:3px;background:#4b0082}.w-body{width:20px;height:20px;background:#2a0a5a;border:2px solid #111;margin:0 auto}.w-arms{display:flex;justify-content:center;margin-top:-20px}.w-arm{width:5px;height:14px;background:#2a0a5a;border:2px solid #111;margin-top:2px}.w-gap{width:20px}.w-wand{width:3px;height:18px;background:#7c3aed;border:1px solid #111;margin-top:-6px;margin-left:1px;position:relative}.w-tip{width:6px;height:6px;background:#f97316;border-radius:50%;position:absolute;top:-3px;left:-2px;box-shadow:0 0 6px #f97316}.w-legs{display:flex;justify-content:center;gap:4px;margin-top:2px}.w-leg{width:7px;height:14px;background:#2a0a5a;border:2px solid #111}.w-boot{width:9px;height:8px;background:#111;border:2px solid #333;border-radius:0 0 4px 4px}.d-horn{width:0;height:0;border-bottom:14px solid #dc2626;border-left:5px solid transparent;border-right:5px solid transparent}.d-head{width:30px;height:22px;background:#dc2626;border:2px solid #7f1d1d;margin:0 auto;position:relative;border-radius:3px}.d-eye{position:absolute;top:5px;width:5px;height:5px;background:#fbbf24;border:1px solid #222}.d-nst{position:absolute;bottom:3px;width:3px;height:2px;background:#7f1d1d}.d-neck{width:20px;height:10px;background:#dc2626;border:2px solid #7f1d1d;margin:0 auto}.d-body{width:36px;height:26px;background:#dc2626;border:2px solid #7f1d1d;margin:0 auto;position:relative;border-radius:2px}.d-bly{position:absolute;left:6px;right:6px;top:4px;bottom:4px;background:#fca5a5;border-radius:4px}.d-wing{position:absolute;top:-4px;width:14px;height:20px;background:#b91c1c;border:2px solid #7f1d1d}.d-legs{display:flex;justify-content:center;gap:8px;margin-top:2px}.d-leg{width:10px;height:12px;background:#dc2626;border:2px solid #7f1d1d}.d-clwg{display:flex;gap:1px}.d-clw{width:3px;height:5px;background:#7f1d1d;border-radius:0 0 2px 2px}@keyframes idle-bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-2px)}}@keyframes hero-bob{0%,100%{transform:translateX(0)}50%{transform:translateX(1px)}}@keyframes atk-p{0%{transform:translateX(0)}50%{transform:translateX(16px)}100%{transform:translateX(0)}}@keyframes atk-e{0%{transform:translateX(0)}50%{transform:translateX(-16px)}100%{transform:translateX(0)}}@keyframes shake{20%{transform:translateX(-7px)}40%{transform:translateX(7px)}60%{transform:translateX(-4px)}80%{transform:translateX(4px)}100%{transform:translateX(0)}}@keyframes die{to{transform:rotate(-90deg) translateY(8px);opacity:.3}}@keyframes drgn{0%,100%{transform:translateY(0) scale(1)}50%{transform:translateY(-3px) scale(1.02)}}.idle-p{animation:hero-bob 2s ease-in-out infinite}.idle-e{animation:idle-bob 2.2s ease-in-out infinite}.idle-dr{animation:drgn 2.5s ease-in-out infinite}.anim-ap{animation:atk-p .25s ease-out}.anim-ae{animation:atk-e .25s ease-out}.anim-sh{animation:shake .35s ease-out}.anim-die{animation:die .4s ease forwards}</style>
</head>
<body>
<h1>Arena Fighting</h1>
<p id="sub">TURN-BASED BATTLE for AP CPT</p>
<div id="box">
<div id="arena">
<div id="moon"></div>
<div class="torch" style="left:18px"><div class="flame"></div></div>
<div class="torch" style="right:18px"><div class="flame" style="animation-delay:.3s"></div></div>
<div id="ground"></div>
<div id="fighters">
<div class="slot">
<span class="fname pname">HERO</span>
<div class="hpwrap"><div class="hprow"><span>HP</span><span id="php">100</span></div><div class="hpbg"><div class="hpfill" id="pfill" style="width:100%;background:#4ade80"></div></div></div>
<div class="sarea">
<div id="ps" class="idle-p">
<div class="h-head"><div class="h-eye" style="left:3px"></div><div class="h-eye" style="right:3px"></div></div>
<div class="h-body"><div class="h-belt"></div></div>
<div class="h-arms"><div class="h-arm"></div><div class="h-gap"></div><div class="h-arm"></div><div class="h-swrd"></div></div>
<div class="h-legs"><div class="h-leg"></div><div class="h-leg"></div></div>
<div style="display:flex;justify-content:center;gap:4px"><div class="h-boot"></div><div class="h-boot"></div></div>
</div>
</div>
</div>
<div id="vs">VS</div>
<div class="slot">
<span class="fname ename" id="ename">GOBLIN</span>
<div class="hpwrap"><div class="hprow"><span>HP</span><span id="ehp">55</span></div><div class="hpbg"><div class="hpfill" id="efill" style="width:100%;background:#f87171"></div></div></div>
<div class="sarea"><div id="es" class="idle-e"></div></div>
</div>
</div>
<div id="fc" style="position:absolute;inset:0;pointer-events:none;z-index:30"></div>
</div>
<div id="dots"></div>
<div id="ctrl">
<div id="statbar">---</div>
<div id="buffbar"></div>
<div id="grid">
<button class="mbtn atk" onclick="go(0)">PUNCH (has a chance to crit)<br><span style="color:#4ade80;font-size:6px">15 DMG</span></button>
<button class="mbtn atk" onclick="go(1)">KICK (has a chance to bleed)<br><span style="color:#4ade80;font-size:6px">20 DMG</span></button>
<button class="mbtn atk" onclick="go(2)">SLAM<br><span style="color:#4ade80;font-size:6px">30 DMG</span></button>
<button class="mbtn hln" onclick="go(3)">HEAL<br><span style="color:#4ade80;font-size:6px">+20 HP</span></button>
</div>
<button id="rbtn" onclick="reset()">&#8635; RESTART</button>
<div id="go"><div id="gotitle"></div><div id="gomsg"></div></div>
</div>
</div>
<div id="logbox"><div id="loghdr">BATTLE LOG</div><div id="log"></div></div>
<script>
// end of html code
// title screen acts as a procedure which has all the code for the starting screen
(function titlescreen() {
var ts = document.createElement("div");
ts.style.cssText = `
position:fixed; inset:0;
background:radial-gradient(circle at top,#0f1635,#060912 80%);
display:flex; align-items:center; justify-content:center;
z-index:999; flex-direction:column;
font-family:'Press Start 2P', monospace;
`;
var title = document.createElement("div");
title.textContent = "Arena Fighter";
title.style.cssText = `
color:#4ade80; font-size:20px;
letter-spacing:4px;
text-shadow:0 0 12px #4ade80aa;
margin-bottom:14px;
`;
var sub = document.createElement("div");
sub.textContent = "Made by Ashvath and Aqeel";
sub.style.cssText = `
font-size:8px; color:#555;
margin-bottom:30px;
`;
var press = document.createElement("div");
press.textContent = "▶ PRESS START";
press.style.cssText = `
font-size:10px;
color:#c084fc;
text-shadow:0 0 8px #7c3aed;
transition:opacity .2s;
`;
// end
ts.appendChild(title);
ts.appendChild(sub);
ts.appendChild(press);
document.body.appendChild(ts);
var visible = true;
var blink = setInterval(function () {
visible = !visible;
press.style.opacity = visible ? "1" : "0.2";
}, 500);
// game start
function starting() {
clearInterval(blink);
ts.remove();
}
// key start
ts.addEventListener("click", starting);
document.addEventListener("keydown", starting, { once: true });
})();
// list/array for cpt requirement
var moves = [{"name":"Punch","dmg":15 || 18.5},{"name":"Kick","dmg":20 || 25 },{"name":"Slam","dmg":30},{"name":"Heal","dmg":-20}];
var enemies = [{"name":"Goblin","hp":55,"spr":"gob","reward":"atk","prize":"+5 ATK"},{"name":"Skeleton","hp":75,"spr":"ske","reward":"hp","prize":"+25 HP"},{"name":"Orc","hp":95,"spr":"orc","reward":"atk","prize":"+8 ATK"},{"name":"Witch","hp":110,"spr":"wit","reward":"heal","prize":"+15 HEAL"},{"name":"Dragon","hp":145,"spr":"drg","reward":"atk","prize":"+12 ATK"}];
var sprFns = {"gob":function(){return "<div style=\"display:flex;justify-content:space-between;width:28px;margin:0 auto\"><div class=\"g-ear\"></div><div class=\"g-ear\"></div></div><div class=\"g-head\"><div class=\"g-eye\" style=\"left:3px\"></div><div class=\"g-eye\" style=\"right:3px\"></div><div class=\"g-mth\"></div></div><div class=\"g-body\"><div class=\"g-strp\"></div></div><div class=\"g-arms\"><div class=\"g-arm\"></div><div class=\"g-gap\"></div><div class=\"g-arm\"></div><div class=\"g-club\"></div></div><div class=\"g-legs\"><div class=\"g-leg\"></div><div class=\"g-leg\"></div></div>"},"ske":function(){return "<div class=\"s-skul\"><div class=\"s-eye\" style=\"left:3px\"></div><div class=\"s-eye\" style=\"right:3px\"></div><div class=\"s-tth\"><div></div><div></div><div></div><div></div><div></div></div></div><div class=\"s-ribs\"><div class=\"s-row\"><div class=\"s-rib\"></div><div class=\"s-sp\"></div><div class=\"s-rib\"></div></div><div class=\"s-row\"><div class=\"s-rib\"></div><div class=\"s-sp\"></div><div class=\"s-rib\"></div></div><div class=\"s-row\"><div class=\"s-rib\"></div><div class=\"s-sp\"></div><div class=\"s-rib\"></div></div></div><div class=\"s-arms\"><div class=\"s-arm\"></div><div class=\"s-gap\"></div><div class=\"s-arm\"></div><div class=\"s-swrd\"></div></div><div class=\"s-legs\"><div class=\"s-leg\"></div><div class=\"s-leg\"></div></div>"},"orc":function(){return "<div class=\"o-head\"><div class=\"o-eye\" style=\"left:4px\"></div><div class=\"o-eye\" style=\"right:4px\"></div><div class=\"o-tsk\" style=\"left:4px\"></div><div class=\"o-tsk\" style=\"right:4px\"></div></div><div class=\"o-body\"><div class=\"o-armr\"></div></div><div class=\"o-arms\"><div class=\"o-arm\"></div><div class=\"o-gap\"></div><div class=\"o-arm\"></div><div><div class=\"o-axe\"></div><div class=\"o-axh\"></div></div></div><div class=\"o-legs\"><div class=\"o-leg\"></div><div class=\"o-leg\"></div></div><div style=\"display:flex;justify-content:center;gap:4px\"><div class=\"o-boot\"></div><div class=\"o-boot\"></div></div>"},"wit":function(){return "<div class=\"w-htop\"></div><div class=\"w-hbrm\"></div><div class=\"w-head\"><div class=\"w-eye\" style=\"left:3px\"></div><div class=\"w-eye\" style=\"right:3px\"></div></div><div class=\"w-body\"></div><div class=\"w-arms\"><div class=\"w-arm\"></div><div class=\"w-gap\"></div><div class=\"w-arm\"></div><div class=\"w-wand\"><div class=\"w-tip\"></div></div></div><div class=\"w-legs\"><div class=\"w-leg\"></div><div class=\"w-leg\"></div></div><div style=\"display:flex;justify-content:center;gap:4px\"><div class=\"w-boot\"></div><div class=\"w-boot\"></div></div>"},"drg":function(){return "<div style=\"display:flex;justify-content:space-between;width:36px;margin:0 auto\"><div class=\"d-horn\"></div><div class=\"d-horn\"></div></div><div class=\"d-head\"><div class=\"d-eye\" style=\"left:4px\"></div><div class=\"d-eye\" style=\"right:4px\"></div><div class=\"d-nst\" style=\"left:8px\"></div><div class=\"d-nst\" style=\"right:8px\"></div></div><div class=\"d-neck\"></div><div class=\"d-body\"><div class=\"d-bly\"></div><div class=\"d-wing\" style=\"left:-14px;border-radius:80% 0 0 50%;transform:skewY(-10deg)\"></div><div class=\"d-wing\" style=\"right:-14px;border-radius:0 80% 50% 0;transform:skewY(10deg)\"></div></div><div class=\"d-legs\"><div class=\"d-leg\"></div><div class=\"d-leg\"></div></div><div style=\"display:flex;justify-content:center;gap:8px\"><div class=\"d-clwg\"><div class=\"d-clw\"></div><div class=\"d-clw\"></div><div class=\"d-clw\"></div></div><div class=\"d-clwg\"><div class=\"d-clw\"></div><div class=\"d-clw\"></div><div class=\"d-clw\"></div></div></div>"}};
// variable intlizize
var pHp, pMaxHp, eHp, eIdx, alive, busy, atkBonus, healBonus, collectedBuffs;
// setups enemies params
function setup() {
pHp = 100; pMaxHp = 100; eIdx = 0; eHp = enemies[0].hp;
alive = true; busy = false; atkBonus = 0; healBonus = 0; collectedBuffs = [];
}
// calc randomizes enemies hit based upon ur buffs and health
function calcHit(dmg, cur, max) {
if (dmg < 0) return Math.min(max, cur + Math.abs(dmg));
var roll = dmg + Math.floor(Math.random() * 10) - 3;
if (roll < 1) roll = 1;
return Math.max(0, cur - roll);
}
// enemy picks out of our moveset to make the game harder, added this later
function enemyPick() { return moves[Math.floor(Math.random() * 3)]; }
// grants buffs after each stage
function grantBuff(e) {
if (e.reward === "atk") atkBonus += parseInt(e.prize);
if (e.reward === "hp") { pMaxHp += 25; pHp = Math.min(pHp + 25, pMaxHp); }
if (e.reward === "heal") healBonus += 15;
collectedBuffs.push(e.prize);
}
// loads the sprites baed on the array of Var enemies
function loadSprite(key, dead, atk) {
var el = document.getElementById("es");
el.innerHTML = sprFns[key]();
el.className = dead ? "anim-die" : atk ? "anim-ae" : (key === "drg" ? "idle-dr" : "idle-e");
}
// spawns stars once u beat the game
(function spawnStars() {
var a = document.getElementById("arena");
for (var i = 0; i < 16; i++) {
var s = document.createElement("div"); s.className = "star";
var sz = i % 3 === 0 ? 2 : 1;
s.style.cssText = "width:" + sz + "px;height:" + sz + "px;top:" + (Math.sin(i*2.1)*38+12) + "%;left:" + (((i*43)%88)+6) + "%;opacity:" + (0.4+(i%3)*0.2);
a.insertBefore(s, a.firstChild);
}
})();
// changes the effect of moves once u get a buff
function refreshStatus() {
var e = enemies[eIdx], ex = (atkBonus ? " | ATK+" + atkBonus : "") + (healBonus ? " | HEAL+" + healBonus : "");
document.getElementById("statbar").textContent = "HERO " + Math.max(0,pHp) + "/" + pMaxHp + " | " + e.name.toUpperCase() + " " + Math.max(0,eHp) + "/" + e.hp + ex;
}
// changes the health bars based upon the enemy
function refreshBars() {
var pp = Math.max(0, pHp/pMaxHp*100), ep = Math.max(0, eHp/enemies[eIdx].hp*100);
var pf = document.getElementById("pfill");
pf.style.width = pp + "%"; pf.style.background = pp > 50 ? "#4ade80" : pp > 25 ? "#fb923c" : "#f87171";
document.getElementById("php").textContent = Math.max(0, pHp);
var ef = document.getElementById("efill");
ef.style.width = ep + "%"; ef.style.background = ep > 50 ? "#f87171" : ep > 25 ? "#fb923c" : "#f97316";
document.getElementById("ehp").textContent = Math.max(0, eHp);
}
// changes the buffs after each stage
function refreshBuffs() {
var el = document.getElementById("buffbar");
if (!collectedBuffs.length) { el.textContent = ""; return; }
el.innerHTML = "BUFFS: " + collectedBuffs.map(function(b) { return '<span class="badge">'+b+'</span>'; }).join("");
}
// the dots show which stage of the level u are at
function rebuildDots() {
var d = document.getElementById("dots"); d.innerHTML = "";
enemies.forEach(function(e,i) {
var dot = document.createElement("div"); dot.className = "dot";
dot.style.background = i < eIdx ? "#222" : i === eIdx ? "#f97316" : "#4ade80";
dot.style.boxShadow = i === eIdx ? "0 0 6px #f97316" : "none";
d.appendChild(dot);
});
}
// all the functions from this line to 233 are code for the anmations of the models
function addLog(msg, cls) {
var p = document.createElement("div"); p.className = "ll " + (cls || "lnorm"); p.textContent = msg;
var log = document.getElementById("log"); log.insertBefore(p, log.firstChild);
}
function pop(text, side) {
var fc = document.getElementById("fc"), el = document.createElement("div");
el.className = "pop " + (text[0] === "+" ? "pop-heal" : "pop-dmg");
el.textContent = text; el.style.bottom = "38px"; el.style.left = side === "p" ? "14%" : "60%";
fc.appendChild(el); setTimeout(function() { if (fc.contains(el)) fc.removeChild(el); }, 900);
}
function shake(id) {
var el = document.getElementById(id); el.classList.remove("anim-sh"); void el.offsetWidth;
el.classList.add("anim-sh"); setTimeout(function() { el.classList.remove("anim-sh"); }, 380);
}
function setBtns(off) { document.querySelectorAll(".mbtn").forEach(function(b){b.disabled=off;}); }
function showGameOver(win) {
document.getElementById("go").classList.add("show");
var t = document.getElementById("gotitle"), m = document.getElementById("gomsg");
if (win) { t.textContent = "YOU WIN!"; t.style.cssText = "color:#4ade80;text-shadow:0 0 10px #4ade8088"; m.textContent = "All 5 enemies down! Buffs: "+collectedBuffs.length+"/5"; }
else { t.textContent = "DEFEATED..."; t.style.cssText = "color:#f87171;text-shadow:0 0 10px #f8717188"; m.textContent = "Lost to the "+enemies[eIdx].name+". Try again!"; }
setBtns(true);
}
// ends here
// like grantBuff, bases how powerful your buff should be upon enemey strength
function nextEnemy() {
grantBuff(enemies[eIdx]); refreshBuffs();
addLog("BUFF: " + enemies[eIdx].prize + "!", "lbuff");
eIdx++;
if (eIdx < enemies.length) {
eHp = enemies[eIdx].hp;
document.getElementById("ename").textContent = enemies[eIdx].name.toUpperCase();
loadSprite(enemies[eIdx].spr, false, false);
rebuildDots(); refreshBars(); refreshStatus();
addLog(enemies[eIdx].name + " steps forward!", "lgood");
} else { alive = false; showGameOver(true); refreshStatus(); }
}
function go(choice) {
if (!alive || busy) return;
busy = true; setBtns(true);
var m = moves[choice];
// all codes for buffs end here
// condition statment which show if u died or not
if (m.dmg < 0) {
var before = pHp; pHp = Math.min(pMaxHp, pHp + Math.abs(m.dmg) + healBonus);
pop("+" + (pHp - before) + " HP", "p");
addLog("You healed for " + (pHp - before) + " HP."); refreshBars(); refreshStatus();
setTimeout(function() {
var em = enemyPick(), oldP = pHp; pHp = calcHit(em.dmg, pHp, pMaxHp);
pop("-"+(oldP-pHp),"p"); shake("ps");
loadSprite(enemies[eIdx].spr,false,true);
setTimeout(function(){loadSprite(enemies[eIdx].spr,pHp<=0,false);},300);
addLog(enemies[eIdx].name+" hit for "+(oldP-pHp)+" dmg.","lbad");
refreshBars(); refreshStatus();
if (pHp<=0){document.getElementById("ps").className="anim-die";addLog("You were knocked out...","lbad");alive=false;showGameOver(false);}
busy=false; if(alive)setBtns(false);
}, 600);
return;
}
var ps = document.getElementById("ps");
ps.classList.remove("idle-p"); ps.classList.add("anim-ap");
setTimeout(function(){ps.classList.remove("anim-ap");ps.classList.add("idle-p");},280);
setTimeout(function() {
var rd = m.dmg + atkBonus + Math.floor(Math.random()*10) - 3; if(rd<1)rd=1;
var oldE = eHp; eHp = Math.max(0, eHp-rd);
pop("-"+(oldE-eHp),"e"); shake("es");
loadSprite(enemies[eIdx].spr,eHp<=0,false);
addLog("You used "+m.name+" for "+(oldE-eHp)+" dmg."); refreshBars(); refreshStatus();
if (eHp<=0) { addLog(enemies[eIdx].name+" defeated!","lgood"); setTimeout(function(){nextEnemy();busy=false;if(alive)setBtns(false);},500); return; }
setTimeout(function(){
var em=enemyPick(),oldP=pHp; pHp=calcHit(em.dmg,pHp,pMaxHp);
pop("-"+(oldP-pHp),"p"); shake("ps");
loadSprite(enemies[eIdx].spr,false,true);
setTimeout(function(){loadSprite(enemies[eIdx].spr,false,false);},300);
addLog(enemies[eIdx].name+" hit for "+(oldP-pHp)+" dmg.","lbad");
refreshBars(); refreshStatus();
if(pHp<=0){document.getElementById("ps").className="anim-die";addLog("You were knocked out...","lbad");alive=false;showGameOver(false);}
busy=false; if(alive)setBtns(false);
},500);
},250);
}
// function ends here
// resets the code if you click restart button
function reset() {
setup();
document.getElementById("go").classList.remove("show");
document.getElementById("log").innerHTML = "";
document.getElementById("ename").textContent = enemies[0].name.toUpperCase();
document.getElementById("ps").className = "idle-p";
loadSprite(enemies[0].spr,false,false);
rebuildDots(); refreshBars(); refreshStatus(); refreshBuffs();
setBtns(false); addLog("Battle starts! Pick a move.","lgood");
}
setup(); loadSprite(enemies[0].spr,false,false);
rebuildDots(); refreshBars(); refreshStatus();
addLog("Battle starts! Pick a move.","lgood");
</script>
</body>
</html>
this is my ap csp cpt code if yall can copy and paste it to check if it will get a 6 it would be greatly appreciated