Skip to content

Commit

Permalink
Updated to 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jackphilippi committed Jan 8, 2024
1 parent a0b0034 commit 98b4abb
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 41 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,20 @@ Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

### TODO
1. Allow selected options to be persistent (using localStorage)
2. Add some general help tooltips
3. Allow sorting of rows / hiding rows that aren't relevant attributes
[ ] Allow selected options to be persistent (using localStorage)
[x] Allow sorting of rows / hiding rows that aren't relevant attributes
[ ] Add proper priorities calculation for some digimon (i.e. when criteria for multiple digimon are met)

### Changelog
v0.1.1
Refactored codebase
Introduced new flag to hide irrelevant stats for evolutions
Flipped UI and updated help text

v0.1.2
Fixed issue where some digimon had the wrong bonus digimon criteria listed (Airdramon)
Fixed option flag for showing irrelevant stats
Added hover tooltips to all stats

### Contributing
If you'd like to contribute features to the codebase, feel free to open a pull request.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "digislots",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"homepage": "https://digislots.fippi.io",
"dependencies": {
Expand Down
35 changes: 18 additions & 17 deletions src/components/DigiSlotMachine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface Options {
showSpecialDigimon: boolean;
showOmitTags: boolean;
showInfoText: boolean;
showIrrelevant: boolean;
hideIrrelevant: boolean;
showSpoilers: boolean;
}

Expand All @@ -36,7 +36,7 @@ export default function DigiSlotMachine() {
showSpecialDigimon: false,
showOmitTags: false,
showInfoText: true,
showIrrelevant: true,
hideIrrelevant: true,
showSpoilers: false
});

Expand Down Expand Up @@ -98,11 +98,11 @@ export default function DigiSlotMachine() {

// TODO: Re-visit labels for battles and care
if (randomDigi.req.battles > 0) {
setLabels({ ...labels, battle: randomDigi.req.minBattles ? '≤' : '≥' });
setLabels(prevLabels => ({ ...prevLabels, battle: randomDigi.req.minBattles ? '≤' : '≥' }));
}

if (randomDigi.req.care > 0) {
setLabels({ ...labels, care: randomDigi.req.minCare ? '≤' : '≥' });
setLabels(prevLabels => ({ ...prevLabels, care: randomDigi.req.minCare ? '≤' : '≥' }));
}

const tableElem = document.getElementById('table-heading');
Expand Down Expand Up @@ -134,17 +134,6 @@ export default function DigiSlotMachine() {

// TODO: Hover over stats for details
return <StyledPanes>
<StyledPane>
<h2 id="table-heading">Target Digivolution Criteria</h2>
<p>The following table shows the required attributes that your digimon needs to meet in order to digivolve into the selected digimon.</p>
{rolledDigimon
? <RequirementsTable
rolledDigimon={rolledDigimon}
currentDigimon={currentDigimon}
labels={labels}
options={options} />
: <p className={'text-info'}>Click the Roll button to receive a random digimon's evolution targets</p>}
</StyledPane>
<StyledPane>
<h2>Your current Digimon: {currentDigimon && <StyledIcon src={`./imgs/${currentDigimon.name}.png`}/>}</h2>
<StyledSelect name="evolutions" value={currentDigimon.name} onChange={(e: any) => setCurrentDigimon(getDigimon(e.target.value as unknown as DigimonName))}>
Expand Down Expand Up @@ -199,8 +188,8 @@ export default function DigiSlotMachine() {
defaultChecked={options.showInfoText}
id="irrel-switch"
label="Hide stats that aren't needed for evolution"
value={options.showIrrelevant}
onClick={() => toggleOption('showIrrelevant')}
value={options.hideIrrelevant}
onClick={() => toggleOption('hideIrrelevant')}
/>
<hr/>
<FormCheck
Expand All @@ -214,6 +203,18 @@ export default function DigiSlotMachine() {
</Alert>}
{options.showInfoText && <InfoCard />}
</StyledPane>
<StyledPane>
<h2 id="table-heading">Target Digivolution Criteria</h2>
<p>The following table shows the required attributes that your digimon needs to meet in order to digivolve into the selected digimon.</p>
{rolledDigimon
? <RequirementsTable
rolledDigimon={rolledDigimon}
currentDigimon={currentDigimon}
labels={labels}
options={options} />
: <p className={'text-info'}>Click the "Roll" button to receive a random digimon's evolution requirements</p>}

</StyledPane>
</StyledPanes>;

}
34 changes: 17 additions & 17 deletions src/components/RequirementsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ interface RowProps {
title: string,
value: any,
tooltipText: string,
label?: string
label?: string,
hideIrrelevant?: boolean
}


function StatRow(props: RowProps) {
if (!props.value) {
if (props.hideIrrelevant && !props.value) {
return <></>
}
return <tr className={props.class}>
Expand All @@ -40,7 +40,7 @@ function StatRow(props: RowProps) {

export default function RequirementsTable(props: ReqTableProps) {
const { options, rolledDigimon, currentDigimon, labels } = props;

const {hideIrrelevant} = options;
if (!rolledDigimon) return <></>

return rolledDigimon && <Table striped bordered hover>
Expand All @@ -53,19 +53,19 @@ export default function RequirementsTable(props: ReqTableProps) {
<th>Type</th>
<td>{options.showSpoilers ? <>{getTypeIcon(rolledDigimon.type)} {Type[rolledDigimon?.type]}</> : '???'}</td>
</tr>
<StatRow title="Level" class='table-secondary' value={Level[rolledDigimon.level]} tooltipText="The evolutionary stage of the Digimon."/>
<StatRow title="HP" class='table-info' value={rolledDigimon.req.hp} tooltipText="Your digimon's health. Increased by HP training at the Gym."/>
<StatRow title="MP" class='table-info' value={rolledDigimon.req.mp} tooltipText="Your digimon's magic points. Increased by MP training at the Gym."/>
<StatRow title="OFFENSE" class='table-info' value={rolledDigimon.req.offense} tooltipText="Improves damage from your attacks. Increased by offense training at the Gym."/>
<StatRow title="DEFENSE" class='table-info' value={rolledDigimon.req.defense} tooltipText="Reduces damage taken from attacks. Increased by defense training at the Gym."/>
<StatRow title="SPEED" class='table-info' value={rolledDigimon.req.speed} tooltipText="Affects how often your digimon attacks. Increased by speed training at the Gym."/>
<StatRow title="BRAINS" class='table-info' value={rolledDigimon.req.brains} tooltipText="Unlocks more options for guiding your digimon during battle. Increased by brain training at the Gym."/>
<StatRow title="CARE MISTAKES" class='table-primary' label={labels.care} value={rolledDigimon.req.care} tooltipText="Ignoring your food, poop or sleep bubbles will cause a care mistake." />
<StatRow title="WEIGHT" class='table-danger' value={rolledDigimon.req.weight} tooltipText="Weight is gained when digimon is fed food. Weight is lost over time and when exercising."/>
<StatRow title="DISCIPLINE" class='table-warning' value={rolledDigimon.req.discipline} tooltipText="The digimon's discipline value. The higher the better."/>
<StatRow title="HAPPINESS" class='table-warning' value={rolledDigimon.req.happiness} tooltipText="The digimon's happiness value. The higher the better."/>
<StatRow title="BATTLES" class='table-warning' label={labels.battle} value={rolledDigimon.req.battles} tooltipText="The total number of battles that the digimon has fought."/>
<StatRow title="TECHNIQUES" class='table-warning' value={rolledDigimon.req.techs} tooltipText="The total number of techniques that the digimon has learned."/>
<StatRow hideIrrelevant={hideIrrelevant} title="Level" class='table-secondary' value={Level[rolledDigimon.level]} tooltipText="The evolutionary stage of the Digimon."/>
<StatRow hideIrrelevant={hideIrrelevant} title="HP" class='table-info' value={rolledDigimon.req.hp} tooltipText="Your digimon's health. Increased by HP training at the Gym."/>
<StatRow hideIrrelevant={hideIrrelevant} title="MP" class='table-info' value={rolledDigimon.req.mp} tooltipText="Your digimon's magic points. Increased by MP training at the Gym."/>
<StatRow hideIrrelevant={hideIrrelevant} title="OFFENSE" class='table-info' value={rolledDigimon.req.offense} tooltipText="Improves damage from your attacks. Increased by offense training at the Gym."/>
<StatRow hideIrrelevant={hideIrrelevant} title="DEFENSE" class='table-info' value={rolledDigimon.req.defense} tooltipText="Reduces damage taken from attacks. Increased by defense training at the Gym."/>
<StatRow hideIrrelevant={hideIrrelevant} title="SPEED" class='table-info' value={rolledDigimon.req.speed} tooltipText="Affects how often your digimon attacks. Increased by speed training at the Gym."/>
<StatRow hideIrrelevant={hideIrrelevant} title="BRAINS" class='table-info' value={rolledDigimon.req.brains} tooltipText="Unlocks more options for guiding your digimon during battle. Increased by brain training at the Gym."/>
<StatRow hideIrrelevant={hideIrrelevant} title="CARE MISTAKES" class='table-primary' label={labels.care} value={rolledDigimon.req.care} tooltipText="Ignoring your food, poop or sleep bubbles will cause a care mistake." />
<StatRow hideIrrelevant={hideIrrelevant} title="WEIGHT" class='table-danger' value={rolledDigimon.req.weight} tooltipText="Weight is gained when digimon is fed food. Weight is lost over time and when exercising."/>
<StatRow hideIrrelevant={hideIrrelevant} title="DISCIPLINE" class='table-warning' value={rolledDigimon.req.discipline} tooltipText="The digimon's discipline value. The higher the better."/>
<StatRow hideIrrelevant={hideIrrelevant} title="HAPPINESS" class='table-warning' value={rolledDigimon.req.happiness} tooltipText="The digimon's happiness value. The higher the better."/>
<StatRow hideIrrelevant={hideIrrelevant} title="BATTLES" class='table-warning' label={labels.battle} value={rolledDigimon.req.battles} tooltipText="The total number of battles that the digimon has fought."/>
<StatRow hideIrrelevant={hideIrrelevant} title="TECHNIQUES" class='table-warning' value={rolledDigimon.req.techs} tooltipText="The total number of techniques that the digimon has learned."/>
{rolledDigimon.digimonBonus === currentDigimon.name && <StatRow title="DIGIMON BONUS" class='table-warning' value={rolledDigimon.digimonBonus} tooltipText="Your digimon gets a free natural bonus point towards this digivolution"/>}
</tbody>
</Table>
Expand Down
4 changes: 4 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ body {

th {
text-align: left;
}

tr.table-primary > th, tr.table-info > th, tr.table-warning > th, tr.table-danger > th {
cursor: help;
}
7 changes: 4 additions & 3 deletions src/models/DigimonList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export const digimonList = [
Level.Rookie,
Type.Vaccine,
new EvolutionRequirements(0, 1000, 0, 0, 0, 0, 3, 20, 0, 50, 0, 28, false, false),
[DigimonName.Greymon, DigimonName.Meramon, DigimonName.Birdramon, DigimonName.Centarumon, DigimonName.Monochromon, DigimonName.Tyrannomon, DigimonName.Numemon, DigimonName.Nanimon, DigimonName.Sukamon]
[DigimonName.Greymon, DigimonName.Meramon, DigimonName.Birdramon, DigimonName.Centarumon, DigimonName.Monochromon, DigimonName.Tyrannomon, DigimonName.Numemon, DigimonName.Nanimon, DigimonName.Sukamon],
/* Bonus */ DigimonName.Koromon
),
// Betamon
new Digimon(
Expand Down Expand Up @@ -154,15 +155,15 @@ export const digimonList = [
Type.Vaccine,
new EvolutionRequirements(10, 10, 1, 0, 0, 0, 0, 15, 0, 0, 0, 0, false, false),
[DigimonName.Megadramon, DigimonName.Phoenixmon, DigimonName.Vademon, DigimonName.Sukamon],
/* Bonus */ DigimonName.Koromon
),
// Angemon
new Digimon(
DigimonName.Angemon,
Level.Champion,
Type.Vaccine,
new EvolutionRequirements(2000, 4000, 200, 400, 200, 400, 5, 40, 95, 0, 30, 30, true, false),
[DigimonName.Andromon, DigimonName.Phoenixmon, DigimonName.Devimon, DigimonName.Vademon, DigimonName.Sukamon]
[DigimonName.Andromon, DigimonName.Phoenixmon, DigimonName.Devimon, DigimonName.Vademon, DigimonName.Sukamon],
/* Bonus */ DigimonName.Patamon
),
// Bakemon
new Digimon(
Expand Down

0 comments on commit 98b4abb

Please sign in to comment.