Permalink
Browse files

Add ability mods.

  • Loading branch information...
1 parent 35429b4 commit edd4f7fa6765625a41cdcc6f2b051637c8de274a @gatesvp committed Sep 26, 2011
Showing with 58 additions and 19 deletions.
  1. +4 −4 party/listing.js
  2. +10 −8 public/css/main.css
  3. +44 −7 views/party_edit.jade
View
@@ -25,7 +25,7 @@ module.exports.show = function(mongodb, mongourl, id, req, res, next){
module.exports.create = function(mongodb, mongourl, req, res, next){
var player = get_empty_player();
- res.render('party_edit', { player: player, skills: skill_list })
+ res.render('party_edit', { player: player, skills: skills_list })
}
@@ -47,7 +47,7 @@ module.exports.edit = function(mongodb, mongourl, id, req, res, next){
/* save the change and re-render the page */
party.update({_id: id}, {$set: update}, {safe:true, upsert:true}, function(err, doc) {
party.findOne({_id: id}, function(err, player){
- res.render('party_edit', { player: player, skills: skill_list });
+ res.render('party_edit', { player: player, skills: skills_list });
conn.close();
});
});
@@ -57,7 +57,7 @@ module.exports.edit = function(mongodb, mongourl, id, req, res, next){
get_empty_player = function(){
var player = { level:1, race: 'human', class: 'unknown', hp: 30, spd: 6, init: 6,
- str: 10, dex: 10, con: 10, int: 10, wis: 10, cha: 10, ac: 15, fort: 15, ref: 15, will: 15};
+ str: 10, dex: 10, con: 10, int: 10, wis: 10, cha: 10, ac: 10, fort: 10, ref: 10, will: 10};
player._id = null;
@@ -66,7 +66,7 @@ get_empty_player = function(){
player.skills = {};
for(skill in skills_list){
- player.skills[skills_list[skill]] = {check: 10, trained: false};
+ player.skills[skills_list[skill]] = {check: 1, trained: false};
}
return player;
View
@@ -6,14 +6,6 @@
visibility: hidden;
}
-.shaded { background-color:#ddd; width: 180px; }
-.unshaded { background-color:#fff; width: 180px; }
-.stat { width: 20px; border: 0; }
-
-.skillname { float:left; width: 125px; }
-.skillcheck { float: left; text-align: right; }
-.skilltrained { float: left; text-align: right; }
-
a.ovalbutton{
background: transparent url('/images/oval-green-left.gif') no-repeat top left;
display: block;
@@ -53,3 +45,13 @@ a.ovalbutton:hover span{ /* Hover state CSS */
padding-left: 10px;
}
+/* Player renderings */
+.shaded { background-color:#ddd; width: 180px; }
+.unshaded { background-color:#fff; width: 180px; }
+.stat { width: 20px; border: 0; }
+
+.skillname { float:left; width: 125px; }
+.skillcheck { float: left; text-align: right; }
+.skilltrained { float: left; text-align: right; }
+
+
View
@@ -1,3 +1,34 @@
+mixin skill_inputs(skill)
+ .skillcheck
+ input.stat(id='#{skill}',type='text',value=player.skills[skill].check,name='skills.#{skill}.check')
+ .skilltrained
+ input(id='#{skill}_trained',type='checkbox',name='skills.#{skill}.trained',checked=player.skills[skill].trained)
+ .clearfix
+
+mixin ability_mod(score)
+ -if(score == 2 || score == 3)
+ span -4
+ -if(score == 4 || score == 5)
+ span -3
+ -if(score == 6 || score == 7)
+ span -2
+ -if(score == 8 || score == 9)
+ span -1
+ -if(score == 10 || score == 11)
+ span 0
+ -if(score == 12 || score == 13)
+ span +1
+ -if(score == 14 || score == 15)
+ span +2
+ -if(score == 16 || score == 17)
+ span +3
+ -if(score == 18 || score == 19)
+ span +4
+ -if(score == 20 || score == 21)
+ span +5
+ -if(score == 22 || score == 23)
+ span +6
+
form(name='edit_player',method='post',action='')
-if(player._id !== null)
h1 Edit #{player._id}
@@ -32,14 +63,20 @@ form(name='edit_player',method='post',action='')
input#passivei.stat(type='text',name='passive.insight',value=player.passive.insight,style="position:absolute;left:46px;top:250px;")
input#passivep.stat(type='text',name='passive.perception',value=player.passive.perception,style="position:absolute;left:46px;top:287px;")
- h2 Skills
+ div(style="position:absolute;left:157px;top:26px;")
+ mixin ability_mod(player.str)
+ div(style="position:absolute;left:157px;top:62px;")
+ mixin ability_mod(player.dex)
+ div(style="position:absolute;left:157px;top:98px;")
+ mixin ability_mod(player.con)
+ div(style="position:absolute;left:157px;top:132px;")
+ mixin ability_mod(player.int)
+ div(style="position:absolute;left:157px;top:170px;")
+ mixin ability_mod(player.wis)
+ div(style="position:absolute;left:157px;top:205px;")
+ mixin ability_mod(player.cha)
- mixin skill_inputs(skill)
- .skillcheck
- input.stat(id='#{skill}',type='text',value=player.skills[skill].check,name='skills.#{skill}.check')
- .skilltrained
- input(id='#{skill}_trained',type='checkbox',name='skills.#{skill}.trained',checked=player.skills[skill].trained)
- .clearfix
+ h2 Skills
each skill,i in skills
- if(i%2==0)

0 comments on commit edd4f7f

Please sign in to comment.