Permalink
Browse files

added level 6 enemies; fixed tests

  • Loading branch information...
1 parent 6006a04 commit f727c9aa58f6db4bd29f3dceb54437f40039df71 Jen Fong-Adwent committed Jul 30, 2012
View
@@ -16,8 +16,8 @@
}
],
"hp": 40,
- "damage_low_range": 5,
- "damage_high_range": 16,
+ "damage_low_range": 20,
+ "damage_high_range": 28,
"gold_low_range": 22,
"gold_high_range": 34,
"xp_low_range": 3,
@@ -37,8 +37,8 @@
}
],
"hp": 45,
- "damage_low_range": 7,
- "damage_high_range": 18,
+ "damage_low_range": 22,
+ "damage_high_range": 32,
"gold_low_range": 24,
"gold_high_range": 37,
"xp_low_range": 3,
View
@@ -15,9 +15,9 @@
"message": "Batty digs his fangs into your neck!"
}
],
- "hp": 72,
- "damage_low_range": 14,
- "damage_high_range": 23,
+ "hp": 82,
+ "damage_low_range": 38,
+ "damage_high_range": 47,
"gold_low_range": 35,
"gold_high_range": 48,
"xp_low_range": 6,
@@ -36,9 +36,9 @@
"message": "Sandy splits into two and attacks you from various angles!"
}
],
- "hp": 75,
- "damage_low_range": 16,
- "damage_high_range": 26,
+ "hp": 85,
+ "damage_low_range": 39,
+ "damage_high_range": 50,
"gold_low_range": 38,
"gold_high_range": 50,
"xp_low_range": 8,
View
@@ -15,9 +15,9 @@
"message": "Siree gives you the worst tinnitus!"
}
],
- "hp": 98,
- "damage_low_range": 25,
- "damage_high_range": 38,
+ "hp": 145,
+ "damage_low_range": 65,
+ "damage_high_range": 88,
"gold_low_range": 39,
"gold_high_range": 53,
"xp_low_range": 12,
@@ -36,9 +36,9 @@
"message": "Spidee tricks you into an invisible wall of web!"
}
],
- "hp": 115,
- "damage_low_range": 35,
- "damage_high_range": 46,
+ "hp": 155,
+ "damage_low_range": 59,
+ "damage_high_range": 81,
"gold_low_range": 43,
"gold_high_range": 60,
"xp_low_range": 15,
View
@@ -15,9 +15,9 @@
"message": "Wax makes a large flame burn closer!"
}
],
- "hp": 140,
- "damage_low_range": 45,
- "damage_high_range": 60,
+ "hp": 190,
+ "damage_low_range": 85,
+ "damage_high_range": 98,
"gold_low_range": 58,
"gold_high_range": 65,
"xp_low_range": 22,
@@ -36,9 +36,9 @@
"message": "Schoenenbot rides a bike on your face!"
}
],
- "hp": 155,
- "damage_low_range": 57,
- "damage_high_range": 75,
+ "hp": 195,
+ "damage_low_range": 87,
+ "damage_high_range": 95,
"gold_low_range": 65,
"gold_high_range": 72,
"xp_low_range": 24,
View
@@ -0,0 +1,48 @@
+{
+ "location": "Green Moon Bay",
+ "enemies":
+ [
+ {
+ "name": "Boogy",
+ "avatar_alive": "/enemies/boogy-alive.png",
+ "avatar_dead": "/enemies/boogy-dead.png",
+ "battle_messages":
+ [
+ {
+ "message": "Boogy sneezes on you! Gross."
+ },
+ {
+ "message": "Boogy rolls up into a ball and flies towards your eye"
+ }
+ ],
+ "hp": 250,
+ "damage_low_range": 135,
+ "damage_high_range": 149,
+ "gold_low_range": 69,
+ "gold_high_range": 75,
+ "xp_low_range": 25,
+ "xp_high_range": 29
+ },
+ {
+ "name": "Baguetto",
+ "avatar_alive": "/enemies/baguetto-alive.png",
+ "avatar_dead": "/enemies/baguetto-dead.png",
+ "battle_messages":
+ [
+ {
+ "message": "Baguetto bakes up a storm in your yeast!"
+ },
+ {
+ "message": "Baguetto elongates itself into supersize!"
+ }
+ ],
+ "hp": 275,
+ "damage_low_range": 150,
+ "damage_high_range": 165,
+ "gold_low_range": 77,
+ "gold_high_range": 85,
+ "xp_low_range": 27,
+ "xp_high_range": 33
+ }
+ ]
+}
View
@@ -27,7 +27,7 @@
"damage_high_range": 8,
"mp_low_range": 0,
"mp_high_range": 0,
- "cost": 140,
+ "cost": 170,
"prerequisites": []
},
"knife": {
@@ -37,7 +37,7 @@
"damage_high_range": 10,
"mp_low_range": 0,
"mp_high_range": 0,
- "cost": 170,
+ "cost": 200,
"prerequisites": []
},
"shoelace": {
@@ -47,7 +47,7 @@
"damage_high_range": 11,
"mp_low_range": 0,
"mp_high_range": 0,
- "cost": 225,
+ "cost": 350,
"prerequisites": []
},
"lawnmower": {
@@ -57,7 +57,7 @@
"damage_high_range": 14,
"mp_low_range": 0,
"mp_high_range": 0,
- "cost": 450,
+ "cost": 650,
"prerequisites":
[
"battery",
@@ -71,7 +71,7 @@
"damage_high_range": 37,
"mp_low_range": 3,
"mp_high_range": 8,
- "cost": 1050,
+ "cost": 1250,
"prerequisites":
[
"battery",
View
@@ -73,12 +73,12 @@ exports.battle = function(req, db, callback) {
} else {
var result = {
- player_hp: user.hp,
- enemy_hp: enemyHP,
- gold: user.gold,
- enemy_damage: enemyDamage,
- xp: user.xp,
- mp: user.mp
+ player_hp: parseInt(user.hp, 10),
+ enemy_hp: parseInt(enemyHP, 10),
+ gold: parseInt(user.gold, 10),
+ enemy_damage: parseInt(enemyDamage, 10),
+ xp: parseInt(user.xp, 10),
+ mp: parseInt(user.mp, 10)
};
callback(null, result);
View
@@ -7,7 +7,6 @@
"npm": "1.1.x"
},
"dependencies": {
- "client-sessions": ">= 0.0.7",
"connect": ">= 2.3.6",
"express": "2.5.11",
"jade": ">= 0.26.3",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -1,21 +1,24 @@
// Module dependencies.
module.exports = function(app, configurations, express) {
- var clientSessions = require('client-sessions');
var nconf = require('nconf');
+ var MemoryStore = require('connect').session.MemoryStore;
nconf.argv().env().file({ file: 'local.json' });
// Configuration
app.configure(function(){
+ app.use(express.cookieParser());
+ app.use(express.session({
+ secret: nconf.get('session_secret'),
+ store: new MemoryStore({ reapInterval: 60000 * 10 })
+ }));
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.set('view options', { layout: false });
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.static(__dirname + '/public'));
- app.use(express.cookieParser());
- app.use(express.session({ secret: nconf.get('session_secret') }));
app.use(app.router);
app.use(function(req, res, next) {
res.status(403);
@@ -38,16 +41,16 @@ module.exports = function(app, configurations, express) {
});
app.configure('development', function() {
- app.set('redisnoodle', nconf.get('redis_dev'));
+ app.set('redisnoodlerpg', nconf.get('redis_dev'));
});
app.configure('test', function() {
- app.set('redisnoodle', nconf.get('redis_test'));
+ app.set('redisnoodlerpg', nconf.get('redis_test'));
});
app.configure('production', function() {
app.use(express.errorHandler());
- app.set('redisnoodle', nconf.get('redis_prod'));
+ app.set('redisnoodlerpg', nconf.get('redis_prod'));
});
app.dynamicHelpers({
View
@@ -61,7 +61,7 @@ describe('game', function() {
describe('battle', function() {
it('fights an enemy and both HPs are less', function(done) {
- req.body.enemy_hp = 20;
+ req.session.enemy_remaining_hp = 20;
req.session.enemy = enemy;
game.battle(req, db, function(err, result) {
should.exist(result);
@@ -72,8 +72,7 @@ describe('game', function() {
});
it('fights an enemy and player wins', function(done) {
- enemy.hp = 0;
- req.body.enemy_hp = 0;
+ enemy.hp = req.session.enemy_remaining_hp = 0;
req.session.enemy = enemy;
game.battle(req, db, function(err, result) {
should.exist(result);
@@ -85,7 +84,7 @@ describe('game', function() {
});
it('fights an enemy and player loses', function(done) {
- enemy.hp = req.body.enemy_hp = 50;
+ enemy.hp = req.session.enemy_remaining_hp = 50;
req.session.hp = 0;
req.session.enemy = enemy;
game.battle(req, db, function(err, result) {

0 comments on commit f727c9a

Please sign in to comment.