Skip to content

Commit

Permalink
use markdown for descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
lstrzebinczyk authored and Floppy committed Oct 15, 2021
1 parent de4c69b commit 021fabc
Show file tree
Hide file tree
Showing 28 changed files with 1,306 additions and 286 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@
"react-bootstrap-slider": "^3.0.0",
"react-dom": "^16.13.1",
"react-dropzone": "^11.4.2",
"react-markdown": "^7.0.1",
"react-router-dom": "^5.3.0",
"react-string-replace": "^0.4.4",
"rehype-raw": "^6.1.0",
"remark-gfm": "^3.0.0",
"typescript": "^4.4.4",
"uuid": "^8.3.2",
"xmldom-ts": "^0.3.1",
Expand Down
27 changes: 27 additions & 0 deletions src/components/KillTeam2021/CompileDescription.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'
import ReactMarkdown from 'react-markdown'
import { HighlightedText } from './HighlightedText'
import ReactDOMServer from 'react-dom/server'
import rehypeRaw from 'rehype-raw'
import remarkGfm from 'remark-gfm'

interface Props {
children: string
}

export function CompileDescription (props: Props) {
const descriptionWithHighlightedSymbols = <HighlightedText>{props.children}</HighlightedText>

return (
<ReactMarkdown
skipHtml
rehypePlugins={[rehypeRaw]}
remarkPlugins={[remarkGfm]}
components={{
table: ({ node, ...props }) => <table className='table table-sm table-striped table-bordered' {...props} />
}}
>
{ReactDOMServer.renderToStaticMarkup(descriptionWithHighlightedSymbols)}
</ReactMarkdown>
)
}
44 changes: 4 additions & 40 deletions src/components/KillTeam2021/PloysColumn.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Ploy } from '../../types/KillTeam2021'
import { Card, Col, Table } from 'react-bootstrap'
import { HighlightedText } from './HighlightedText'
import { Card, Col } from 'react-bootstrap'
import { CompileDescription } from './CompileDescription'

interface Props {
ploys: Ploy[]
Expand All @@ -17,43 +17,7 @@ export function PloysColumn (props: Props) {
<span>{x.cost}CP</span>
</Card.Header>
<Card.Body>
<p>
<HighlightedText>{x.description}</HighlightedText>
</p>
{(x.weapon != null)
? <Table striped bordered size='sm'>
<thead>
<tr>
<th>A</th>
<th>WS</th>
<th>D</th>
<th>SR</th>
<th>!</th>
</tr>
</thead>
<tbody>
<tr>
<td>{x.weapon.attacks}</td>
<td>{x.weapon.hit}+</td>
<td>{x.weapon.damage}/{x.weapon.criticalDamage}</td>
<td><HighlightedText>{x.weapon.specialRules}</HighlightedText></td>
<td><HighlightedText>{x.weapon.criticalRules}</HighlightedText></td>
</tr>
</tbody>
</Table>
: <></>}
{
(x.options != null) &&
<ul>
{x.options.map(line => <li><HighlightedText>{line}</HighlightedText></li>)}
</ul>
}
{
x.postOptionText &&
<p>
<HighlightedText>{x.postOptionText}</HighlightedText>
</p>
}
<CompileDescription>{x.description}</CompileDescription>
{
(x.action != null) &&
<p>
Expand All @@ -63,7 +27,7 @@ export function PloysColumn (props: Props) {
<span>{x.action.cost}AP</span>
</Card.Header>
<Card.Body>
<HighlightedText>{x.action.description}</HighlightedText>
<CompileDescription>{x.action.description}</CompileDescription>
</Card.Body>
</Card>
</p>
Expand Down
13 changes: 3 additions & 10 deletions src/components/KillTeam2021/TacOpsList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { TacOp } from '../../types/KillTeam2021'
import { Card, Row, Col } from 'react-bootstrap'
import { HighlightedText } from './HighlightedText'
import { CompileDescription } from './CompileDescription'

interface Props {
tacOps: TacOp[]
Expand All @@ -18,14 +18,7 @@ export function TacOpsList (props: Props) {
<span>{x.name}</span>
</Card.Header>
<Card.Body>
<p>
{x.revealTime}
</p>
<p>
<ul>
{x.description.map(line => <li><HighlightedText>{line}</HighlightedText></li>)}
</ul>
</p>
<CompileDescription>{x.description}</CompileDescription>
{
(x.action != null) &&
<>
Expand All @@ -39,7 +32,7 @@ export function TacOpsList (props: Props) {
<span>{x.action.cost}AP</span>
</Card.Header>
<Card.Body>
<HighlightedText>{x.action.description}</HighlightedText>
<CompileDescription>{x.action.description}</CompileDescription>
</Card.Body>
</Card>
</p>
Expand Down
37 changes: 37 additions & 0 deletions src/components/KillTeam2021/data.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { data } from './data'

const keywords = ['Dash', 'Fight', 'Charge', 'Shoot', 'Overwatch', 'Normal Move', 'Fall Back']

describe('faction data', () => {
it('has all the keywords bold', () => {
for (const factionData of data) {
for (const ployData of factionData.strategicPloys) {
for (const keyword of keywords) {
if (ployData.description.includes(keyword)) {
expect(ployData.description).toContain(`**${keyword}**`)
}
}
}

for (const ployData of factionData.tacticalPloys) {
for (const keyword of keywords) {
if (ployData.description.includes(keyword)) {
expect(ployData.description).toContain(`**${keyword}**`)
}
}
}

// @ts-expect-error
if (factionData.tacOps !== undefined) {
// @ts-expect-error
for (const opsData of factionData.tacOps) {
for (const keyword of keywords) {
if (opsData.description.includes(keyword) === true) {
expect(opsData.description).toContain(`**${keyword}**`)
}
}
}
}
}
})
})
8 changes: 3 additions & 5 deletions src/components/KillTeam2021/data/broodCoven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ const strategicPloys: Ploy[] = [
name: 'Lurk in the shadows',
cost: 1,
description: `Until the end of the Turning Point, each time a shooting attack is made against a friendly BROOD COVEN💀 operative, in the Roll Defence Dice step of that shooting attack,
before rolling your defence dice, if it is in Cover and either has a Conceal order or is ready, you can do one of the following:`,
options: [
'One additional dice can be retained as a successful normal save as a result of Cover.',
'Retain one dice as a successful critical save as a result of Cover instead of a normal save.'
]
before rolling your defence dice, if it is in Cover and either has a Conceal order or is ready, you can do one of the following:
- One additional dice can be retained as a successful normal save as a result of Cover.
- Retain one dice as a successful critical save as a result of Cover instead of a normal save.`
}
]

Expand Down
14 changes: 6 additions & 8 deletions src/components/KillTeam2021/data/cadreMercenary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const strategicPloys: Ploy[] = [
{
name: 'Hunting call',
cost: 1,
description: 'Until the end of the Turning Point, each time a friendly CADRE MERCENARY💀 operative performs a Fight action, in the Roll Attack Dice step of that combat, you can re-roll one of your attack dice.'
description: 'Until the end of the Turning Point, each time a friendly CADRE MERCENARY💀 operative performs a **Fight** action, in the Roll Attack Dice step of that combat, you can re-roll one of your attack dice.'
}, {
name: 'Patient stalkers',
cost: 1,
description: 'Until the end of the Turning Point, friendly CADRE MERCENARY💀 operatives can perform a Charge action while they have a Conceal order.'
description: 'Until the end of the Turning Point, friendly CADRE MERCENARY💀 operatives can perform a **Charge** action while they have a Conceal order.'
}, {
name: 'Fieldcraft',
cost: 1,
Expand All @@ -37,12 +37,10 @@ const tacticalPloys: Ploy[] = [
}, {
name: 'Brute Strength',
cost: 1,
description: 'Use this Tactical Ploy in the Firefight phase, when a friendly KROOTOX operative performs a Normal Move, Dash, Fall Back or Charge action. Until the end of that activation:',
options: [
'That operative can move through Light parts of a terrain feature as if they were not there.',
`That operative can move around, across and over other operatives (and their bases) as if they were not there,
but must finish the move following all requirements specified by that move, and cannot finish its move on top of other operatives (or their bases).`
]
description: `Use this Tactical Ploy in the Firefight phase, when a friendly KROOTOX operative performs a **Normal Move**, **Dash**, **Fall Back** or **Charge** action. Until the end of that activation:
- That operative can move through Light parts of a terrain feature as if they were not there.
- That operative can move around, across and over other operatives (and their bases) as if they were not there,
but must finish the move following all requirements specified by that move, and cannot finish its move on top of other operatives (or their bases).`
}
]

Expand Down
18 changes: 8 additions & 10 deletions src/components/KillTeam2021/data/chaosDaemons.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Archetype, FireteamArchetypes, Ploy } from '../../../types/KillTeam2021';
import { Archetype, FireteamArchetypes, Ploy } from '../../../types/KillTeam2021'

const archetypes: FireteamArchetypes = {
'Bloodletter Fire Team': [Archetype.SEEK_AND_DESTROY],
Expand All @@ -16,7 +16,7 @@ const strategicPloys: Ploy[] = [
}, {
name: 'Quicksilver Swiftness',
cost: 1,
description: 'Until the end of the Turning Point, each time a friendly SLAANESH operative is activated, it can perform a free Dash action during that activation.'
description: 'Until the end of the Turning Point, each time a friendly SLAANESH operative is activated, it can perform a free **Dash** action during that activation.'
}, {
name: 'Glistening Barrage',
cost: 1,
Expand All @@ -42,14 +42,12 @@ const tacticalPloys: Ploy[] = [
}, {
name: 'Split',
cost: 0,
description: `Use this Tactical Ploy when a friendly PINK HORROR operative is incapacitated for 2CP, or when a friendly BLUE HORROR operative is incapacitated for 1CP.`,
options: [
'Before that PINK HORROR operative is removed from the killzone, set up two BLUE HORROR operatives as close as possible to that operative and not within Engagement Range of enemy operatives',
`Before that BLUE HORROR operative is removed from the killzone, set up one BRIMESTONE HORRORS operative as close as possible to that operative and not within Engagement Range of enemy
operatives.`
],
postOptionText: `In either case, set up those operatives with the same order as the previous operative (including if it was ready or activated). In narrative play, any operatives set up as a
result of this Tactical Ploy are no longer part of your kill team after the game.`
description: `Use this Tactical Ploy when a friendly PINK HORROR operative is incapacitated for 2CP, or when a friendly BLUE HORROR operative is incapacitated for 1CP.
- Before that PINK HORROR operative is removed from the killzone, set up two BLUE HORROR operatives as close as possible to that operative and not within Engagement Range of enemy operatives
- Before that BLUE HORROR operative is removed from the killzone, set up one BRIMESTONE HORRORS operative as close as possible to that operative and not within Engagement Range of enemy
In either case, set up those operatives with the same order as the previous operative (including if it was ready or activated).
In narrative play, any operatives set up as a result of this Tactical Ploy are no longer part of your kill team after the game`
}
]

Expand Down
28 changes: 12 additions & 16 deletions src/components/KillTeam2021/data/commorrite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@ const strategicPloys: Ploy[] = [
{
name: 'Fleet',
cost: 1,
description: 'Until the end of the Turning Point, each time a friendly COMMORRITE💀 operative performs a Fall Back or Normal Move action, it can perform a free Dash action with that action.'
description: 'Until the end of the Turning Point, each time a friendly COMMORRITE💀 operative performs a **Fall Back** or **Normal Move** action, it can perform a free **Dash** action with that action.'
}, {
name: 'Agile Gladiators',
cost: 1,
description: `Until the end of the Turning Point, each time a friendly WYCH operative fights in combat, in the Resolve Successful Hits step of that combat, each time your opponent strikes
with a normal hit, you can roll one D6: on a 4+, treat that strike as a parry instead. In addition, each time a friendly WYCH operative performs any kind of move:`,
options: [
`It can move around, across and over other operatives (and their bases) as if they were not there, but must finish the move following all requirements specified by that move, and
cannot finish its move on top of other operatives (or their bases).`,
'It can ignore the first ⬤ distance it travels when climbing, traversing and dropping.',
'It automatically passes jump tests.'
]
with a normal hit, you can roll one D6: on a 4+, treat that strike as a parry instead. In addition, each time a friendly WYCH operative performs any kind of move:
- It can move around, across and over other operatives (and their bases) as if they were not there, but must finish the move following all requirements specified by that move, and
cannot finish its move on top of other operatives (or their bases).
- It can ignore the first ⬤ distance it travels when climbing, traversing and dropping.
- It automatically passes jump tests.`
}, {
name: 'Prey On The Weak',
cost: 1,
Expand All @@ -39,17 +37,15 @@ const tacticalPloys: Ploy[] = [
name: 'Power From Pain',
cost: 1,
description: `Use this Tactical Ploy when an enemy operative is incapacitated. Before it is removed from the killzone, select on ready friendly COMMORRITE💀 operative that enemy operative
is within ⬟ of and Visible to. After the current activation:`,
options: [
'You can activate that ready friendly operative.',
'Add 1 to its APL',
'During its next activation, it can perform Shoot or Fight actions twice, instead of once.'
]
is within ⬟ of and Visible to. After the current activation:
- You can activate that ready friendly operative.
- Add 1 to its APL
- During its next activation, it can perform **Shoot** or **Fight** actions twice, instead of once.`
}, {
name: 'No Escape',
cost: 1,
description: `Use this Tactical Ploy when a Fall Back action is declared for an enemy operative within Engagement Range of a friendly WYCH operative. Roll one D6, subtracting 1 if that enemy
operative has a higher Wounds characteristic than that WYCH operative, and adding 1 if that enemy operative is injured. On a 3+, that enemy operative cannot Fall Back, but the
description: `Use this Tactical Ploy when a **Fall Back** action is declared for an enemy operative within Engagement Range of a friendly WYCH operative. Roll one D6, subtracting 1 if that enemy
operative has a higher Wounds characteristic than that WYCH operative, and adding 1 if that enemy operative is injured. On a 3+, that enemy operative cannot **Fall Back**, but the
action points subtracted are not refunded.`
}
]
Expand Down
12 changes: 5 additions & 7 deletions src/components/KillTeam2021/data/craftworld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const strategicPloys: Ploy[] = [
{
name: 'Fleet',
cost: 1,
description: 'Until the end of the Turning Point, each time a friendly CRAFTWORLD💀 operative performs a Fall Back or Normal Move action, it can perform a free Dash action with that action.'
description: 'Until the end of the Turning Point, each time a friendly CRAFTWORLD💀 operative performs a **Fall Back** or **Normal Move** action, it can perform a free **Dash** action with that action.'
}, {
name: 'Forewarned',
cost: 1,
Expand All @@ -25,7 +25,7 @@ const strategicPloys: Ploy[] = [
}, {
name: 'Hidden Paths',
cost: 1,
description: `Each friendly RANGER operative that has a Conceal order, is within ▲ of Light or Heavy terrain and is more than ⬟ from enemy operatives can immediately perform a free Dash
description: `Each friendly RANGER operative that has a Conceal order, is within ▲ of Light or Heavy terrain and is more than ⬟ from enemy operatives can immediately perform a free **Dash**
action, but must finish that move within ▲ of Light or Heavy terrain.`
}
]
Expand All @@ -34,11 +34,9 @@ const tacticalPloys: Ploy[] = [
{
name: 'Matchless Agility',
cost: 1,
description: 'Use this Tactical Ploy when a friendly CRAFTWORLD💀 operative is activated. Until the end of that operative\'s activation:',
options: [
'It cannot perform a Shoot or Fight action.',
'If it performs a Dash action, it can move an additional ⬤ for that action.'
]
description: `Use this Tactical Ploy when a friendly CRAFTWORLD💀 operative is activated. Until the end of that operative's activation:
- It cannot perform a **Shoot** or **Fight** action.
- If it performs a **Dash** action, it can move an additional ⬤ for that action.`
}, {
name: 'First of the Aspects',
cost: 1,
Expand Down
8 changes: 4 additions & 4 deletions src/components/KillTeam2021/data/deathGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ const strategicPloys: Ploy[] = [
{
name: 'Malicious Volleys',
cost: 1,
description: `Until the end of the Turning Point, each time a friendly BUBONIC ASTARTES operative is activated, if it does not perform a Fight action during that activation, it
can perform two Shoot actions during that activation if a bolt weapon is selected for each of those shooting attacks. A bolt weapon is a ranged weapon that includes
description: `Until the end of the Turning Point, each time a friendly BUBONIC ASTARTES operative is activated, if it does not perform a **Fight** action during that activation, it
can perform two **Shoot** actions during that activation if a bolt weapon is selected for each of those shooting attacks. A bolt weapon is a ranged weapon that includes
'bolt' in its name, e.g. boltgun, bolt pistol etc.`
}, {
name: 'Hateful Assault',
cost: 1,
description: `Until the end of the Turning Point, each time a friendly BUBONIC ASTARTES operative is activated, if it does not perform a Shoot action during that activation, it can
perform two Fight actions during that activation.`
description: `Until the end of the Turning Point, each time a friendly BUBONIC ASTARTES operative is activated, if it does not perform a **Shoot** action during that activation, it can
perform two **Fight** actions during that activation.`
}, {
name: 'Contagion',
cost: 1,
Expand Down
11 changes: 5 additions & 6 deletions src/components/KillTeam2021/data/ecclesiarchy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ const strategicPloys: Ploy[] = [
}, {
name: 'Extremis Trigger Word',
cost: 1,
description: 'Until the end of the Turning Point:',
options: [
'Each time a friendly ARCO-FLAGELLANT operative performs a Dash or Charge action, it can move an additional ▲ for that action',
'Arco-flails that friendly ARCO-FLAGELLANT operatives are equipped with gain the Lethal 5+ special rule.'
],
postOptionText: 'You can use this Strategic Ploy once'
description: `Until the end of the Turning Point:
- Each time a friendly ARCO-FLAGELLANT operative performs a **Dash** or **Charge** action, it can move an additional ▲ for that action
- Arco-flails that friendly ARCO-FLAGELLANT operatives are equipped with gain the Lethal 5+ special rule.
You can use this Strategic Ploy once`
}
]

Expand Down
Loading

0 comments on commit 021fabc

Please sign in to comment.