mirror of
https://github.com/Oreolek/shooter.git
synced 2024-06-17 07:10:45 +03:00
Trick shots!
This commit is contained in:
parent
8706a57ffb
commit
d703f56360
|
@ -132,7 +132,7 @@ gulp.task('undum-dist', function () {
|
|||
|
||||
gulp.task('html-dist', html('./dist'));
|
||||
gulp.task('img-dist', img('./dist/img'));
|
||||
gulp.task('audio-dist', img('./dist/audio'));
|
||||
gulp.task('audio-dist', audio('./dist/audio'));
|
||||
|
||||
gulp.task('less-dist', function () {
|
||||
return gulp.src('./less/main.less')
|
||||
|
|
|
@ -10,22 +10,22 @@ module.exports.language =
|
|||
"""
|
||||
androidattack: "One of androids is so close he bites me!"
|
||||
emptyclip: "I get rid of empty cartridge."
|
||||
player_hit:[
|
||||
player_hit: [
|
||||
"Android's head explodes like a Christmas fireworks.",
|
||||
"Android tries to dodge but finds himself right on the bullet's wrong side.
|
||||
He falls, flooding the floor with oil."
|
||||
]
|
||||
player_finished:[
|
||||
player_finished: [
|
||||
"I finish the android with a shot to his heart.",
|
||||
"I finish the android with a precise shot.",
|
||||
"The bullet pierces android's head and he finally falls on the floor motionless.",
|
||||
]
|
||||
player_nicked:[
|
||||
player_nicked: [
|
||||
"""I shoot the enemy's leg off.
|
||||
He falls but keeps slowly scratch his way with his hands.""",
|
||||
"I shoot through the android's arm. He stumbles but keeps going.",
|
||||
]
|
||||
shoot:[
|
||||
shoot: [
|
||||
"Shoot",
|
||||
"BAM!",
|
||||
"BLAM!",
|
||||
|
@ -42,7 +42,6 @@ module.exports.language =
|
|||
"Send a bullet to android",
|
||||
"Send a bullet with explosion",
|
||||
"Push the trigger FOR THE HUMANITY",
|
||||
"Jump to a wall and shoot while flying",
|
||||
"Sit down and shoot from a hip",
|
||||
"Take the pistol in both hands and push the trigger",
|
||||
"Slowly take aim and shoot",
|
||||
|
@ -53,7 +52,7 @@ module.exports.language =
|
|||
I hope it has some ammo.
|
||||
"""
|
||||
search: "Search for a clip"
|
||||
search_response:[
|
||||
search_response: [
|
||||
"I hastily search the floor, trying to find at least one cartridge intact.",
|
||||
"I quickly look around for a clip on the floor.",
|
||||
]
|
||||
|
@ -92,20 +91,39 @@ module.exports.language =
|
|||
* watupgroupie - [gunshots.mp3](http://freesound.org/people/watupgroupie/sounds/36815/)
|
||||
* qubodup - [Bullet silhoettes](https://openclipart.org/detail/29029/bullet-silhouettes)
|
||||
"""
|
||||
clips_not_found:[
|
||||
clips_not_found: [
|
||||
"No, nothing here.",
|
||||
"Come on, at least one! No, didn't find any."
|
||||
"Come on, at least one! No, didn't find any.",
|
||||
]
|
||||
health: 'Health'
|
||||
enemies: 'Enemies ahead'
|
||||
clips: 'Cartridges'
|
||||
bullets: 'Bullets in clip'
|
||||
clips_found:[
|
||||
"Aha! Got one. I hope it has some ammo.",
|
||||
clips_found: [
|
||||
'Aha! Got one. I hope it has some ammo.',
|
||||
"Eh, here's one. Looks heavy -- I hope it has some ammo.",
|
||||
]
|
||||
player_missed:[
|
||||
player_missed: [
|
||||
"The bullet flies over android's left arm.",
|
||||
"Android dodges the shot. It's alright, next time I won't miss.",
|
||||
"Damn! Missed.",
|
||||
]
|
||||
trick_shot: "Try a trick shot"
|
||||
player_trickshot: [
|
||||
"
|
||||
I run against a wall and jump, shooting while flying.
|
||||
The bullet flies through android's head into another one, knocking them both out.
|
||||
",
|
||||
"
|
||||
I notice a weak spot in the ceiling.
|
||||
A single shot there - and a section collapses, taking two enemies out.
|
||||
",
|
||||
]
|
||||
trick_shot_discover: (character) ->
|
||||
"""
|
||||
I count the clips.
|
||||
Only four left.
|
||||
I've killed #{character.sandbox.killed} androids, meaning, there are still... oh.
|
||||
OH.
|
||||
I gotta conserve the ammo.
|
||||
I can try trick shots but these are big risk.
|
||||
"""
|
||||
|
|
|
@ -40,6 +40,16 @@ Array.prototype.oneOf = () ->
|
|||
# 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)
|
||||
|
||||
kill_enemy = (character, system) ->
|
||||
if character.qualities.enemies == 0
|
||||
return
|
||||
character.sandbox.nicked = 0
|
||||
character.sandbox.killed++
|
||||
if character.qualities.enemies >= 1
|
||||
system.setQuality("enemies", character.qualities.enemies - 1)
|
||||
if character.qualities.enemies == 0
|
||||
system.doLink("finale")
|
||||
|
||||
spend_bullet = (character, system) ->
|
||||
bullets = character.sandbox.clips[character.sandbox.current_clip]
|
||||
character.sandbox.shots++
|
||||
|
@ -77,11 +87,6 @@ spend_clip = (character, system) ->
|
|||
system.setQuality("bullets", bullets)
|
||||
$("#clip img").attr("src", "img/clip"+bullets+".png")
|
||||
|
||||
check_distance = (character, system) ->
|
||||
if character.sandbox.distance == 0
|
||||
system.setQuality("health", character.qualities.health - 1)
|
||||
system.writemd("androidattack".l())
|
||||
|
||||
situation 'start',
|
||||
content: "intro".l(),
|
||||
choices: ["#shoot"],
|
||||
|
@ -92,18 +97,13 @@ situation "hit",
|
|||
return response()
|
||||
choices: ["#shoot"]
|
||||
before: (character, system, from) ->
|
||||
character.sandbox.nicked = 0
|
||||
if character.qualities.enemies > 1
|
||||
system.setQuality("enemies", character.qualities.enemies - 1)
|
||||
if character.qualities.enemies == 0
|
||||
system.doLink("finale")
|
||||
kill_enemy(character, system)
|
||||
choices: ["#shoot"]
|
||||
|
||||
situation "nicked",
|
||||
content: (character, system, from) ->
|
||||
if character.sandbox.nicked == 1
|
||||
system.setQuality("enemies", character.qualities.enemies - 1)
|
||||
character.sandbox.nicked = 0
|
||||
kill_enemy(character, system)
|
||||
response = "player_finished".l().oneOf().randomly(system)
|
||||
return response()
|
||||
else
|
||||
|
@ -118,6 +118,15 @@ situation "miss",
|
|||
return response()
|
||||
choices: ["#shoot"]
|
||||
|
||||
situation "trick",
|
||||
before: (character, system, from) ->
|
||||
kill_enemy(character, system)
|
||||
kill_enemy(character, system)
|
||||
content: (character, system, from) ->
|
||||
response = "player_trickshot".l().oneOf().randomly(system)
|
||||
return response()
|
||||
choices: ["#shoot"]
|
||||
|
||||
situation "shoot",
|
||||
tags: ["shoot"],
|
||||
optionText: (character, system, from) ->
|
||||
|
@ -126,19 +135,38 @@ situation "shoot",
|
|||
return character.qualities.bullets > 0
|
||||
before: (character, system, from) ->
|
||||
spend_bullet(character, system)
|
||||
character.sandbox.distance = 3
|
||||
system.clearContent()
|
||||
after: (character, system, from) ->
|
||||
roll = system.rnd.dice(1,20) # d20 roll
|
||||
hit_threshold = 15
|
||||
miss_threshold = 18
|
||||
if character.qualities.health < 2
|
||||
hit_threshold = 18
|
||||
switch
|
||||
when roll < hit_threshold then system.doLink("hit")
|
||||
when roll > miss_threshold then system.doLink("miss")
|
||||
else system.doLink("nicked")
|
||||
|
||||
situation "trick_shot",
|
||||
tags: ["shoot"],
|
||||
optionText: (character, system, from) ->
|
||||
return "trick_shot".l()
|
||||
canView: (character, system) ->
|
||||
return character.sandbox.trick_shot == 1
|
||||
canChoose: (character, system) ->
|
||||
return character.qualities.bullets > 0
|
||||
before: (character, system, from) ->
|
||||
spend_bullet(character, system)
|
||||
system.clearContent()
|
||||
after: (character, system, from) ->
|
||||
roll = system.rnd.dice(1,20) # d20 roll
|
||||
trick_threshold = 5
|
||||
hit_threshold = 12
|
||||
miss_threshold = 16
|
||||
switch
|
||||
when roll < trick_threshold then system.doLink("trick")
|
||||
when roll < hit_threshold then system.doLink("hit")
|
||||
when roll > miss_threshold then system.doLink("miss")
|
||||
else system.doLink("nicked")
|
||||
|
||||
situation "reload",
|
||||
tags: ["shoot"],
|
||||
choices: ["#shoot"],
|
||||
|
@ -150,10 +178,12 @@ situation "reload",
|
|||
before: (character, system) ->
|
||||
character.sandbox.seen_reload = 1
|
||||
system.clearContent()
|
||||
character.sandbox.distance--
|
||||
after: (character, system) ->
|
||||
spend_clip(character, system)
|
||||
writemd(system, "reload_response".l())
|
||||
if character.sandbox.trick_shot == 0 and character.sandbox.clips.length == 4
|
||||
character.sandbox.trick_shot = 1
|
||||
writemd(system, "trick_shot_discover".l()(character))
|
||||
return true
|
||||
|
||||
situation "search",
|
||||
|
@ -166,16 +196,11 @@ situation "search",
|
|||
before: (character, system) ->
|
||||
system.clearContent()
|
||||
character.sandbox.seen_search = 1
|
||||
character.sandbox.distance--
|
||||
after: (character, system) ->
|
||||
response = "search_response".l().oneOf().randomly(system)
|
||||
writemd(system, response())
|
||||
roll = system.rnd.dice(1,20) # d20 roll
|
||||
find_threshold = 10
|
||||
if character.qualities.health < 2
|
||||
find_threshold += 2
|
||||
if character.sandbox.distance < 2
|
||||
find_threshold += 2
|
||||
if roll < find_threshold
|
||||
system.doLink("found")
|
||||
else
|
||||
|
@ -208,20 +233,19 @@ qualities
|
|||
bullets: qualities.integer("bullets".l()),
|
||||
clips: qualities.integer("clips".l()),
|
||||
enemies: qualities.integer("enemies".l()),
|
||||
health: qualities.fudgeAdjectives("health".l()),
|
||||
|
||||
undum.game.init = (character, system) ->
|
||||
system.setQuality("bullets", 6)
|
||||
system.setQuality("clips", 6)
|
||||
system.setQuality("enemies", 35)
|
||||
system.setQuality("health", 3)
|
||||
character.sandbox.clips = [6,6,6,6,6,6]
|
||||
character.sandbox.current_clip = 0
|
||||
character.sandbox.nicked = 0
|
||||
character.sandbox.distance = 3
|
||||
character.sandbox.seen_reload = 0
|
||||
character.sandbox.seen_search = 0
|
||||
character.sandbox.trick_shot = 0
|
||||
character.sandbox.shots = 0
|
||||
character.sandbox.killed = 0
|
||||
$("#title").click(() ->
|
||||
$("#clip").fadeIn()
|
||||
)
|
||||
|
|
|
@ -12,7 +12,6 @@ module.exports.language =
|
|||
link_not_valid: "Ссылка '{link}' не выглядит правильной."
|
||||
link_no_action: "Ссылка с ситуацией '.' должна иметь действие."
|
||||
unknown_situation: "Вы не можете переместиться в неизвестную ситуацию {id}."
|
||||
erase_message: "Это навсегда удалит вашего персонажа и немедленно вернёт вас к началу игры. Вы уверены?"
|
||||
no_current_situation: "Я не могу отобразить, потому что у нас нет текущей ситуации."
|
||||
no_local_storage: "Локальное хранилище недоступно."
|
||||
random_seed_error: "Вы должны задать верное случайное зерно."
|
||||
|
@ -73,7 +72,7 @@ module.exports.language =
|
|||
finale:
|
||||
"""
|
||||
Ба-бах!
|
||||
|
||||
|
||||
Последний андроид внезапно взрывается, как будто нашпигованный динамитом.
|
||||
А, впрочем, с этими машинами никогда не знаешь наверняка.
|
||||
Я отворачиваюсь и ухожу прочь, не обращая внимания на взрыв.
|
||||
|
@ -110,7 +109,6 @@ module.exports.language =
|
|||
"Нет, ничего нет.",
|
||||
"Ну хотя бы один! Нет, не нашёл."
|
||||
]
|
||||
health: 'Здоровье'
|
||||
enemies: 'Врагов впереди'
|
||||
clips: 'Картриджей с патронами'
|
||||
bullets: 'Патронов в картридже'
|
||||
|
@ -123,3 +121,21 @@ module.exports.language =
|
|||
"Андроид вовремя уворачивается от выстрела. Ничего, в следующий раз я не промахнусь.",
|
||||
"Чёрт! Промазал."
|
||||
]
|
||||
trick_shot: "Попробовать хитрый выстрел",
|
||||
trick_shot_discover: (character) ->
|
||||
"""
|
||||
Я пересчитываю картриджи.
|
||||
Осталось всего четыре.
|
||||
Я убил #{character.sandbox.killed} андроидов, то есть, впереди ещё... ой.
|
||||
ОЙ.
|
||||
Надо экономить патроны.
|
||||
Я могу попробовать хитрые выстрелы, но это -- большой риск.
|
||||
"""
|
||||
player_trickshot: [
|
||||
"""Я разбегаюсь к стене и прыгаю, стреляя в полёте.
|
||||
Пуля пролетает сквозь голову андроида прямо в следующего, вырубая обоих.
|
||||
""",
|
||||
"""Я замечаю слабое место в потолке.
|
||||
Один выстрел туда -- и секция разваливается, убирая под собой двух врагов.
|
||||
"""
|
||||
]
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
<h1>Thirty five shots</h1>
|
||||
<h3>An online sci-fi first person cybertext shooter</h3>
|
||||
<p>by <b><a href="http://en.oreolek.ru/">Oreolek</a></b></p>
|
||||
<noscript>
|
||||
<p class="noscript_message">This game requires Javascript.</p>
|
||||
</noscript>
|
||||
|
@ -35,7 +34,6 @@
|
|||
</div>
|
||||
|
||||
<div id="legal">
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/" class="footright"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a>
|
||||
<p>Approximate play time: five minites.</p>
|
||||
<p>Made using <a href="http://undum.com">Undum</a> and <a href="http://sequitur.github.io/raconteur/">Raconteur</a>.</p>
|
||||
<p>Betatesting credit: headless zombie</p>
|
||||
|
|
Loading…
Reference in a new issue