commit d6f568dc7ad118467345f7de74f946962b6f81d6 Author: Oreolek Date: Mon Nov 5 19:13:05 2012 +0700 Initial commit - not usable Still working on the scripting and layout. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b5f39df --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +all: + lessc style.less >style.css diff --git a/README.md b/README.md new file mode 100644 index 0000000..715bf19 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +It's a simple character generator for my tabletop RPG system. + +My system has close resemblance to the SPECIAL system (Fallout 2) :-) but still there are differences. The generator is flexible and is quick to configure for any similar set of rules. + +Used libraries: [jQuery](http://jquery.com), [LESS](http://www.lesscss.org). + +Texture by webtreats: http://www.flickr.com/photos/webtreatsetc/4081217898/ (CC-BY 2.0) + +Text is in Russian, but code should be obvious. diff --git a/bgr.jpg b/bgr.jpg new file mode 100644 index 0000000..713fca1 Binary files /dev/null and b/bgr.jpg differ diff --git a/chargen.html b/chargen.html new file mode 100644 index 0000000..f8c78e5 --- /dev/null +++ b/chargen.html @@ -0,0 +1,79 @@ + + + +Генератор персонажа + + + + + + +
+
+
+ +
+
+
Энергетическое Оружие
+
+
+
+
Огнестрельное Оружие
+
+
+
+
Стрельба из лука
+
+
+
+
Холодное оружие
+
+
+
+
Рукопашный бой
+
+
+
+
Метание
+
+
+
+
Взлом
+
+
+
+
Медицина
+
+
+
+
Ремонт
+
+
+
+
Наука
+
+
+
+
Скрытность
+
+
+
+
Выступление
+
+
+
+
Выживание
+
+
+
+
Обращение с животными
+
+
+
+
Вождение
+
+
+
+
+ + diff --git a/script.js b/script.js new file mode 100644 index 0000000..093db15 --- /dev/null +++ b/script.js @@ -0,0 +1,100 @@ +function parameter(id, name, value) { + if (typeof value === 'undefined') { + value = 5; + } + return { + id: id, + name: name, + value: value + }; +} +parameter.prototype.increment = function () { + this.value = this.value + 1; +}; +parameter.prototype.decrement = function () { + this.value = this.value - 1; +}; +function positive(value) { + if (value < 1) return 1; + else return value; +} +var options = { + specials: { + strength: parameter('strength', 'Сила'), + endurance: parameter('endurance', 'Выносливость'), + charisma: parameter('charisma', 'Обаяние'), + intelligence: parameter('intelligence', 'Интеллект'), + agility: parameter('agility', 'Ловкость'), + luck: parameter('luck', 'Удача'), + }, + special_points: 5, + skills_to_tag: 3, + derived: [ + parameter('action_points','Очки действий', function(specials){ + return Math.floor(5 + specials.agility.value * 0.5); + }), + parameter('carry_weight','Максимальный вес, кг', function(specials){ + return 6 + specials.strength.value * 10; + }), + parameter('critical_chance','Критический шанс, %', function(specials){ + return specials.luck.value; + }), + parameter('hit_points','Очки Здоровья', function(specials){ + return 15 + specials.strength.value + specials.endurance.value * 2; + }), + parameter('skill_points','Очки навыков на уровень', function(specials){ + return 5 + specials.intelligence.value * 2; + }), + parameter('combat_sequence','Очерёдность в бою', function(specials){ + return Math.floor(specials.agility.value + (specials.luck.value + specials.strength.value) * 0.5); + }), + parameter('healing_rate','Скорость лечения', function(specials){ + return specials.endurance.value + 6; + }), + parameter('throwing_range','Дальность броска, м', function(specials){ + return specials.strength.value + 6; + }), + parameter('poison_resistance','Сопротивление яду, %', function(specials){ + return specials.endurance.value * 5; + }), + parameter('radiation_resistance','Сопротивление радиации, %', function(specials){ + return specials.endurance.value * 2; + }), + parameter('armor_class','Базовый класс брони', function(specials){ + return specials.agility.value; + }), + parameter('melee_damage','Рукопашный урон', function(specials){ + return positive(specials.strength.value - 5); + }) + ], + skills: { + } +}; +function rewrite_value(newvalue) { + jQuery(this).siblings(".value").text(newvalue); +} +function update_derived() { + var i = 0; + jQuery('#derived').empty(); + for (i = 0; i < options.derived.length; i++) { + jQuery('#derived').append('
'+ options.derived[i].value(options.specials) + '
' + options.derived[i].name + '
'); + } +} + +jQuery(document).ready(function () { + var i = 0; + objects = ['strength', 'endurance', 'charisma', 'intelligence', 'agility', 'luck']; + for (i = 0; i < objects.length; i++) { + jQuery('#specials').append('
'+ options.specials[objects[i]].value + '
+
' + options.specials[objects[i]].name + '
'); + } + update_derived(); + jQuery('#specials .increment').click(function () { + for (i = 0; i < objects.length; i++) { + if (options.specials[objects[i]].id === jQuery(this).id) { + options.specials[objects[i]].increment(); + rewrite_value(options.specials[objects[i]].value); + } + } + update_derived(); + }); +}); diff --git a/style.less b/style.less new file mode 100644 index 0000000..3da99c8 --- /dev/null +++ b/style.less @@ -0,0 +1,159 @@ +@font-size: 18; //in pixels + +@column: 30; +@gutter: 10; +@columns: 12; +//@total-width: 100%; + +// from Frameless - http://framelessgrid.com/ +.width (@cols:1) { + width: (@cols * (@column + @gutter) - @gutter) / @font-size * 1em; +} + +/* + Margin, padding, and border resets + except for form elements +*/ + +body, div, +h1, h2, h3, h4, h5, h6, +p, blockquote, pre, dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, th, td, +article, aside, figure, footer, header, hgroup, menu, nav, section { + margin: 0; + padding: 0; + border: 0; +} + + +/* + Consistency fixes + adopted from http://necolas.github.com/normalize.css/ +*/ + +article, aside, details, figcaption, figure, +footer, header, hgroup, nav, section, audio, canvas, video { + display: block; +} + +html { + height: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + + body {min-height: 100%; font-size: 100%;} + +sub, sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup {top: -0.5em;} +sub {bottom: -0.25em;} + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +b, strong {font-weight: bold;} +abbr[title] {border-bottom: 1px dotted;} + +table { + border-collapse: collapse; + border-spacing: 0; +} + +a img, img { + -ms-interpolation-mode: bicubic; + border: 0; +} + +input, textarea, button, select { + margin: 0; + font-size: 100%; + line-height: normal; + vertical-align: baseline; +} + +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + cursor: pointer; + -webkit-appearance: button; +} + +input[type="checkbox"], +input[type="radio"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -o-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} + +textarea {overflow: auto;} + +#wrapper_overview{ + margin: 1em auto; + .width(20); +} +.group{ + .width(10); + .parameter{ + .width(2); + display: inline-block; + .value{ + display: inline; + } + } + .name{ + .width(8); + display: inline-block; + } +} +.invert(left){ + text-align: right; +} +.invert(right){ + text-align: left; +} +.align(@x) { + float: @x; + .value{ + text-align: @x; + } + .name{ + .invert(@x); + } +} + +#specials, #skills{ + .align(left); +} +#derived{ + .align(right); +} + +.increment, .decrement{ + visibility: visible; +} +#skills{ + /* checkboxes! */ +} +/* Colors */ +@text: #be008a; +@background: #7c005a; +@links: #df64bd; +body{ + background: url('bgr.jpg'); + color: @text; +} +a { + color: @links; +}