diff --git a/Gulpfile.js b/Gulpfile.js index 7beaec9..cca79b3 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -14,7 +14,7 @@ var watchify = require('watchify'), buffer = require('vinyl-buffer'), zip = require('gulp-zip'), _ = require('lodash'), - concat = require('gulp-concat'); + concat = require('gulp-concat'), var reload = browserSync.reload; @@ -66,13 +66,18 @@ gulp.task('buildUndum', function () { /* Generate JavaScript with browser sync. */ -var customOpts = { - entries: ['./build/game/main.coffee'], +var sources = [ + './game/begin.coffee', + './game/gameplay.coffee', + './game/story.coffee', + './game/end.coffee', +] + +var opts = _.assign({}, watchify.args, { + entries: ["./build/game/main.coffee"], debug: true, transform: [coffeify] -}; - -var opts = _.assign({}, watchify.args, customOpts); +}); var bundler = watchify(browserify(opts)); bundler.external('undum-commonjs'); @@ -89,12 +94,7 @@ gulp.task('copyTranslations', [], function() { }); gulp.task('concatCoffee', ['copyTranslations'], function() { - return gulp.src([ - './game/begin.coffee', - './game/gameplay.coffee', - './game/story.coffee', - './game/end.coffee', - ]) + return gulp.src(sources) .pipe(concat('./main.coffee')) .pipe(gulp.dest('./build/game')); }); @@ -127,6 +127,7 @@ gulp.task('serve', ['build'], function () { gulp.watch(['./html/*.html'], ['html']); gulp.watch(['./less/*.less'], ['less']); gulp.watch(['./img/*.png', './img/*.jpeg', './img/*.jpg'], ['img']); + gulp.watch(['./game/*.coffee'], ['coffee']); gulp.watch(['./build/css/main.css'], lessListener); gulp.watch( diff --git a/game/begin.coffee b/game/begin.coffee index 48bf105..7ef4226 100644 --- a/game/begin.coffee +++ b/game/begin.coffee @@ -14,6 +14,11 @@ undum.language["en"] = undumloc $ = require("jquery") Array.prototype.oneOf = () -> oneOf.apply(null, this) +md = require('markdown-it') +markdown = new md({ + typographer: true, + html: true +}) undum.game.id = "7a1aba32-f0fd-4e3b-ba5a-59e3fa9e6012" undum.game.version = "2.0" diff --git a/game/gameplay.coffee b/game/gameplay.coffee index a214263..d12629a 100644 --- a/game/gameplay.coffee +++ b/game/gameplay.coffee @@ -3,6 +3,11 @@ # a) remove bullet counter (you don't know how many bullets left in a clip) # b) remove canChoose restriction (you can shoot any time you want, but if you have no bullets - nothing comes out and you've lost a turn) +# Scripted events. Called *after* every shot. +scripted_events = (character, system) -> + if character.sandbox.shots == 1 + writemd(system, "firstmove".l()) + kill_enemy = (character, system) -> if character.qualities.enemies == 0 return @@ -64,9 +69,13 @@ situation "hit", choices: ["#shoot"] before: (character, system, from) -> kill_enemy(character, system) + after: (character, system, from) -> + scripted_events(character, system, from) choices: ["#shoot"] situation "nicked", + after: (character, system, from) -> + scripted_events(character, system, from) content: (character, system, from) -> if character.sandbox.nicked == 1 kill_enemy(character, system) @@ -79,12 +88,16 @@ situation "nicked", choices: ["#shoot"] situation "miss", + after: (character, system, from) -> + scripted_events(character, system, from) content: (character, system, from) -> response = "player_missed".l().oneOf().randomly(system) return response() choices: ["#shoot"] situation "trick", + after: (character, system, from) -> + scripted_events(character, system, from) before: (character, system, from) -> kill_enemy(character, system) kill_enemy(character, system) @@ -100,8 +113,8 @@ situation "shoot", canChoose: (character, system) -> return character.qualities.bullets > 0 before: (character, system, from) -> - spend_bullet(character, system) system.clearContent() + spend_bullet(character, system) after: (character, system, from) -> roll = system.rnd.dice(1,20) # d20 roll hit_threshold = 15 diff --git a/game/translations/ru.coffee b/game/translations/ru.coffee index dc116b6..75e10d3 100644 --- a/game/translations/ru.coffee +++ b/game/translations/ru.coffee @@ -27,13 +27,19 @@ module.exports.language = """ endintro: """ Раньше, чем я успеваю открыть рот, перед нами открывается большой зелёный портал, - из которого выходит высокий металлический человек. + из которого выходит высокий металлический человекоподобный робот с хромированным телом. + Он поднимает руку и наставляет её на Кристину. - -- Стоять! + Я выхватываю пистолет раньше, чем я успеваю увидеть короткую палочку в руке робота. + """ + firstmove: """ + Кристина вскидывает руки в знак Фитнаг. - -- Дорогая, -- я отставляю её в сторону и встаю между ней и злым роботом. -- Пули говорят быстрее слов. + -- Стреляй во всё! - (игрок нажимает на кнопку, Кристина комментирует в случае промаха.) + Как по команде, зелёная поверхность портала дрогнула, и оттуда шагнула хромированная нога. + + -- Дорогая, -- я отставляю её в сторону и встаю между ней и злым роботом. -- Пули говорят быстрее слов. """ androidattack: "Один из андроидов доходит до меня и кусает!" emptyclip: "Я выбрасываю пустой картридж." diff --git a/less/layout.less b/less/layout.less index df29837..468e587 100644 --- a/less/layout.less +++ b/less/layout.less @@ -51,9 +51,6 @@ body { } /* The title block */ -#title, #title .label, #content, .tools { - border-radius: 2px; -} #title { max-width: 28em; margin: 2.2em auto 1.1em auto; @@ -61,7 +58,6 @@ body { cursor: pointer; /* Until we click to start. */ .label { overflow: hidden; - padding: 2.0em; margin: auto; max-width: 18em; position: relative; @@ -112,10 +108,6 @@ body { } .click_message { display: none; - left: 0; - right: 0; - bottom: 0; - position: absolute; font-size: 0.9em; font-style: italic; text-align: center;