Skip to content

Commit

Permalink
clean up lib
Browse files Browse the repository at this point in the history
  • Loading branch information
josselinchevalay committed Sep 11, 2015
1 parent 178e50b commit 261fae1
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 32 deletions.
1 change: 1 addition & 0 deletions lib/Services/BaseService.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global module*/
'use strict';

var BaseService = function(containers) {
Expand Down
19 changes: 10 additions & 9 deletions lib/Services/CapacityService.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/* global require, module*/
'use strict';

var BaseService = require('./BaseService.js')
var Charism = require('../Capacity/Charism.js')
var Commerage = require('../Capacity/Commerage.js')
var Esquive = require('../Capacity/Esquive.js')
var Ragot = require('../Capacity/Ragot.js')
var BaseService = require('./BaseService.js');
var Charism = require('../Capacity/Charism.js');
var Commerage = require('../Capacity/Commerage.js');
var Esquive = require('../Capacity/Esquive.js');
var Ragot = require('../Capacity/Ragot.js');

var Service = function() {
var service = {};
service.__proto__ = BaseService({
"Charism": new Charism(),
"Esquive": new Esquive(),
"Commerage": new Commerage(),
"Ragot": new Ragot()
'Charism': new Charism(),
'Esquive': new Esquive(),
'Commerage': new Commerage(),
'Ragot': new Ragot()
});

return service;
Expand Down
7 changes: 4 additions & 3 deletions lib/Services/ClassService.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*global require, module*/
'use strict';


var BaseService = require('./BaseService.js')
var Warrior = require('../Class/Warrior.js')
var BaseService = require('./BaseService.js');
var Warrior = require('../Class/Warrior.js');

var ClassService = function() {
var classService = {};
classService.__proto__ = BaseService({
"Warrior": new Warrior()
'Warrior': new Warrior()
});

return classService;
Expand Down
9 changes: 5 additions & 4 deletions lib/Services/SpellService.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/* global require, module */
'use strict';

var BaseService = require('./BaseService.js')
var BaseService = require('./BaseService.js');

var FireBall = require('../Spell/FireBall.js')
var FireBall = require('../Spell/FireBall.js');

var SpellService = function() {
var spellService = {};
spellService.__proto__ = BaseService({
"FireBall": new FireBall()
'FireBall': new FireBall()
});

return spellService;
}
};

module.exports = SpellService;
7 changes: 4 additions & 3 deletions lib/Spell/BaseSpell.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/* global module */
'use strict';


var BaseSpell = function(){
var baseSpell = {};

baseSpell.depend = "";
baseSpell.depend = '';

baseSpell.start = function(caster, target){
baseSpell.start = function(){
/*Implement behavior spell*/
}
};

return baseSpell;
};
Expand Down
7 changes: 4 additions & 3 deletions lib/Spell/FireBall.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require, module */
'use strict';

var BaseSpell = require('./BaseSpell.js');
Expand All @@ -7,17 +8,17 @@ var FireBall = function() {
var fireBall = {};
fireBall.__proto__ = BaseSpell();

fireBall.depend = "IN";
fireBall.depend = 'IN';

fireBall.start = function(caster, target, modifier){
if(modifier == null){
if(modifier === null){
modifier = utils.MODIFIER.CASUAL;
}
var alea = utils.des(100) + modifier;
if(utils.isSuccess(alea, caster[this.depend])<=0) {
target.B --;
}
}
};


return fireBall;
Expand Down
19 changes: 9 additions & 10 deletions lib/Util/Util.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* jshint undef : true */
/* global require, module */
'use strict';
/**
* Util class
*/
/*global module, require */
var _ = require('underscore');
/*global module */

var Util = function(){

Expand All @@ -30,8 +29,8 @@ Util.des = function(number){
*/
Util.isSuccess = function(value, comparator){
var diff = 0;
if(value == 0 || value == 1)
diff = 0 // successfull
if(value === 0 || value === 1)
diff = 0; // successfull

if(value == 99 || value == 100)
diff = -999; // epic fail
Expand All @@ -48,11 +47,11 @@ Util.isSuccess = function(value, comparator){
* saut = des(100) + Util.MODIFIER.CASUAL;
*/
Util.MODIFIER = {
"VERY_HARD" : 30,
"HARD" : 20,
"CASUAL" : 0,
"EASY" : -20,
"VERY_EASY" : -30,
'VERY_HARD' : 30,
'HARD' : 20,
'CASUAL' : 0,
'EASY' : -20,
'VERY_EASY' : -30,
};


Expand Down

0 comments on commit 261fae1

Please sign in to comment.