diff --git a/images/Time2wait.svg b/images/Time2wait.svg new file mode 100644 index 0000000..790f701 --- /dev/null +++ b/images/Time2wait.svg @@ -0,0 +1,71 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/js/Layers/study.js b/js/Layers/study.js index 9d3a165..96889d0 100644 --- a/js/Layers/study.js +++ b/js/Layers/study.js @@ -1,3 +1,26 @@ +function createCard(title, description, onDraw) { + return { title, description, onDraw }; +} + +const nothingCard = () => createCard("His job is not to wield power but to draw attention away from it.", "Do nothing.", () => {}); +const gainPointsCard = () => createCard("Don't Panic.", "Successfully study some properties", () => addPoints("study", getResetGain("study"))); + +const baseCards = () => { + return [ nothingCard(), nothingCard(), nothingCard(), nothingCard(), nothingCard(), nothingCard(), gainPointsCard(), gainPointsCard(), gainPointsCard() ]; +}; + +const cardFormat = (card, id = "", width = "200px", height = "300px") => { + // TODO observe/science symbol + return ["display-text", `
+ +

${card.title}

+
+ ${card.description} + + +
`]; +}; + addLayer("study", { name: "study", resource: "properties studied", @@ -14,73 +37,46 @@ addLayer("study", { xp: new Decimal(0), lastLevel: new Decimal(0), realTime: 0, - timeLoopActive: false + timeLoopActive: false, + drawPeriod: 10, + drawProgress: 0, + cards: baseCards(), + lastCard: null }; }, getResetGain() { if (!tmp[this.layer].layerShown || (player.tab !== this.layer && !player[this.layer].timeLoopActive)) { return new Decimal(0); } - let gain = new Decimal(1); + let gain = new Decimal(10); + gain = gain.times(new Decimal(1.1).pow(getJobLevel(this.layer))); return gain; }, - passiveGeneration: new Decimal(1), - tabFormat: [ - "main-display", - ["display-text", () => `You are collecting ${format(tmp.flowers.getResetGain)} flowers per second`], - "blank", - ["display-text", () => { - if (player.flowers.xp.lte(1e3)) { - return "There's a very large field of flowers"; - } - if (player.flowers.xp.lte(1e5)) { - return "A small patch is missing from the field of flowers"; - } - if (player.flowers.xp.lte(1e7)) { - return "A medium patch is missing from the field of flowers"; - } - if (player.flowers.xp.lte(4e8)) { - return "A large patch is missing from the field of flowers"; - } - if (player.flowers.xp.lte(9e8)) { - return "The field of flowers looks about half way picked"; - } - if (player.flowers.xp.lte(1e9)) { - return "There are very few flowers left"; - } - if (player.flowers.xp.gte(1e9) && player.chapter === 1) { - return "The field is barren"; - } - return ""; - }], - "blank", - ["display-text", () => { - if (!hasMilestone("flowers", 0)) { - return "Discover new ways to harness the flower's power at level 2"; - } - if (!hasMilestone("flowers", 1)) { - return "Discover new ways to harness the flower's power at level 4"; - } - if (!hasMilestone("flowers", 2)) { - return "Discover new ways to harness the flower's power at level 6"; - } - if (!hasMilestone("flowers", 3)) { - return "Discover new ways to harness the flower's power at level 8"; - } - if (!hasMilestone("flowers", 4)) { - return "Discover new ways to harness the flower's power at level 10"; - } - return ""; - }], - () => player.chapter === 1 && hasMilestone("flowers", "4") ? ["upgrade", "nextChapter"] : null, - "blank", - "buyables", - "blank", - "upgrades" - ], + tabFormat: { + "Main": { + content: () => [ + "main-display", + ["display-text", `Next draw in ${new Decimal(player.study.drawPeriod - player.study.drawProgress).clampMax(9.99).toFixed(2)} seconds`], + "blank", + player.study.lastCard == null ? null : cardFormat(player.study.lastCard, "mainCard") + // TODO add milestones to buy new cards (2), remove cards(4), random encounters(6), and upgrade cards(8) + ] + }, + "Deck": { + content: () => [["row", player.study.cards.map(card => cardFormat(card))]] + } + }, update(diff) { if (player.tab === this.layer || player[this.layer].timeLoopActive) { player[this.layer].realTime += diff; + player[this.layer].drawProgress += diff; + if (player[this.layer].drawProgress > player[this.layer].drawPeriod) { + player[this.layer].drawProgress = 0; + const newCard = player[this.layer].cards[Math.floor(Math.random() * player.study.cards.length)]; + // TODO proc lastCard + newCard.onDraw(); + player[this.layer].lastCard = newCard; + } } let jobLevel = new Decimal(getJobLevel(this.layer)); if (jobLevel.neq(player[this.layer].lastLevel)) { @@ -90,150 +86,8 @@ addLayer("study", { }, onAddPoints(gain) { let xpGain = gain; - if (hasUpgrade(this.layer, 13)) { - xpGain = xpGain.times(upgradeEffect(this.layer, 13)); - } - xpGain = xpGain.times(buyableEffect("flowers", 12)); player[this.layer].xp = player[this.layer].xp.add(xpGain); }, milestones: { - 0: { - requirementDescription: "Level 2", - done: () => player.flowers.xp.gte(10) - }, - 1: { - requirementDescription: "Level 4", - done: () => player.flowers.xp.gte(1e3) - }, - 2: { - requirementDescription: "Level 6", - done: () => player.flowers.xp.gte(1e5) - }, - 3: { - requirementDescription: "Level 8", - done: () => player.flowers.xp.gte(1e7) - }, - 4: { - requirementDescription: "Level 10", - done: () => player.flowers.xp.gte(1e9) - } }, - buyables: { - rows: 1, - cols: 3, - 11: { - title: "I tried to look at the thing in a scientific spirit
", - display() { - return `Each casting of this spell increases its cost, and makes collecting flowers 50% faster.

Currently: x${format(this.effect())}

Cost: ${format(this.cost())} flowers`; - }, - cost(x) { - return new Decimal(1000).times(new Decimal(3).pow(x || getBuyableAmount(this.layer, this.id))); - }, - effect() { - return new Decimal(1.5).pow(getBuyableAmount(this.layer, this.id)); - }, - canAfford() { - return player[this.layer].points.gte(this.cost()); - }, - buy() { - player[this.layer].points = player[this.layer].points.sub(this.cost()); - setBuyableAmount(this.layer, this.id, getBuyableAmount(this.layer, this.id).add(1)); - }, - unlocked: () => hasMilestone("flowers", 1) - }, - 12: { - title: "Why should I trouble myself?
", - display() { - return `Each casting of this spell increases its cost, and doubles experience gain.

Currently: x${format(this.effect())}

Cost: ${format(this.cost())} flowers`; - }, - cost(x) { - return new Decimal(10000).times(new Decimal(4).pow(x || getBuyableAmount(this.layer, this.id))); - }, - effect() { - return new Decimal(2).pow(getBuyableAmount(this.layer, this.id)); - }, - canAfford() { - return player[this.layer].points.gte(this.cost()); - }, - buy() { - player[this.layer].points = player[this.layer].points.sub(this.cost()); - setBuyableAmount(this.layer, this.id, getBuyableAmount(this.layer, this.id).add(1)); - }, - unlocked: () => hasMilestone("flowers", 2) - }, - 13: { - title: "And there was Weena dancing at my side!
", - display() { - return `Each casting of this spell increases its cost, and raises flower collection rate to an additive +.05 power.

Currently: ^${format(this.effect())}

Cost: ${format(this.cost())} flowers`; - }, - cost(x) { - return new Decimal(250000).times(new Decimal(10).pow(x || getBuyableAmount(this.layer, this.id))); - }, - effect() { - return new Decimal(.05).times(getBuyableAmount(this.layer, this.id)).add(1); - }, - canAfford() { - return player[this.layer].points.gte(this.cost()); - }, - buy() { - player[this.layer].points = player[this.layer].points.sub(this.cost()); - setBuyableAmount(this.layer, this.id, getBuyableAmount(this.layer, this.id).add(1)); - }, - unlocked: () => hasMilestone("flowers", 3) - } - }, - upgrades: { - rows: 1, - cols: 4, - nextChapter: { - title: "And those that carry us forward, are dreams.
", - description: "Close the time loop.", - unlocked: true, - onPurchase() { - showTab("none"); - player.chapter = 2; - player.timeSlots = new Decimal(1); - } - }, - 11: { - title: "A chain of beautiful flowers
", - description: "Increase collection speed based on how many flowers you have
", - cost: new Decimal(10), - effect: () => player.flowers.points.clampMin(1).pow(0.1).add(1), - unlocked: () => hasMilestone("flowers", 0), - effectDisplay() { - return `x${format(this.effect())}`; - } - }, - 12: { - title: "A big garland of flowers
", - description: "Increase collection speed based on your collecting flowers level", - cost: new Decimal(100), - effect: () => new Decimal(getJobLevel("flowers")).pow(2).div(10).add(1), - unlocked: () => hasMilestone("flowers", 0), - effectDisplay() { - return `x${format(this.effect())}`; - } - }, - 13: { - title: "Weena's Gift
", - description: "Increase experience gain based on real time spent collecting flowers", - cost: new Decimal(250), - effect: () => new Decimal(player.flowers.realTime).div(100).add(1), - unlocked: () => hasMilestone("flowers", 0), - effectDisplay() { - return `x${format(this.effect())}`; - } - }, - 14: { - title: "White Sphinx
", - description: "Increase flower collection based on the number of upgrades bought", - cost: new Decimal(500), - effect: () => Decimal.pow(1.5, player.flowers.upgrades.length), - unlocked: () => hasMilestone("flowers", 0), - effectDisplay() { - return `x${format(this.effect())}`; - } - } - } }); diff --git a/js/mod.js b/js/mod.js index 78affed..e455281 100644 --- a/js/mod.js +++ b/js/mod.js @@ -78,6 +78,6 @@ function maxTickLength() { function fixOldSave(oldVersion){ if (oldVersion === "0.0") { player.chapter = 1; + player.flowers.points = player.flowers.points.clampMax(1e9); } - console.log(oldVersion, player.chapter); } \ No newline at end of file diff --git a/style.css b/style.css index 6520468..55484bb 100644 --- a/style.css +++ b/style.css @@ -730,9 +730,59 @@ button > * { } } -@media only screen and (max-width: 720px) { +@media only screen and (max-width: 1200px) { .col.right { min-width: 100%; background: var(--background); } } + +.card { + padding: 10px; + background: darkcyan; + display: flex; + flex-direction: column; + justify-content: space-evenly; + box-shadow: black 4px 4px 8px 0px; + border-radius: 10px; + position: relative; + margin: 10px auto; +} + +.card:hover { + transform: scale(1.1); +} + +.card > span { + flex-basis: 30%; + display: flex; +} + +.card > img { + max-width: 50%; + position: absolute; + bottom: 10px; + left: 50%; + transform: translateX(-50%); + opacity: .5; +} + +.card h3 { + overflow: hidden; + text-overflow: ellipsis; + max-height: 100%; +} + +.flipCard { + animation: flip 1s; +} + +@keyframes flip { + 0% { + transform: rotateY(90deg); + } + + 100% { + transform: rotateY(0deg); + } +}