diff --git a/public/pieces/anarchy/bb.svg b/public/pieces/anarchy/bb.svg index 61e1c9b..895adbb 100644 --- a/public/pieces/anarchy/bb.svg +++ b/public/pieces/anarchy/bb.svg @@ -1,5 +1,5 @@ - + - + diff --git a/public/pieces/anarchy/bw.svg b/public/pieces/anarchy/bw.svg index efe7b6e..aac9ef7 100644 --- a/public/pieces/anarchy/bw.svg +++ b/public/pieces/anarchy/bw.svg @@ -1,5 +1,5 @@ - - - + + + diff --git a/public/pieces/anarchy/kb.svg b/public/pieces/anarchy/kb.svg index 6d2f691..6adcba0 100644 --- a/public/pieces/anarchy/kb.svg +++ b/public/pieces/anarchy/kb.svg @@ -1,4 +1,4 @@ - - + + diff --git a/public/pieces/anarchy/kw.svg b/public/pieces/anarchy/kw.svg index d19e2a7..73fed7d 100644 --- a/public/pieces/anarchy/kw.svg +++ b/public/pieces/anarchy/kw.svg @@ -1,4 +1,4 @@ - - + + diff --git a/public/pieces/anarchy/nb.svg b/public/pieces/anarchy/nb.svg index d81152e..bb5935e 100644 --- a/public/pieces/anarchy/nb.svg +++ b/public/pieces/anarchy/nb.svg @@ -1,8 +1,8 @@ - - + + - + diff --git a/public/pieces/anarchy/nw.svg b/public/pieces/anarchy/nw.svg index 131331c..bdf8046 100644 --- a/public/pieces/anarchy/nw.svg +++ b/public/pieces/anarchy/nw.svg @@ -1,6 +1,6 @@ - - + + diff --git a/public/pieces/anarchy/pb.svg b/public/pieces/anarchy/pb.svg index 34631bb..e520137 100644 --- a/public/pieces/anarchy/pb.svg +++ b/public/pieces/anarchy/pb.svg @@ -1,10 +1,11 @@ - - - - - - - - + + + + + + + + + diff --git a/public/pieces/anarchy/pw.svg b/public/pieces/anarchy/pw.svg index 71a9c84..017b8be 100644 --- a/public/pieces/anarchy/pw.svg +++ b/public/pieces/anarchy/pw.svg @@ -1,14 +1,9 @@ - - - - - - - - - - - - + + + + + + + diff --git a/public/pieces/anarchy/qb.svg b/public/pieces/anarchy/qb.svg index 56c2c00..12b04e7 100644 --- a/public/pieces/anarchy/qb.svg +++ b/public/pieces/anarchy/qb.svg @@ -1,4 +1,4 @@ - + diff --git a/public/pieces/anarchy/qw.svg b/public/pieces/anarchy/qw.svg index 3ae704c..ba54b54 100644 --- a/public/pieces/anarchy/qw.svg +++ b/public/pieces/anarchy/qw.svg @@ -1,4 +1,4 @@ - - + + diff --git a/public/pieces/anarchy/rb.svg b/public/pieces/anarchy/rb.svg index eb0c9f1..937aa56 100644 --- a/public/pieces/anarchy/rb.svg +++ b/public/pieces/anarchy/rb.svg @@ -1,4 +1,5 @@ - - + + + diff --git a/public/pieces/anarchy/rw.svg b/public/pieces/anarchy/rw.svg index 9df9527..e8d5fc2 100644 --- a/public/pieces/anarchy/rw.svg +++ b/public/pieces/anarchy/rw.svg @@ -1,4 +1,6 @@ - - + + + + diff --git a/public/sfx/brick-move.wav b/public/sfx/brick-move.wav new file mode 100644 index 0000000..c7b8d75 Binary files /dev/null and b/public/sfx/brick-move.wav differ diff --git a/public/sfx/brick-take.wav b/public/sfx/brick-take.wav new file mode 100644 index 0000000..05b22e7 Binary files /dev/null and b/public/sfx/brick-take.wav differ diff --git a/public/sfx/fanfare.wav b/public/sfx/fanfare.wav new file mode 100644 index 0000000..1c7bba4 Binary files /dev/null and b/public/sfx/fanfare.wav differ diff --git a/public/sfx/neigh.wav b/public/sfx/neigh.wav new file mode 100644 index 0000000..c486443 Binary files /dev/null and b/public/sfx/neigh.wav differ diff --git a/public/sfx/snort.wav b/public/sfx/snort.wav new file mode 100644 index 0000000..b99e53c Binary files /dev/null and b/public/sfx/snort.wav differ diff --git a/src/player/Player.ts b/src/player/Player.ts index b29e6c2..7898a9e 100644 --- a/src/player/Player.ts +++ b/src/player/Player.ts @@ -119,12 +119,43 @@ class Player { if (this.ply > 0 && state.siteConfig.sounds) { if (position.mate) { sfx.snap.play(); + if (position.move?.flags && position.move.flags.includes("e")) { + sfx.fanfare.play(); + } else if (position.move?.piece === "r") { + position.move.flags.includes("c") + ? sfx.brickTake.play() + : sfx.brickMove.play(); + } } else if (/[ce]/.test(position.move?.flags as string)) { - sfx.take.play(); + if (position.move?.piece === "r") { + sfx.brickTake.play(); + } else { + sfx.take.play(); + } + + if ( + position.move?.piece === "n" && + state.boardConfig.piecesStyle === "anarchy" + ) { + sfx.neigh.play(); + } else if (position.move?.flags && position.move.flags.includes("e")) { + sfx.fanfare.play(); + } } else if (/[kqp]/.test(position.move?.flags as string)) { sfx.swap.play(); } else { - sfx.move.play(); + if (position.move?.piece === "r") { + sfx.brickMove.play(); + } else { + sfx.move.play(); + } + + if ( + position.move?.piece === "n" && + state.boardConfig.piecesStyle === "anarchy" + ) { + sfx.snort.play(); + } } } diff --git a/src/player/sfx.ts b/src/player/sfx.ts index 98c30b9..3ed4421 100644 --- a/src/player/sfx.ts +++ b/src/player/sfx.ts @@ -21,6 +21,26 @@ const sfx = { src: ["/sfx/rewind.wav"], volume: 0.2, }), + snort: new Howl({ + src: ["/sfx/snort.wav"], + volume: 0.5, + }), + neigh: new Howl({ + src: ["/sfx/neigh.wav"], + volume: 0.5, + }), + fanfare: new Howl({ + src: ["/sfx/fanfare.wav"], + volume: 0.5, + }), + brickMove: new Howl({ + src: ["/sfx/brick-move.wav"], + volume: 0.5, + }), + brickTake: new Howl({ + src: ["/sfx/brick-take.wav"], + volume: 0.5, + }), }; export default sfx;