Skip to content

Conversation

@soopercool101
Copy link

This allows spellcast count and golden cookie click achievements to be more easily earned

This allows spellcast count and golden cookie click achievements to be more easily earned
@TZFC
Copy link

TZFC commented Oct 30, 2025

Or a "[satisfy minimum MP AND has at least 2 buffs] OR [reach max MP AND has at least 1 buff]" mode

// Calculate both costs once
const costMin = Math.floor(spell.costMin + grimoire.magicM * spell.costPercent);
const costMax = grimoire.magicM;

// Conditions
const satisfyMinMP = costMin <= grimoire.magic;
const reachMaxMP   = costMax <= grimoire.magic;

// Buff conditions
const hasAtLeast1Buff = buffCount >= 1;
const hasAtLeast2Buff = buffCount >= 2;

// Trigger if:
// (minimum MP & ≥2 buffs) OR (max MP & ≥1 buff)
if ((satisfyMinMP && hasAtLeast2Buff) || (reachMaxMP && hasAtLeast1Buff)) {
    grimoire.castSpell(spell);
    CookieAssistant.isAfterSpellcast = true;
    setTimeout(() => {
        if (CookieAssistant.isAfterSpellcast) {
            CookieAssistant.isAfterSpellcast = false;
        }
    }, 3000);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants