Sunday, May 2, 2010

v0.5 in Testing

v0.5 involved a complete rewrite of the data load scheme, and the way rules are handled. Basically, to add feat attack effects before, I had to add some JS to the calc_attack function (messy and does not scale). Now, I ask for all feats with an attack attribute (which is a function), and execute that block of code:

feat description:

attack: "if(weapon.category == 'exotic') { attacks.weapon_proficiency = 0; } return attacks;",


function calc_attack() {
...
char_feats.get({ attack : { "!is": null } }).forEach( function(feat, i) {
// TODO - can we do this by reference
console.log("attack: " + feat.name);
attacks = feat.attack(attacks, weapon);
return attacks;
});

While it's probably technically better, an unfortunate side-effect is that it no longer works on my friends' iPhones or my Android emulator. Must be my IBM training to write software for next-next generation hardware (I'm still waiting for a machine to run Lotus Notes).

No comments: