Public
Edited
Jan 22, 2023
1 fork
Insert cell
Insert cell
defense = new Dice([Dice.black])
Insert cell
Insert cell
Insert cell
Insert cell
plasteelStaff = new Weapon({
dice: [ Dice.green, Dice.yellow ],
surges: [ { damage: 1 }, /*{ stun: 1 }*/ ]
})
Insert cell
ancientLightsaber = new Weapon({
dice: [ Dice.blue, Dice.green, Dice.yellow ],
surges: [ { damage: 2 }, { damage: 1, pierce: 3, surge: -2 } ]
})
Insert cell
ancientLightsaberWounded = new Weapon({
dice: [ Dice.blue, Dice.green, Dice.red ],
surges: [ { damage: 2 }, { damage: 1, pierce: 3, surge: -2 } ]
})
Insert cell
dancingWeapon = ({
dice: [ Dice.blue ],
surges: [ { accuracy: 2, damage: 1 } ]
})
Insert cell
shockEmitter = ({ base: { damage: 1 }, surges: [ /* { stun: 1 } */ ] })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
valken38Carbine = new Weapon({
dice: [ Dice.blue, Dice.blue, Dice.red ],
base: { accuracy: 1 }, // sharpshooter
surges: [ { damage: 2 }, { accuracy: 2 } ],
})
Insert cell
plasmaCell = ({ base: { pierce: 1 }, surges: [ { damage: 1 } ] })
Insert cell
Insert cell
electrostaff = new Weapon({
dice: [ Dice.blue, Dice.red, Dice.green ],
base: { cleave: 2, damage: 2 },
surges: [ { damage: 2 } ]
})
Insert cell
balancedHilt = ({ base: { surge: 1 } })
Insert cell
allianceRangers = new Weapon({
base: { accuracy: 1 },
dice: [ Dice.blue, Dice.blue ],
surges: [ { damage: 2 }, { pierce: 1, }, { accuracy: 2 } ],
})
Insert cell
lines
.data(Object.entries({
'Alliance Rangers': allianceRangers,
})
.flatMap(([label, weapon]) => atLeast(simulate(weapon, defense), label)))
.encode(
vl.color().fieldN('label')
.legend({ title: false, orient: 'top' }),
)
.render()
Insert cell
Insert cell
focused = ({
dice: [ Dice.green ]
})
Insert cell
Insert cell
lines = vl.markLine({ point: true, tooltip: true, interpolate: 'monotone', size: 1 })
.encode(
vl.x().fieldQ('damage').scale({ domain: [0, 10] }).axis({ tickCount: 8, orient: 'top', offset: 5 }),
vl.y().fieldQ('count').axis({ format: '%', gridDash: [2, 2] }),
vl.facet().fieldQ('accuracy'),
)
.width(130)
.height(130)
Insert cell
import { Weapon, Dice, atLeast, simulate } from '@visnup/imperial-assault'
Insert cell
import { vl } from '@vega/vega-lite-api'
Insert cell
html`<style>
img { width: 130px }
</style>`
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more