From 24165487cc071168cb1f3bead00886a0d332e1d6 Mon Sep 17 00:00:00 2001 From: Oreolek Date: Sun, 28 Apr 2013 10:14:20 +0700 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=20=D0=BF=D0=B5=D1=80=D1=81=D0=BE=D0=BD=D0=B0=D0=B6?= =?UTF-8?q?=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _layouts/main.html | 2 +- chargen.html | 11 +++ creating.markdown | 3 + javascripts/chargen.js | 177 +++++++++++++++++++++++++++++++++++ stylesheets/chargen.css | 186 +++++++++++++++++++++++++++++++++++++ stylesheets/stylesheet.css | 5 +- 6 files changed, 382 insertions(+), 2 deletions(-) create mode 100644 chargen.html create mode 100644 javascripts/chargen.js create mode 100644 stylesheets/chargen.css diff --git a/_layouts/main.html b/_layouts/main.html index 201820e..3eed0e7 100644 --- a/_layouts/main.html +++ b/_layouts/main.html @@ -8,7 +8,7 @@ - + diff --git a/chargen.html b/chargen.html new file mode 100644 index 0000000..62c3d91 --- /dev/null +++ b/chargen.html @@ -0,0 +1,11 @@ +--- +layout: main +--- + + +
+
+
+
Осталось отметить навыков:
+
+
diff --git a/creating.markdown b/creating.markdown index 06403c2..b1b887b 100644 --- a/creating.markdown +++ b/creating.markdown @@ -2,6 +2,9 @@ layout: main --- # Создание персонажа + +Для удобства существует [онлайн-генератор](chargen.html) персонажей 1го уровня. + ## Первичные характеристики Каждая из характеристик может принимать любое значение от 1 до 10 включительно. diff --git a/javascripts/chargen.js b/javascripts/chargen.js new file mode 100644 index 0000000..c2ebc7a --- /dev/null +++ b/javascripts/chargen.js @@ -0,0 +1,177 @@ +function parameter(id, name, value) { + if (typeof value === 'undefined') { + value = 5; + } + return { + id: id, + name: name, + value: value, + tagged: false + }; +} +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('armor_class','Базовый класс брони', function(specials){ + return specials.agility.value; + }), + parameter('melee_damage','Рукопашный урон', function(specials){ + return positive(specials.strength.value - 5); + }) + ], + skills: [ + parameter('guns','Огнестрельное Оружие', function(specials){ + return specials.agility.value * 2; + }), + parameter('archery','Стрельба из лука', function(specials){ + return 5 + specials.strength.value + specials.agility.value; + }), + parameter('melee','Холодное оружие', function(specials){ + return 20 + 2 * (specials.strength.value + specials.agility.value); + }), + parameter('unarmed','Рукопашный бой', function(specials){ + return 30 + 2 * (specials.strength.value + specials.agility.value); + }), + parameter('throwing','Метание', function(specials){ + return 4 * specials.agility.value; + }), + parameter('lockpick','Взлом', function(specials){ + return 10 + specials.agility.value + specials.intelligence.value; + }), + parameter('first_aid','Медицина', function(specials){ + return 15 + specials.intelligence.value; + }), + parameter('repair','Ремонт', function(specials){ + return 3 * specials.intelligence.value; + }), + parameter('science','Наука', function(specials){ + return 4 * specials.intelligence.value; + }), + parameter('stealth','Скрытность', function(specials){ + return 3 * specials.agility.value; + }), + parameter('performance','Выступление', function(specials){ + return 4 * specials.intelligence.value; + }), + parameter('survival','Выживание', function(specials){ + return 2 * (specials.endurance.value + specials.intelligence.value); + }), + parameter('animal_handling','Обращение с животными', function(specials){ + return specials.agility.value + specials.strength.value + specials.intelligence.value; + }), + parameter('driving','Вождение', function(specials){ + return 2 * (specials.agility.value + specials.endurance.value); + }) + ] +}; +function update_derived() { + var i = 0; + var text = ''; + jQuery('#derived').empty(); + jQuery('#skills').empty(); + for (i = 0; i < options.derived.length; i++) { + value = options.derived[i].value(options.specials); + jQuery('#derived').append('
'+ value + '
' + options.derived[i].name + '
'); + } + for (i = 0; i < options.skills.length; i++) { + value = options.skills[i].value(options.specials); + if (options.skills[i].tagged) value = value + 15; + text = '
'+ value + '
' + options.skills[i].name + '
'; + jQuery('#skills').append(text); + jQuery('#skills_to_tag').text(options.skills_to_tag); + } +} + +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('#skills').on('click', 'input[type=checkbox]', function (event) { + if (jQuery(this).is(':checked')) { + if (options.skills_to_tag > 0){ + options.skills_to_tag--; + jQuery(this).attr('checked', 'true'); + } else { + event.preventDefault(); + return false; + } + } + else { + options.skills_to_tag++; + jQuery(this).removeAttr('checked'); + } + chosen_skill = jQuery(this).attr('name'); + options.skills[chosen_skill].tagged = !options.skills[chosen_skill].tagged; + update_derived(); + }); + jQuery('#specials .increment').click(function () { + if (options.special_points == 0) return false; + options.special_points--; + for (i = 0; i < objects.length; i++) { + if (options.specials[objects[i]].id == jQuery(this).siblings(".value").attr('id')) { + options.specials[objects[i]].value++; + jQuery(this).siblings(".value").text(' '+options.specials[objects[i]].value+' '); + break; + } + } + update_derived(); + }); + jQuery('#specials .decrement').click(function () { + options.special_points++; + for (i = 0; i < objects.length; i++) { + if (options.specials[objects[i]].id == jQuery(this).siblings(".value").attr('id')) { + options.specials[objects[i]].value--; + jQuery(this).siblings(".value").text(' '+options.specials[objects[i]].value+' '); + break; + } + } + update_derived(); + }); +}); diff --git a/stylesheets/chargen.css b/stylesheets/chargen.css new file mode 100644 index 0000000..9d9fd9b --- /dev/null +++ b/stylesheets/chargen.css @@ -0,0 +1,186 @@ +/* + 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: 43.888888888888886em; +} +.group { + margin-top: 18px; + width: 21.666666666666668em; +} +.group .parameter { + width: 3.888888888888889em; + display: inline-block; +} +.group .parameter .value { + display: inline; +} +.group .name { + width: 17.22222222222222em; + display: inline-block; +} +.group .name input { + margin-left: 0.5em; +} +#specials { + float: left; +} +#specials .value, +#skills .value { + text-align: left; +} +#specials .name, +#skills .name { + text-align: right; +} +#derived { + float: right; +} +#derived .value { + text-align: right; +} +#derived .name { + text-align: left; +} +.increment, +.decrement { + visibility: visible; +} +#skills { + /* checkboxes! */ + +} +/* Colors */ +body { + color: #000000; +} +a { + color: #0000ff; +} diff --git a/stylesheets/stylesheet.css b/stylesheets/stylesheet.css index 6a618f3..33980d1 100644 --- a/stylesheets/stylesheet.css +++ b/stylesheets/stylesheet.css @@ -578,4 +578,7 @@ footer .owner p a { .highlight .vc { color: #008080 } /* Name.Variable.Class */ .highlight .vg { color: #008080 } /* Name.Variable.Global */ .highlight .vi { color: #008080 } /* Name.Variable.Instance */ -.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ \ No newline at end of file +.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ +footer, #container:after { + clear: both; +}