Sparks on start and extra on space

This commit is contained in:
Otard95 2021-06-03 19:53:48 +02:00
parent fedbade8cf
commit 908484d3d0
2 changed files with 6 additions and 2 deletions

View file

@ -235,6 +235,7 @@ function handleSpace(event, isEnter) {
dontInsertSpace = true;
if (currentWord == TestLogic.input.current || Config.mode == "zen") {
//correct word or in zen mode
MonkeyPower.addPower(true, true);
PaceCaret.handleSpace(true, currentWord);
TestStats.incrementAccuracy(true);
TestLogic.input.pushHistory();
@ -253,6 +254,7 @@ function handleSpace(event, isEnter) {
Replay.addReplayEvent("submitCorrectWord");
} else {
//incorrect word
MonkeyPower.addPower(false, true);
PaceCaret.handleSpace(false, currentWord);
if (Config.funbox !== "nospace") {
if (!Config.playSoundOnError || Config.blindMode) {
@ -486,6 +488,7 @@ function handleAlpha(event) {
!TestLogic.active
) {
if (!TestLogic.startTest()) return;
MonkeyPower.addPower();
} else {
if (!TestLogic.active) return;
}

View file

@ -177,7 +177,7 @@ function randomColor() {
/**
* @param {boolean} good Good power or not?
*/
export function addPower(good) {
export function addPower(good = true, extra = false) {
if (
!TestLogic.active ||
!Config.monkeyPowerUnlocked ||
@ -206,7 +206,8 @@ export function addPower(good) {
for (
let i = Math.round(
particleCreateCount[0] + Math.random() * particleCreateCount[1]
(particleCreateCount[0] + Math.random() * particleCreateCount[1]) *
(extra ? 2 : 1)
);
i > 0;
i--