diff --git a/README.md b/README.md
index fb62911..9edb616 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,2 @@
# DonsolJavascript
Javascript version of Donsol
-
-### Original authors
-The original Javascript+Electron version of Donsol was created by Hundred Rabbits.
-
-### About this branch
-This branch ("web") will be used for development on the web-based version of Donsol, which in turn is heavily based on the main branch, stripping out parts related to Electron and NodeJS.
-None of this is official; it's a passion project, so please do not contact Hundred Rabbits regarding issues with this web version of the game.
-
-### Limitations
-In the project's current state, you can play the base game of Donsol, with some limitations.
-The following do not currently work:
-* ~~Card faces do not render properly, as these were previously loaded with NodeJS functions that aren't available to use in a pure browser-based application (as far as I'm aware). I have an idea on how to accomplish this.~~ Fixed in commit ff787f7
-* Aspects of the game that relied on being selected from a menu in the Electron version currently have no way of being toggled. These include things like difficulty selection and themeing support.
-
-### Contributing
-If you wish to contribute to the project, please follow the standard practice of forking this repository and submitting a pull request.
diff --git a/sources/index.html b/sources/index.html
index 93bb5b4..9560a1e 100644
--- a/sources/index.html
+++ b/sources/index.html
@@ -44,6 +44,9 @@
diff --git a/sources/scripts/card.js b/sources/scripts/card.js
index 51f12e9..a2d325e 100644
--- a/sources/scripts/card.js
+++ b/sources/scripts/card.js
@@ -1,11 +1,10 @@
'use strict'
-function Card (sym, value, type, name = 'Unknown', svg = '') {
+function Card (sym, value, type, name = 'Unknown') {
this.symbol = sym
this.value = value
this.type = type
this.name = name
- this.svg = svg
this.element = null
this.is_flipped = false
@@ -27,7 +26,7 @@ function Card (sym, value, type, name = 'Unknown', svg = '') {
const graphic = document.createElement('div')
graphic.className = 'graphic'
- graphic.innerHTML = this.svg
+ graphic.innerHTML = require('fs').readFileSync(`${__dirname}/media/${this.type}/${this.value}.svg`)
face.appendChild(graphic)
// Name
diff --git a/sources/scripts/card.monster.js b/sources/scripts/card.monster.js
index 8382a45..2644db7 100644
--- a/sources/scripts/card.monster.js
+++ b/sources/scripts/card.monster.js
@@ -1,7 +1,7 @@
'use strict'
-function Card_Monster (sym, value, type, name = 'Unknown', svg = '') {
- Card.call(this, sym, value, type, name, svg)
+function Card_Monster (sym, value, type, name = 'Unknown') {
+ Card.call(this, sym, value, type, name)
this.touch = function () {
if (this.is_flipped) { console.log('Card is already flipped'); return }
diff --git a/sources/scripts/card.potion.js b/sources/scripts/card.potion.js
index 259f3af..aa3d600 100644
--- a/sources/scripts/card.potion.js
+++ b/sources/scripts/card.potion.js
@@ -1,7 +1,7 @@
'use strict'
-function Card_Potion (sym, value, type, name = 'Unknown', svg = '') {
- Card.call(this, sym, value, type, name, svg)
+function Card_Potion (sym, value, type, name = 'Unknown') {
+ Card.call(this, sym, value, type, name)
this.touch = function () {
if (this.is_flipped) { console.log('Card is already flipped'); return }
diff --git a/sources/scripts/card.shield.js b/sources/scripts/card.shield.js
index 283ed10..19cd345 100644
--- a/sources/scripts/card.shield.js
+++ b/sources/scripts/card.shield.js
@@ -1,7 +1,7 @@
'use strict'
-function Card_Shield (sym, value, type, name = 'Unknown', svg = '') {
- Card.call(this, sym, value, type, name, svg)
+function Card_Shield (sym, value, type, name = 'Unknown') {
+ Card.call(this, sym, value, type, name)
this.touch = function () {
if (this.is_flipped == true) { console.log('Card is already flipped'); return }
diff --git a/sources/scripts/deck.js b/sources/scripts/deck.js
index 502ee19..acf974e 100644
--- a/sources/scripts/deck.js
+++ b/sources/scripts/deck.js
@@ -2,60 +2,60 @@
function Deck () {
this.cards = [
- new Card_Potion('A', 11, HEART, 'White Mage', ''),
- new Card_Potion('2', 2, HEART, 'Small Potion', ''),
- new Card_Potion('3', 3, HEART, 'Small Potion', ''),
- new Card_Potion('4', 4, HEART, 'Medium Potion', ''),
- new Card_Potion('5', 5, HEART, 'Medium Potion', ''),
- new Card_Potion('6', 6, HEART, 'Medium Potion', ''),
- new Card_Potion('7', 7, HEART, 'Medium Potion', ''),
- new Card_Potion('8', 8, HEART, 'Medium Potion', ''),
- new Card_Potion('9', 9, HEART, 'Large Potion', ''),
- new Card_Potion('10', 10, HEART, 'Large Potion', ''),
- new Card_Potion('V', 11, HEART, 'White Mage', ''),
- new Card_Potion('Q', 11, HEART, 'White Mage', ''),
- new Card_Potion('K', 11, HEART, 'White Mage', ''),
- new Card_Shield('A', 11, DIAMOND, 'Red Mage', ''),
- new Card_Shield('2', 2, DIAMOND, 'Buckler', ''),
- new Card_Shield('3', 3, DIAMOND, 'Buckler', ''),
- new Card_Shield('4', 4, DIAMOND, 'Shield', ''),
- new Card_Shield('5', 5, DIAMOND, 'Shield', ''),
- new Card_Shield('6', 6, DIAMOND, 'Shield', ''),
- new Card_Shield('7', 7, DIAMOND, 'Shield', ''),
- new Card_Shield('8', 8, DIAMOND, 'Shield', ''),
- new Card_Shield('9', 9, DIAMOND, 'Large Shield', ''),
- new Card_Shield('10', 10, DIAMOND, 'Large Shield', ''),
- new Card_Shield('V', 11, DIAMOND, 'Red Mage', ''),
- new Card_Shield('Q', 11, DIAMOND, 'Red Mage', ''),
- new Card_Shield('K', 11, DIAMOND, 'Red Mage', ''),
- new Card_Monster('A', 17, CLOVE, 'Empress', ''),
- new Card_Monster('2', 2, CLOVE, 'Rat', ''),
- new Card_Monster('3', 3, CLOVE, 'Bat', ''),
- new Card_Monster('4', 4, CLOVE, 'Imp', ''),
- new Card_Monster('5', 5, CLOVE, 'Goblin', ''),
- new Card_Monster('6', 6, CLOVE, 'Orc', ''),
- new Card_Monster('7', 7, CLOVE, 'Ogre', ''),
- new Card_Monster('8', 8, CLOVE, 'Beholder', ''),
- new Card_Monster('9', 9, CLOVE, 'Medusa', ''),
- new Card_Monster('10', 10, CLOVE, 'Demon', ''),
- new Card_Monster('V', 11, CLOVE, 'Consort', ''),
- new Card_Monster('Q', 13, CLOVE, 'Queen', ''),
- new Card_Monster('K', 15, CLOVE, 'Regnant', ''),
- new Card_Monster('A', 17, SPADE, 'Empress', ''),
- new Card_Monster('2', 2, SPADE, 'Slime', ''),
- new Card_Monster('3', 3, SPADE, 'Tunneler', ''),
- new Card_Monster('4', 4, SPADE, 'Fiend', ''),
- new Card_Monster('5', 5, SPADE, 'Drake', ''),
- new Card_Monster('6', 6, SPADE, 'Specter', ''),
- new Card_Monster('7', 7, SPADE, 'Ghost', ''),
- new Card_Monster('8', 8, SPADE, 'Elemental', ''),
- new Card_Monster('9', 9, SPADE, 'Witch', ''),
- new Card_Monster('10', 10, SPADE, 'Familiar', ''),
- new Card_Monster('V', 11, SPADE, 'Consort', ''),
- new Card_Monster('Q', 13, SPADE, 'Queen', ''),
- new Card_Monster('K', 15, SPADE, 'Regnant', ''),
- new Card_Monster('J', 21, JOKER, 'First Donsol', ''),
- new Card_Monster('J', 21, JOKER, 'Second Donsol', '')
+ new Card_Potion('A', 11, HEART, 'White Mage'),
+ new Card_Potion('2', 2, HEART, 'Small Potion'),
+ new Card_Potion('3', 3, HEART, 'Small Potion'),
+ new Card_Potion('4', 4, HEART, 'Medium Potion'),
+ new Card_Potion('5', 5, HEART, 'Medium Potion'),
+ new Card_Potion('6', 6, HEART, 'Medium Potion'),
+ new Card_Potion('7', 7, HEART, 'Medium Potion'),
+ new Card_Potion('8', 8, HEART, 'Medium Potion'),
+ new Card_Potion('9', 9, HEART, 'Large Potion'),
+ new Card_Potion('10', 10, HEART, 'Large Potion'),
+ new Card_Potion('V', 11, HEART, 'White Mage'),
+ new Card_Potion('Q', 11, HEART, 'White Mage'),
+ new Card_Potion('K', 11, HEART, 'White Mage'),
+ new Card_Shield('A', 11, DIAMOND, 'Red Mage'),
+ new Card_Shield('2', 2, DIAMOND, 'Buckler'),
+ new Card_Shield('3', 3, DIAMOND, 'Buckler'),
+ new Card_Shield('4', 4, DIAMOND, 'Shield'),
+ new Card_Shield('5', 5, DIAMOND, 'Shield'),
+ new Card_Shield('6', 6, DIAMOND, 'Shield'),
+ new Card_Shield('7', 7, DIAMOND, 'Shield'),
+ new Card_Shield('8', 8, DIAMOND, 'Shield'),
+ new Card_Shield('9', 9, DIAMOND, 'Large Shield'),
+ new Card_Shield('10', 10, DIAMOND, 'Large Shield'),
+ new Card_Shield('V', 11, DIAMOND, 'Red Mage'),
+ new Card_Shield('Q', 11, DIAMOND, 'Red Mage'),
+ new Card_Shield('K', 11, DIAMOND, 'Red Mage'),
+ new Card_Monster('A', 17, CLOVE, 'Empress'),
+ new Card_Monster('2', 2, CLOVE, 'Rat'),
+ new Card_Monster('3', 3, CLOVE, 'Bat'),
+ new Card_Monster('4', 4, CLOVE, 'Imp'),
+ new Card_Monster('5', 5, CLOVE, 'Goblin'),
+ new Card_Monster('6', 6, CLOVE, 'Orc'),
+ new Card_Monster('7', 7, CLOVE, 'Ogre'),
+ new Card_Monster('8', 8, CLOVE, 'Beholder'),
+ new Card_Monster('9', 9, CLOVE, 'Medusa'),
+ new Card_Monster('10', 10, CLOVE, 'Demon'),
+ new Card_Monster('V', 11, CLOVE, 'Consort'),
+ new Card_Monster('Q', 13, CLOVE, 'Queen'),
+ new Card_Monster('K', 15, CLOVE, 'Regnant'),
+ new Card_Monster('A', 17, SPADE, 'Empress'),
+ new Card_Monster('2', 2, SPADE, 'Slime'),
+ new Card_Monster('3', 3, SPADE, 'Tunneler'),
+ new Card_Monster('4', 4, SPADE, 'Fiend'),
+ new Card_Monster('5', 5, SPADE, 'Drake'),
+ new Card_Monster('6', 6, SPADE, 'Specter'),
+ new Card_Monster('7', 7, SPADE, 'Ghost'),
+ new Card_Monster('8', 8, SPADE, 'Elemental'),
+ new Card_Monster('9', 9, SPADE, 'Witch'),
+ new Card_Monster('10', 10, SPADE, 'Familiar'),
+ new Card_Monster('V', 11, SPADE, 'Consort'),
+ new Card_Monster('Q', 13, SPADE, 'Queen'),
+ new Card_Monster('K', 15, SPADE, 'Regnant'),
+ new Card_Monster('J', 21, JOKER, 'First Donsol'),
+ new Card_Monster('J', 21, JOKER, 'Second Donsol')
]
let draw_pile = []
diff --git a/sources/scripts/lib/controller.js b/sources/scripts/lib/controller.js
index 99c3e5f..365c368 100644
--- a/sources/scripts/lib/controller.js
+++ b/sources/scripts/lib/controller.js
@@ -4,6 +4,8 @@ function Controller () {
this.menu = { default: {} }
this.mode = 'default'
+ this.app = require('electron').remote.app
+
this.start = function () {
}
@@ -43,6 +45,10 @@ function Controller () {
return f
}
+ this.commit = function () {
+ this.app.inject_menu(this.format())
+ }
+
this.docs = function () {
console.log('Generating docs..')
const svg = this.generate_svg(this.format())
@@ -175,3 +181,5 @@ function Controller () {
{ x: 540, y: 240, width: 90, height: 60, name: 'alt' }
]
}
+
+module.exports = new Controller()