aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Kohls <mattkohls13@gmail.com>2019-11-30 23:43:38 -0500
committerMatt Kohls <mattkohls13@gmail.com>2019-11-30 23:43:38 -0500
commitcc3c7f52bbde6e5149c222d09f2db47664470cd6 (patch)
tree842982d9d3bd2bf36ec96075c526e63496baab17
parent28cf66631f269f9970ee09aaba2d5ef03d49cc25 (diff)
downloadrogue.js-cc3c7f52bbde6e5149c222d09f2db47664470cd6.tar.gz
rogue.js-cc3c7f52bbde6e5149c222d09f2db47664470cd6.tar.bz2
rogue.js-cc3c7f52bbde6e5149c222d09f2db47664470cd6.zip
Some prep work for server side of things
-rw-r--r--README.md3
-rw-r--r--public/js/rogue.js2
-rw-r--r--rogue-server.js47
3 files changed, 51 insertions, 1 deletions
diff --git a/README.md b/README.md
index a9f61f3..0c5de4f 100644
--- a/README.md
+++ b/README.md
@@ -23,4 +23,5 @@ GPL3
#### Artwork
-[minirogue-all.png](https://forums.tigsource.com/index.php?topic=14166.0) by Arachne, [CC-BY-SA](https://creativecommons.org/licenses/by-sa/4.0/) \ No newline at end of file
+Original sprites based on
+[scroll-o-sprites.png](https://imgur.com/a/uHx4k) by Quale, [CC-BY-SA](https://creativecommons.org/licenses/by-sa/3.0/)
diff --git a/public/js/rogue.js b/public/js/rogue.js
index 1580593..a5a640a 100644
--- a/public/js/rogue.js
+++ b/public/js/rogue.js
@@ -42,6 +42,7 @@ var wall = [
var stairsdown = new Sprite(12, 26, 16, 16);
var starisup = new Sprite(13, 26, 16, 16);
+var tomb = new Sprite(2, 27, 16, 16);
var water = new Sprite(8, 34, 16, 16);
@@ -59,6 +60,7 @@ var book = new Sprite(10, 49, 16, 16);
var mace = new Sprite(13, 3, 1);
var dagger = new Sprite(2, 45, 16, 16);
var sword = new Sprite(3, 45, 16, 16);
+var staff = new Sprite(2, 49, 16, 16);
var axe = new Sprite(4, 45, 16, 16);
var club = new Sprite(7, 45, 16, 16);
var hammer = new Sprite(8, 45, 16, 16);
diff --git a/rogue-server.js b/rogue-server.js
index a8d553a..e91306a 100644
--- a/rogue-server.js
+++ b/rogue-server.js
@@ -6,6 +6,53 @@
* GPL3
*/
+function getBonus(value) {
+ if(value % 2 == 1) {
+ --value;
+ }
+ return (value - 10) / 2;
+}
+
+class Item {
+ constructor(bonus, type) {
+ this.bonus = bonus;
+ this.type = type;
+ }
+
+ get name() {
+ var name = type + " ";
+ if(bonus > 0) {
+ name = name + "+" + bonus;
+ } else if(bonus < 0) {
+ name = name + "-" + bonus;
+ }
+ return name;
+ }
+
+ get bonus() {
+ return bonus;
+ }
+
+ get type() {
+ return type;
+ }
+}
+
+class Mob {
+ constuctor(strength, dexterity, constitution, intelligence, wisdom, level, location) {
+ this.strength = strength;
+ this.dexterity = dexterity;
+ this.constitution = constitution;
+ this.intelligence = intelligence;
+ this.wisdom = wisdom;
+ this.level = level;
+ this.xp = 0;
+ this.hp = level * getBonus(constitution) + Math.floor(Math.random() * 6) * level;
+ this.ac = dexterity + 10;
+ this.invintory = {};
+ }
+}
+
const http = require('http');
const WebSocket = require('ws');
const uuid = require('uuid/v4');