diff --git a/README.md b/README.md index 841ea46..d61af40 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is intended to be a hive game engine, as well as assets and a react client. git clone https://github.com/chriscauley/hive.js.git cd hive.js yarn install -yarn develop +yarn serve ``` The above will start only the client. If you also want to run the client you will need python3 and postgres installed. You'll also need docker (or redis if you don't want to use docker). To install the python server and start both the client and multiplayer server at http://localhost:8239 run: @@ -34,4 +34,4 @@ docker run -p 6379:6379 -d redis:5is:5 * minmax AI -* add more variants from board game geek \ No newline at end of file +* add more variants from board game geek diff --git a/client/shell.nix b/client/shell.nix new file mode 100644 index 0000000..9fe72cd --- /dev/null +++ b/client/shell.nix @@ -0,0 +1,4 @@ +{ pkgs ? import {} }: + pkgs.mkShell { + nativeBuildInputs = with pkgs.buildPackages; [ nodejs yarn ]; +} diff --git a/client/src/components/NewGame.vue b/client/src/components/NewGame.vue index 2d9d6fb..bda2d40 100644 --- a/client/src/components/NewGame.vue +++ b/client/src/components/NewGame.vue @@ -118,7 +118,7 @@ const presets = [ }, }, { - slug: 'superhive', + slug: 'modern_hive', description: 'Classic hive with a few tweaks', pieces: { ant: 3, @@ -171,6 +171,84 @@ const presets = [ beetle: 2, }, }, + { + slug: 'dunes', + description: 'Tough, hard to pin pieces.', + pieces: { + beetle: 3, + praying_mantis: 1, + scorpion: 2, + fly: 1, + kung_fu_mantis: 1, + emerald_wasp: 3, + }, + }, + { + slug: 'swamp', + description: 'Fast moving pieces and grabbers.', + pieces: { + cicada: 3, + praying_mantis: 3, + orchid_mantis: 2, + dragonfly_nymph: 2, + orbweaver: 2, + }, + }, + { + slug: 'marsh', + description: 'Carrying pieces.', + pieces: { + kung_fu_mantis: 2, + lanternfly_nymph: 2, + dragonfly: 3, + cockroach: 2, + praying_mantis: 2, + }, + }, + { + slug: 'attic', + description: 'Pesky flies.', + pieces: { + beetle: 1, + scorpion: 1, + orbweaver: 1, + fly: 4, + beetle: 1, + damselfly: 3, + ant: 2, + }, + }, + { + slug: 'frenzy', + description: 'Quick attackers.', + pieces: { + hornet: 3, + orchid_mantis: 2, + scorpion: 2, + praying_mantis: 2, + ant: 2 + }, + }, + { + slug: 'jitters', + description: 'Emerald Wasp and other pieces that take effort to activate.', + pieces: { + emerald_wasp: 4, + orchid_mantis: 2, + cockroach: 3, + trapdoor_spider: 2, + }, + }, + { + slug: 'skulking', + description: '4 bugs that can counter each other.', + pieces: { + cicada: 3, + trapdoor_spider: 3, + lanternfly_nymph: 3, + beetle: 3, + }, + }, ] presets.forEach((p) => (p.name = startCase(p.slug))) diff --git a/client/src/views/ChangeLog.js b/client/src/views/ChangeLog.js index 55881f9..45bb477 100644 --- a/client/src/views/ChangeLog.js +++ b/client/src/views/ChangeLog.js @@ -1,6 +1,20 @@ import css from '@unrest/css' const content = { + 'v1.0.3 Dec 12, 2024': [ + 'Arachnid rebalance: Scorpion movement decreased to 2, range of stinger increased by 1. Hop ability removed.', + 'Arachnid rebalance: Orbweaver movement decreased to 1. Hop ability removed.', + 'NEW PIECE SET: Dunes. Tough, hard to pin pieces.', + 'NEW PIECE SET: Swamp. Fast moving pieces and grabbers.', + 'NEW PIECE SET: Marsh. Carrying pieces.', + 'NEW PIECE SET: Attic. Pesky flies.', + 'NEW PIECE SET: Frenzy. Quick attackers.', + 'NEW PIECE SET: Jitters. Emerald Wasp and other pieces that take effort to activate.', + 'NEW PIECE SET: Skulking. 4 bugs that can counter each other.', + 'Renamed Superhive to Modern Hive, to reflect its intention as a modern balance patch.', + 'Reorganized pieces in piece selection. Functionality is roughly organized in columns. Power roughly increases with each row.', + 'Help text improved for accuracy, consistency, and grammar.' + ], 'v1.0.2 Dec 28, 2020': [ 'NEW PIECE: Praying Mantis can leap onto furthest piece in any direction and drag a stacked piece with it.', 'NEW PIECE: Kung Fu Mantis can grab a piece two spaces away and move it underneath.', diff --git a/game/Board/index.js b/game/Board/index.js index 3f8319d..ba4f81d 100644 --- a/game/Board/index.js +++ b/game/Board/index.js @@ -27,6 +27,7 @@ const B = { type: {}, player: {}, stack: {}, + stinger: {}, crawl: {}, fly: {}, } diff --git a/game/Board/moves.js b/game/Board/moves.js index 4f4664c..8593216 100644 --- a/game/Board/moves.js +++ b/game/Board/moves.js @@ -5,8 +5,17 @@ import webs from './webs' export const notEnemyScorpion = (board, source, target) => { const { stack, player } = board.layers - return !stack[target] || player[source] === player[target] -} + const touching = board.geo.touching[target]; + const noAdjacentScorpions = touching.filter((i) => notEnemyStinger(board, source, i)).length === 6; + + return noAdjacentScorpions && (!stack[target] || player[source] === player[target]) +} //confused how this works to identify not a scorpion + +export const notEnemyStinger = (board, source, target) => { + const { stinger, player } = board.layers + + return !stinger[target] || player[source] === player[target] +} const getPlacement = (board, player_id, excludes = []) => { if (board.turn === 0) { @@ -352,6 +361,14 @@ const spider = (b, i) => { const kung_fu_mantis = (b, i) => (b.stacks[i].length > 1 ? beetle(b, i) : []) +const orbweaver = (b, i) => { + return nStepsAlongHive(b, i, 1); +} + +const scorpion = (b, i) => { + return nStepsAlongHive(b, i, 2); +} + const moves = { stepOnHive, stepOffHive, @@ -378,9 +395,9 @@ const moves = { // all spider-likes move the same spider, - scorpion: spider, + scorpion: scorpion, trapdoor_spider: spider, - orbweaver: spider, + orbweaver: orbweaver, emerald_wasp, kung_fu_mantis, } diff --git a/game/Board/specials.js b/game/Board/specials.js index 8bbca30..77c452e 100644 --- a/game/Board/specials.js +++ b/game/Board/specials.js @@ -104,7 +104,9 @@ const praying_mantis = (board, piece_id, args) => { } target_index += dindex } - targets.push([last, snag]) + if (!board.layers.stinger[last]) { + targets.push([last, snag]) + } }) if (args.length === 0) { let snag_targets = [] diff --git a/game/Board/webs.js b/game/Board/webs.js index 5418f95..a8a7b3b 100644 --- a/game/Board/webs.js +++ b/game/Board/webs.js @@ -5,6 +5,7 @@ const web_targets = { fly: ['fly', 'hornet', 'ladybug', 'cockroach', 'grasshopper', 'cicada', 'lanterfly'], crawl: ['ant', 'cicada'], // , 'orbweaver', 'scorpion', 'trapdoor_spider', 'spider'], stack: ['beetle', 'orchid_mantis', 'praying_mantis', 'fly', 'dragonfly'], + stinger: ['beetle', 'orchid_mantis', 'praying_mantis', 'fly', 'dragonfly'], //includes damsel fly } const piece_shows_webs = {} @@ -20,6 +21,7 @@ export default { scorpion: (b, i) => { // no piece can step on top of a scorpion b.layers.stack[i] = true + b.layers.stinger[i] = true }, orbweaver: (b, i) => { // no piece can fly over an orbweaver @@ -38,6 +40,7 @@ export default { fly: (b, i) => !b.layers.fly[i], crawl: (b, i) => !b.layers.crawl[i], stack: (b, i) => !b.layers.stack[i], + stinger: (b, i) => !b.layers.stinger[i] }, getVisible(b, i) { @@ -56,5 +59,6 @@ export default { `Since the ${type} started in this web, it cannot be stuck on it again.`, stack: (type) => `The ${type} cannot step on top of the scorpion.`, fly: (type) => `The ${type} cannot move over the orbweaver.`, + stinger: (type) => `The ${type} cannot move within the scorpion's stinger range.`, }, } diff --git a/game/help.js b/game/help.js index c9dcdd4..99343b2 100644 --- a/game/help.js +++ b/game/help.js @@ -12,8 +12,8 @@ const _spider = (s, e = '') => `The ${u(s)} must crawl exactly 3 spaces along th const queen = [_along('queen')] const emerald_wasp = [ - 'If starting on the ground, the emerald wasp can take two steps on top of the hive', - 'If starting on the hive, the emerald wasp can step off the hive', + 'If starting on the ground, the emerald wasp can take two steps on top of the hive.', + 'If starting on the hive, the emerald wasp can step off the hive.', _orbweaver('emerald_wasp'), _scorpion('emerald_wasp'), ] @@ -87,7 +87,7 @@ const kung_fu_mantis = [ const praying_mantis = [ 'If starting on the ground, the praying mantis leaps in any direction and lands on the furthest piece.', - 'It cannot leap over any breaks in the hive', + 'It cannot leap over any breaks in the hive.', 'If the mantis encounters any stacks while leaping, it will carry the top most piece with it.', 'If starting on top of a stack, the mantis can only step off the stack onto the ground.', _orbweaver('praying_mantis'), diff --git a/game/pieces.js b/game/pieces.js index 43ae9c4..fac8679 100644 --- a/game/pieces.js +++ b/game/pieces.js @@ -9,35 +9,33 @@ const VANILLA = { spider: 2, } +//sorted for vertical roguh functionality groupings const piece_counts = { queen: 1, ...VANILLA, - // expansion - ladybug: 1, - mosquito: 1, pill_bug: 1, - - // boardgamegeeks orchid_mantis: 2, - fly: 3, - hornet: 3, - dragonfly: 1, + cicada: 3, cockroach: 1, + trapdoor_spider: 2, centipede: 1, + dragonfly: 1, + praying_mantis: 1, + lanternfly: 3, scorpion: 2, - - // hive.js - trapdoor_spider: 2, + ladybug: 1, + dragonfly_nymph: 2, + kung_fu_mantis: 1, + fly: 3, orbweaver: 2, - cicada: 3, - lanternfly: 3, - lanternfly_nymph: 3, - earthworm: 1, + emerald_wasp: 1, damselfly: 1, - dragonfly_nymph: 2, + earthworm: 1, + hornet: 3, praying_mantis: 1, - emerald_wasp: 1, - kung_fu_mantis: 1, + lanternfly_nymph: 3, + mosquito: 1, + } // currently not used, colors are stored on svg diff --git a/game/short_help.js b/game/short_help.js index 200688d..649d68b 100644 --- a/game/short_help.js +++ b/game/short_help.js @@ -1,4 +1,4 @@ -const _along = 'Move one square along the hive.' +const _along = 'Move one space along the hive.' const _stack = 'Cannot step on scorpion.' const _fly = 'Cannot move over orbweaver.' const _crawl = 'Will stop moving if it touches the trapdoor spider.' @@ -7,7 +7,7 @@ const _beetle = 'Moves like a beetle if it starts a turn on the hive.' const queen = [_along, 'If surrounded, you lose.', 'You can only have one queen.'] const beetle = [_along, 'Can move onto hive.', _stack] -const grasshopper = ['Hops over hive.', _fly] +const grasshopper = ['Jumps over the hive.', _fly] const cicada = ['Can make unlimited jumps over the hive.', _fly, _crawl] const spider = _spiderlike([]) const ant = ['Can move unlimited spaces along the hive.', _crawl] @@ -17,10 +17,10 @@ const mosquito = [ _beetle, 'Cannot copy special abilities.', ] -const pill_bug = [_along, 'Can move any piece it is touching to another empty square.'] +const pill_bug = [_along, 'Can move any piece it is touching to an empty adjacent space.'] const orchid_mantis = [_along, 'Can pull a piece under itself.', _beetle, _stack] const kung_fu_mantis = [ - 'Can pull a piece two spaces in any direction under itself.', + 'Can pull a piece from two spaces in any direction under itself.', _beetle, _stack, ] @@ -28,13 +28,13 @@ const kung_fu_mantis = [ const praying_mantis = [ 'Can jump over the hive and land on the furthest piece in any direction', 'Will carry a stacked piece with it when it jumps.', - 'If on the hive, can only step on the ground.', + 'If on the hive, can only step to the ground.', _fly, _stack, ] const fly = [ 'If on ground, can step on the hive.', - 'If on the hive, can fly to any open square.', + 'If on the hive, can fly to any open tile.', _fly, _stack, ] @@ -54,22 +54,25 @@ const dragonfly_nymph = [ ] const centipede = [_along, 'Can swap with an adjacent piece.'] const earthworm = [_along, 'Can swap with the bottom piece of any stack 3 (on hive) moves away.'] -const orbweaver = _spiderlike([ +const orbweaver = [ + 'Moves one step along the hive', 'No piece can move over.', 'Defends against grasshopper, cicada, ladybug, fly, hornet, emerald wasp, and cockroach.', -]) +] + const trapdoor_spider = _spiderlike([ 'Traps any piece that moves next to it.', 'Defends against ant and cicada.', ]) -const scorpion = _spiderlike([ +const scorpion = [ + 'Moves two steps along the hive.', 'No piece can stack on top of the scorpion.', 'Defends against beetle, fly, dragonfly, and orchid mantis, kung fu mantis, and praying mantis.', -]) +] const emerald_wasp = [ 'If on the ground, can take two steps onto the hive.', - 'If on the hive, can only step on the ground.', + 'If on the hive, can only step to the ground.', _fly, _stack, ]