Skip to content
This repository has been archived by the owner on Mar 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #217 from RaenonX-DL/dev
Browse files Browse the repository at this point in the history
v2.10.1 Release
  • Loading branch information
RaenonX authored Jul 20, 2021
2 parents f3bca0e + 4316b85 commit 690b156
Show file tree
Hide file tree
Showing 30 changed files with 381 additions and 181 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,34 +121,3 @@ jobs:
.cypress/screenshots
.cypress/videos
if-no-files-found: error

deploy:
name: Deploy

if: success() && github.ref == 'refs/heads/main'

needs: [test, build]

runs-on: ubuntu-latest

steps:
- name: Configure SSH
env:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ~/.ssh/remote.key
chmod 600 ~/.ssh/remote.key
cat >>~/.ssh/config <<END
Host remote
HostName $SSH_HOST
User $SSH_USERNAME
IdentityFile ~/.ssh/remote.key
StrictHostKeyChecking no
END
- name: Deploy
run: |
ssh remote './deploy.sh ${{ github.repository }}'
12 changes: 10 additions & 2 deletions doc/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ such as [quick reference](/doc/quickReference.md).

`[R]` means required; `[O]` means optional.

**These syntaxes must not nest with general markdown syntaxes.

### Text coloring

```
Expand Down Expand Up @@ -76,6 +74,16 @@ Show the expression and the result in 2 decimals at the end:

> Both `*` and `x` mean multiply.
### Unit link

```
--<UnitID>/<Name>--
```

- `[R]` `<UnitID>` is the unit ID of the link.
- `[O]` `<Name>` is the named used for getting the ID.
- This will be the customized unit name instead of the real unit name.

#### References

Check [mathjs documentation](https://mathjs.org/docs/expressions/syntax.html)
Expand Down
2 changes: 1 addition & 1 deletion src/components/elements/gameData/ex/out/entry.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Co-ability output entry', () => {
it('renders unit name as a link to their analysis', async () => {
renderReact(() => (
<ExAbilityEntry
entry={generateExAbilityDataEntry()}
{...generateExAbilityDataEntry()}
conditionEnums={conditionEnumMap}
/>
));
Expand Down
46 changes: 26 additions & 20 deletions src/components/elements/gameData/ex/out/entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,46 @@ import Row from 'react-bootstrap/Row';

import {CharaExAbilityDataEntry, ConditionEnumMap, DepotPaths} from '../../../../../api-def/resources';
import {useI18n} from '../../../../../i18n/hook';
import {Optional} from '../../../../../utils/types';
import {ImageWithOverlay} from '../../../common/image';
import {UnitLink} from '../../unitInfo/link';
import {ExAbility} from './exUnit';


type ExAbilityEntryProps = {
entry: CharaExAbilityDataEntry
type ExAbilityEntryProps = Optional<CharaExAbilityDataEntry, 'chara'> & {
conditionEnums: ConditionEnumMap,
}

export const ExAbilityEntry = ({entry, conditionEnums}: ExAbilityEntryProps) => {
export const ExAbilityEntry = ({chara, ex, chainedEx, conditionEnums}: ExAbilityEntryProps) => {
const {t, lang} = useI18n();

const charaName = entry.chara.name[lang];
const charaIconURL = DepotPaths.getCharaIconURL(entry.chara.iconName);

return (
<div className="rounded bg-black-32 p-2 mb-2">
<Row noGutters className="align-items-center">
<Col xs="auto">
<ImageWithOverlay src={charaIconURL} text={charaName} style={{height: '3rem'}}/>
</Col>
<Col className="text-center">
<UnitLink
unit={{id: entry.chara.id, name: entry.chara.name[lang]}}
style={{fontSize: '1.1rem'}}
/>
</Col>
</Row>
<hr className="m-1"/>
{
chara &&
<>
<Row noGutters className="align-items-center">
<Col xs="auto">
<ImageWithOverlay
src={DepotPaths.getCharaIconURL(chara.iconName)}
text={chara.name[lang]}
style={{height: '3rem'}}
/>
</Col>
<Col className="text-center">
<UnitLink
unit={{id: chara.id, name: chara.name[lang]}}
style={{fontSize: '1.1rem'}}
/>
</Col>
</Row>
<hr className="m-1"/>
</>
}
<Row noGutters>
<Col>
<ExAbility
effectUnits={entry.ex}
effectUnits={ex}
name={t((t) => t.game.ex.name.exAbility)}
description={t((t) => t.game.ex.desc.exAbility)}
conditionEnums={conditionEnums}
Expand All @@ -49,7 +55,7 @@ export const ExAbilityEntry = ({entry, conditionEnums}: ExAbilityEntryProps) =>
<Row noGutters>
<Col>
<ExAbility
effectUnits={entry.chainedEx}
effectUnits={chainedEx}
name={t((t) => t.game.ex.name.chainedExAbility)}
description={t((t) => t.game.ex.desc.chainedExAbility)}
conditionEnums={conditionEnums}
Expand Down
5 changes: 4 additions & 1 deletion src/components/elements/gameData/ex/out/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export const ExAbilityOutput = ({exAbilityData, conditionEnums, inputData}: Outp
...exAbilityData
.map((exAbilityData: CharaExAbilityDataEntry, index: number) => (
<Col key={index} lg={6}>
<ExAbilityEntry entry={exAbilityData} conditionEnums={conditionEnums}/>
<ExAbilityEntry
{...exAbilityData}
conditionEnums={conditionEnums}
/>
</Col>
)),
);
Expand Down
9 changes: 9 additions & 0 deletions src/components/elements/gameData/skillAtk/in/filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ export const Filter = ({
},
],
},
{
type: 'inputNumber',
title: t((t) => t.game.skillAtk.input.filter.ssCostMax.name),
description: t((t) => t.game.skillAtk.input.filter.ssCostMax.desc),
getValue: (inputData) => inputData.filter.ssCostMax,
getUpdatedInputData: (newValue) => (
overwriteInputData(inputData, {filter: {ssCostMax: newValue}})
),
},
]}
/>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/elements/gameData/skillAtk/in/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export type InputData = {
sharedOnly: boolean,
dispelOnly: boolean,
type: Array<UnitType>,
ssCostMax: number,
},
display: {
actualDamage: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const overwriteInputData = (original: InputData, overwrite: DeepPartial<I
sharedOnly: overwrite.filter?.sharedOnly ?? original.filter.sharedOnly,
dispelOnly: overwrite.filter?.dispelOnly ?? original.filter.dispelOnly,
type: overwrite.filter?.type ?? original.filter.type,
ssCostMax: overwrite.filter?.ssCostMax ?? original.filter.ssCostMax,
},
display: {
actualDamage: overwrite.display?.actualDamage ?? original.display.actualDamage,
Expand Down Expand Up @@ -133,6 +134,7 @@ export const generateInputData = (overwrite?: DeepPartial<InputData>): InputData
sharedOnly: false,
dispelOnly: false,
type: [],
ssCostMax: 0,
},
display: {
actualDamage: false,
Expand Down
21 changes: 11 additions & 10 deletions src/components/elements/gameData/skillAtk/out/entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import {DistributionBar} from '../../../charts';
import {ConditionBadges} from '../../elements/conditionBadges';
import {InputData} from '../in/types';
import {EnumDataPack} from './props';
import {SectionAffliction} from './sections/affliction';
import {SectionAdditional} from './sections/additional';
import {SectionAnimation} from './sections/animation';
import {SectionBadges} from './sections/badges';
import {SectionImageIcon} from './sections/icon';
import {SectionSkillDamage} from './sections/skillDamage';
import {SectionSkillInfo} from './sections/skillInfo';
Expand All @@ -18,7 +17,7 @@ import {SectionSpInfo} from './sections/sp/main';
import {CalculatedSkillEntry} from './types';


type SkillEntryProps = EnumDataPack & {
export type SkillEntryProps = EnumDataPack & {
displayConfig: InputData['display'],
calculatedData: CalculatedSkillEntry,
}
Expand Down Expand Up @@ -46,6 +45,10 @@ export const AttackingSkillEntry = ({
displayConfig.damageInfo &&
<Col xs="auto" sm="auto" className="text-right my-auto">
<SectionSkillInfo atkSkillEntry={atkSkillEntry} calculatedData={calculatedData}/>
{
!displayConfig.actualDamage &&
<ConditionBadges conditionCodes={calculatedData.skillEntry.condition}/>
}
</Col>
}
{
Expand All @@ -64,13 +67,11 @@ export const AttackingSkillEntry = ({
</Col>
</Row>
}
<Row>
{
displayConfig.affliction &&
<SectionAffliction atkSkillEntry={atkSkillEntry} statusEnums={statusEnums}/>
}
<SectionBadges atkSkillEntry={atkSkillEntry}/>
</Row>
<SectionAdditional
atkSkillEntry={atkSkillEntry}
statusEnums={statusEnums}
displayConfig={displayConfig}
/>
{
displayConfig.animationInfo &&
<SectionAnimation atkSkillEntry={atkSkillEntry} skillEnums={skillEnums} conditionEnumMap={conditionEnumMap}/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from 'react';

import Col from 'react-bootstrap/Col';
import Row from 'react-bootstrap/Row';

import {getBadgesBuffCount} from '../badges/buffCount';
import {getBadgesBuffZone} from '../badges/buffZone';
import {getBadgesCrisisMod} from '../badges/crisisMod';
import {getBadgesDispel} from '../badges/dispel';
import {SkillEntryProps} from '../entry';
import {EnumDataPack, SectionProps} from '../props';
import {SectionAffliction} from './affliction';


type Props = SectionProps & Pick<EnumDataPack, 'statusEnums'> & Pick<SkillEntryProps, 'displayConfig'>

export const SectionAdditional = ({atkSkillEntry, displayConfig, statusEnums}: Props) => {
let badges: Array<React.ReactElement> = [];

badges = badges.concat(getBadgesBuffCount(atkSkillEntry));
badges = badges.concat(getBadgesBuffZone(atkSkillEntry));
badges = badges.concat(getBadgesDispel(atkSkillEntry));
badges = badges.concat(getBadgesCrisisMod(atkSkillEntry));

return (
<>
{
!displayConfig.actualDamage && (!!atkSkillEntry.skill.afflictions.length || !!badges.length) &&
<hr className="my-1"/>
}
<Row>
{
displayConfig.affliction &&
<SectionAffliction atkSkillEntry={atkSkillEntry} statusEnums={statusEnums}/>
}
{
!!badges.length &&
<Col lg className="text-left text-lg-right my-auto">
{badges.map((badge: React.ReactElement, index: number) => (
<React.Fragment key={index}>
{index > 0 && ' '}
{badge}
</React.Fragment>
))}
</Col>
}
</Row>
</>
);
};
38 changes: 0 additions & 38 deletions src/components/elements/gameData/skillAtk/out/sections/badges.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type SectionSkillInfoProps = SectionProps & {
export const SectionSkillInfo = ({atkSkillEntry, calculatedData}: SectionSkillInfoProps) => (
<>
<span className="h5">{`${(calculatedData.skillDamage.totalMods * 100).toFixed(0)}%`}</span>
<br/>
&nbsp;
<small>{atkSkillEntry.skill.hitsMax}&nbsp;HIT</small>
</>
);
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,35 @@ describe('Filter ATK skill entries', () => {
expect(dataFiltered.map((entry) => entry.unit.element === afflictionEnumCode)).not.toContain(false);
});
});

it('returns skills <= specific ss cost', async () => {
const dataFiltered = filterSkillEntries(
{
...inputDataTemplate,
filter: {
...inputDataTemplate.filter,
ssCostMax: 4,
},
},
data,
);
expect(dataFiltered.length).toBeGreaterThan(0);
expect(dataFiltered.map((entry) => entry.skill.ssCost <= 4)).not.toContain(false);
});

it('does not filter by SS cost if max set to 0', async () => {
const dataFiltered = filterSkillEntries(
{
...inputDataTemplate,
filter: {
...inputDataTemplate.filter,
ssCostMax: 0,
},
},
data,
);
expect(data.length).toBe(dataFiltered.length);
});
});

describe('Sort ATK skill entries', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export const filterSkillEntries = (inputData: InputData, atkSkillEntries: Array<
});
}

// Filter SS <= given cost
if (inputData.filter.ssCostMax) {
atkSkillEntries = atkSkillEntries
.filter((entry) => entry.skill.ssCost <= inputData.filter.ssCostMax);
}

return atkSkillEntries;
};

Expand Down
Loading

0 comments on commit 690b156

Please sign in to comment.