0.8.17 • Published 10 years ago

attribute-generator v0.8.17

Weekly downloads
9
License
MIT
Repository
-
Last release
10 years ago

Synopsis

A simple program to apply modifiers to json (items)

Code Example

var AttributeGenerator = require('attribute-generator');

var ItemArray = AttributeGenerator.ItemArray;
var Modifier = AttributeGenerator.Modifier;
var Item = AttributeGenerator.Item;

var shield = new Item("Shield", {
    name : "Ceramic Shield",
    armor : 5,
    durability : 15
});

var crackedMod = new Modifier("Cracked", {
    name : Modifier.Ops.Prepend("Cracked "),
    armor : Modifier.Ops.Subtract(2),
    durability : Modifier.Ops.Subtract(3)
});

shield.Apply(crackedMod);

console.log(shield.ExportItemObject());
console.log(crackedMod.Serialize());

{ key: 'Shield:Cracked',
  item: { name: 'Cracked Ceramic Shield', armor: 3, durability: 12 } }
{ mods:
   [ { name: 'name', operation: 'Prepend', value: 'Cracked ' },
     { name: 'armor', operation: 'Subtract', value: 2 },
     { name: 'durability', operation: 'Subtract', value: 3 } ],
  name: 'Cracked' }

Motivation

Installation

npm install attribute-generator

API Reference

// Items are JSON objects that can have modifiers applied to them

Tests

None yet /:

Contributors

Alexander Dines /w Black Tower Entertainment

License

MIT

0.8.17

10 years ago

0.8.16

10 years ago

0.8.15

10 years ago

0.8.14

10 years ago

0.8.13

10 years ago

0.8.12

10 years ago

0.8.11

10 years ago

0.8.10

10 years ago

0.8.9

10 years ago

0.8.8

10 years ago

0.8.7

10 years ago

0.8.6

10 years ago

0.8.5

10 years ago

0.8.3

10 years ago

0.8.2

10 years ago

0.8.1

10 years ago

0.0.8

10 years ago