Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New AI Apoc feat Existential Risk #974

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davezatch
Copy link
Contributor

  • Unlocks with 10 unique species AI Apocalypse resets
  • New icon on unlock
  • Bonus: allows tracking AI Apoced species

Mostly I wanted to be able to track them, the feat is just icing on top :) Happy to take suggestions on icon, flavor text, etc

LoveBodhi added a commit to LoveBodhi/Evolve that referenced this pull request Oct 12, 2023
Copy link
Contributor

@Argavyon Argavyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of suggestions, but this seems otherwise neat.
Hasta la vista.

Comment on lines +638 to +642
let aiApocRaceCount = 0;

Object.keys(global.stats.synth).forEach(race => {
aiApocRaceCount++;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much simpler to go for

      const aiApocRaceCount = Object.keys(global.stats.synth).length;

Comment on lines +390 to +406
let checked = `<div class="flexed wide">`;
let avcounter = 0;
Object.keys(races).sort((a,b) => races[a].name.localeCompare(races[b].name)).forEach(function (key){
if (key !== 'protoplasm' && key !== 'nano' && key !== 'synth' && key !== 'junker'){
avcounter++;
if (global.stats.synth[key]){
checked = checked + `<span class="wide iclr${global.stats.synth[key]}">${races[key].name}</span>`;
}
else {
checked = checked + `<span class="wide has-text-danger">${races[key].name}</span>`;
}
}
});
checked = checked + `</div>`;
popover(`f-${feat}`,$(`<div class="wide has-text-label">${feats[feat].desc}</div><div>${loc(`wiki_feat_${feat}`)}</div>${checked}${flair}`),{
wide: true
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This avoids creating the string through concatenation, and instead uses string templates

        const noExistentialRisk = ['protoplasm', 'nano', 'synth', 'junker'];
        const existentialProgress = `<div class="flexed wide">${
            Object.keys(races)
                .filter( (race) => !noExistentialRisk.includes(race) )
                .map( (race) => ({ name: races[race].name, achieve: global.stats.synth[key] }) )
                .sort( (a, b) => a.name.localeCompare(b.name) )
                .map( (race) => `<span class="wide ${
                    race.achieve ? `iclr${race.achieve}` : 'has-text-danger'
                }">${race.name}</span>` )
                .join('')
        }</div>`;
        popover(`f-${feat}`,$(`<div class="wide has-text-label">${feats[feat].desc}</div><div>${loc(`wiki_feat_${feat}`)}</div>${existentialProgress}${flair}`),{
            wide: true
        });

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