mirror of
https://github.com/Oreolek/shooter.git
synced 2024-05-05 02:18:15 +03:00
Gulp watches, first scripted event
This commit is contained in:
parent
769014ff36
commit
3e44dae384
25
Gulpfile.js
25
Gulpfile.js
|
@ -14,7 +14,7 @@ var watchify = require('watchify'),
|
||||||
buffer = require('vinyl-buffer'),
|
buffer = require('vinyl-buffer'),
|
||||||
zip = require('gulp-zip'),
|
zip = require('gulp-zip'),
|
||||||
_ = require('lodash'),
|
_ = require('lodash'),
|
||||||
concat = require('gulp-concat');
|
concat = require('gulp-concat'),
|
||||||
|
|
||||||
var reload = browserSync.reload;
|
var reload = browserSync.reload;
|
||||||
|
|
||||||
|
@ -66,13 +66,18 @@ gulp.task('buildUndum', function () {
|
||||||
|
|
||||||
/* Generate JavaScript with browser sync. */
|
/* Generate JavaScript with browser sync. */
|
||||||
|
|
||||||
var customOpts = {
|
var sources = [
|
||||||
entries: ['./build/game/main.coffee'],
|
'./game/begin.coffee',
|
||||||
|
'./game/gameplay.coffee',
|
||||||
|
'./game/story.coffee',
|
||||||
|
'./game/end.coffee',
|
||||||
|
]
|
||||||
|
|
||||||
|
var opts = _.assign({}, watchify.args, {
|
||||||
|
entries: ["./build/game/main.coffee"],
|
||||||
debug: true,
|
debug: true,
|
||||||
transform: [coffeify]
|
transform: [coffeify]
|
||||||
};
|
});
|
||||||
|
|
||||||
var opts = _.assign({}, watchify.args, customOpts);
|
|
||||||
var bundler = watchify(browserify(opts));
|
var bundler = watchify(browserify(opts));
|
||||||
bundler.external('undum-commonjs');
|
bundler.external('undum-commonjs');
|
||||||
|
|
||||||
|
@ -89,12 +94,7 @@ gulp.task('copyTranslations', [], function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('concatCoffee', ['copyTranslations'], function() {
|
gulp.task('concatCoffee', ['copyTranslations'], function() {
|
||||||
return gulp.src([
|
return gulp.src(sources)
|
||||||
'./game/begin.coffee',
|
|
||||||
'./game/gameplay.coffee',
|
|
||||||
'./game/story.coffee',
|
|
||||||
'./game/end.coffee',
|
|
||||||
])
|
|
||||||
.pipe(concat('./main.coffee'))
|
.pipe(concat('./main.coffee'))
|
||||||
.pipe(gulp.dest('./build/game'));
|
.pipe(gulp.dest('./build/game'));
|
||||||
});
|
});
|
||||||
|
@ -127,6 +127,7 @@ gulp.task('serve', ['build'], function () {
|
||||||
gulp.watch(['./html/*.html'], ['html']);
|
gulp.watch(['./html/*.html'], ['html']);
|
||||||
gulp.watch(['./less/*.less'], ['less']);
|
gulp.watch(['./less/*.less'], ['less']);
|
||||||
gulp.watch(['./img/*.png', './img/*.jpeg', './img/*.jpg'], ['img']);
|
gulp.watch(['./img/*.png', './img/*.jpeg', './img/*.jpg'], ['img']);
|
||||||
|
gulp.watch(['./game/*.coffee'], ['coffee']);
|
||||||
|
|
||||||
gulp.watch(['./build/css/main.css'], lessListener);
|
gulp.watch(['./build/css/main.css'], lessListener);
|
||||||
gulp.watch(
|
gulp.watch(
|
||||||
|
|
|
@ -14,6 +14,11 @@ undum.language["en"] = undumloc
|
||||||
$ = require("jquery")
|
$ = require("jquery")
|
||||||
Array.prototype.oneOf = () ->
|
Array.prototype.oneOf = () ->
|
||||||
oneOf.apply(null, this)
|
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.id = "7a1aba32-f0fd-4e3b-ba5a-59e3fa9e6012"
|
||||||
undum.game.version = "2.0"
|
undum.game.version = "2.0"
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
# a) remove bullet counter (you don't know how many bullets left in a clip)
|
# 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)
|
# 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) ->
|
kill_enemy = (character, system) ->
|
||||||
if character.qualities.enemies == 0
|
if character.qualities.enemies == 0
|
||||||
return
|
return
|
||||||
|
@ -64,9 +69,13 @@ situation "hit",
|
||||||
choices: ["#shoot"]
|
choices: ["#shoot"]
|
||||||
before: (character, system, from) ->
|
before: (character, system, from) ->
|
||||||
kill_enemy(character, system)
|
kill_enemy(character, system)
|
||||||
|
after: (character, system, from) ->
|
||||||
|
scripted_events(character, system, from)
|
||||||
choices: ["#shoot"]
|
choices: ["#shoot"]
|
||||||
|
|
||||||
situation "nicked",
|
situation "nicked",
|
||||||
|
after: (character, system, from) ->
|
||||||
|
scripted_events(character, system, from)
|
||||||
content: (character, system, from) ->
|
content: (character, system, from) ->
|
||||||
if character.sandbox.nicked == 1
|
if character.sandbox.nicked == 1
|
||||||
kill_enemy(character, system)
|
kill_enemy(character, system)
|
||||||
|
@ -79,12 +88,16 @@ situation "nicked",
|
||||||
choices: ["#shoot"]
|
choices: ["#shoot"]
|
||||||
|
|
||||||
situation "miss",
|
situation "miss",
|
||||||
|
after: (character, system, from) ->
|
||||||
|
scripted_events(character, system, from)
|
||||||
content: (character, system, from) ->
|
content: (character, system, from) ->
|
||||||
response = "player_missed".l().oneOf().randomly(system)
|
response = "player_missed".l().oneOf().randomly(system)
|
||||||
return response()
|
return response()
|
||||||
choices: ["#shoot"]
|
choices: ["#shoot"]
|
||||||
|
|
||||||
situation "trick",
|
situation "trick",
|
||||||
|
after: (character, system, from) ->
|
||||||
|
scripted_events(character, system, from)
|
||||||
before: (character, system, from) ->
|
before: (character, system, from) ->
|
||||||
kill_enemy(character, system)
|
kill_enemy(character, system)
|
||||||
kill_enemy(character, system)
|
kill_enemy(character, system)
|
||||||
|
@ -100,8 +113,8 @@ situation "shoot",
|
||||||
canChoose: (character, system) ->
|
canChoose: (character, system) ->
|
||||||
return character.qualities.bullets > 0
|
return character.qualities.bullets > 0
|
||||||
before: (character, system, from) ->
|
before: (character, system, from) ->
|
||||||
spend_bullet(character, system)
|
|
||||||
system.clearContent()
|
system.clearContent()
|
||||||
|
spend_bullet(character, system)
|
||||||
after: (character, system, from) ->
|
after: (character, system, from) ->
|
||||||
roll = system.rnd.dice(1,20) # d20 roll
|
roll = system.rnd.dice(1,20) # d20 roll
|
||||||
hit_threshold = 15
|
hit_threshold = 15
|
||||||
|
|
|
@ -27,13 +27,19 @@ module.exports.language =
|
||||||
"""
|
"""
|
||||||
endintro: """
|
endintro: """
|
||||||
Раньше, чем я успеваю открыть рот, перед нами открывается большой зелёный портал,
|
Раньше, чем я успеваю открыть рот, перед нами открывается большой зелёный портал,
|
||||||
из которого выходит высокий металлический человек.
|
из которого выходит высокий металлический человекоподобный робот с хромированным телом.
|
||||||
|
Он поднимает руку и наставляет её на Кристину.
|
||||||
|
|
||||||
-- Стоять!
|
Я выхватываю пистолет раньше, чем я успеваю увидеть короткую палочку в руке робота.
|
||||||
|
"""
|
||||||
|
firstmove: """
|
||||||
|
Кристина вскидывает руки в знак <i>Фитнаг.</i>
|
||||||
|
|
||||||
-- Дорогая, -- я отставляю её в сторону и встаю между ней и злым роботом. -- Пули говорят быстрее слов.
|
-- Стреляй во всё!
|
||||||
|
|
||||||
(игрок нажимает на кнопку, Кристина комментирует в случае промаха.)
|
Как по команде, зелёная поверхность портала дрогнула, и оттуда шагнула хромированная нога.
|
||||||
|
|
||||||
|
-- Дорогая, -- я отставляю её в сторону и встаю между ней и злым роботом. -- Пули говорят быстрее слов.
|
||||||
"""
|
"""
|
||||||
androidattack: "Один из андроидов доходит до меня и кусает!"
|
androidattack: "Один из андроидов доходит до меня и кусает!"
|
||||||
emptyclip: "Я выбрасываю пустой картридж."
|
emptyclip: "Я выбрасываю пустой картридж."
|
||||||
|
|
|
@ -51,9 +51,6 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The title block */
|
/* The title block */
|
||||||
#title, #title .label, #content, .tools {
|
|
||||||
border-radius: 2px;
|
|
||||||
}
|
|
||||||
#title {
|
#title {
|
||||||
max-width: 28em;
|
max-width: 28em;
|
||||||
margin: 2.2em auto 1.1em auto;
|
margin: 2.2em auto 1.1em auto;
|
||||||
|
@ -61,7 +58,6 @@ body {
|
||||||
cursor: pointer; /* Until we click to start. */
|
cursor: pointer; /* Until we click to start. */
|
||||||
.label {
|
.label {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 2.0em;
|
|
||||||
margin: auto;
|
margin: auto;
|
||||||
max-width: 18em;
|
max-width: 18em;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -112,10 +108,6 @@ body {
|
||||||
}
|
}
|
||||||
.click_message {
|
.click_message {
|
||||||
display: none;
|
display: none;
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
position: absolute;
|
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
Loading…
Reference in a new issue