1
0
Fork 0
mirror of https://github.com/Oreolek/shooter.git synced 2024-06-17 07:10:45 +03:00

Trick shots!

This commit is contained in:
Alexander Yakovlev 2015-12-03 12:06:22 +07:00
parent 8706a57ffb
commit d703f56360
5 changed files with 98 additions and 42 deletions

View file

@ -132,7 +132,7 @@ gulp.task('undum-dist', function () {
gulp.task('html-dist', html('./dist')); gulp.task('html-dist', html('./dist'));
gulp.task('img-dist', img('./dist/img')); 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 () { gulp.task('less-dist', function () {
return gulp.src('./less/main.less') return gulp.src('./less/main.less')

View file

@ -10,22 +10,22 @@ module.exports.language =
""" """
androidattack: "One of androids is so close he bites me!" androidattack: "One of androids is so close he bites me!"
emptyclip: "I get rid of empty cartridge." emptyclip: "I get rid of empty cartridge."
player_hit:[ player_hit: [
"Android's head explodes like a Christmas fireworks.", "Android's head explodes like a Christmas fireworks.",
"Android tries to dodge but finds himself right on the bullet's wrong side. "Android tries to dodge but finds himself right on the bullet's wrong side.
He falls, flooding the floor with oil." 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 shot to his heart.",
"I finish the android with a precise shot.", "I finish the android with a precise shot.",
"The bullet pierces android's head and he finally falls on the floor motionless.", "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. """I shoot the enemy's leg off.
He falls but keeps slowly scratch his way with his hands.""", He falls but keeps slowly scratch his way with his hands.""",
"I shoot through the android's arm. He stumbles but keeps going.", "I shoot through the android's arm. He stumbles but keeps going.",
] ]
shoot:[ shoot: [
"Shoot", "Shoot",
"BAM!", "BAM!",
"BLAM!", "BLAM!",
@ -42,7 +42,6 @@ module.exports.language =
"Send a bullet to android", "Send a bullet to android",
"Send a bullet with explosion", "Send a bullet with explosion",
"Push the trigger FOR THE HUMANITY", "Push the trigger FOR THE HUMANITY",
"Jump to a wall and shoot while flying",
"Sit down and shoot from a hip", "Sit down and shoot from a hip",
"Take the pistol in both hands and push the trigger", "Take the pistol in both hands and push the trigger",
"Slowly take aim and shoot", "Slowly take aim and shoot",
@ -53,7 +52,7 @@ module.exports.language =
I hope it has some ammo. I hope it has some ammo.
""" """
search: "Search for a clip" search: "Search for a clip"
search_response:[ search_response: [
"I hastily search the floor, trying to find at least one cartridge intact.", "I hastily search the floor, trying to find at least one cartridge intact.",
"I quickly look around for a clip on the floor.", "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/) * watupgroupie - [gunshots.mp3](http://freesound.org/people/watupgroupie/sounds/36815/)
* qubodup - [Bullet silhoettes](https://openclipart.org/detail/29029/bullet-silhouettes) * qubodup - [Bullet silhoettes](https://openclipart.org/detail/29029/bullet-silhouettes)
""" """
clips_not_found:[ clips_not_found: [
"No, nothing here.", "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' enemies: 'Enemies ahead'
clips: 'Cartridges' clips: 'Cartridges'
bullets: 'Bullets in clip' bullets: 'Bullets in clip'
clips_found:[ clips_found: [
"Aha! Got one. I hope it has some ammo.", 'Aha! Got one. I hope it has some ammo.',
"Eh, here's one. Looks heavy -- 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.", "The bullet flies over android's left arm.",
"Android dodges the shot. It's alright, next time I won't miss.", "Android dodges the shot. It's alright, next time I won't miss.",
"Damn! Missed.", "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.
"""

View file

@ -40,6 +40,16 @@ Array.prototype.oneOf = () ->
# 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)
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) -> spend_bullet = (character, system) ->
bullets = character.sandbox.clips[character.sandbox.current_clip] bullets = character.sandbox.clips[character.sandbox.current_clip]
character.sandbox.shots++ character.sandbox.shots++
@ -77,11 +87,6 @@ spend_clip = (character, system) ->
system.setQuality("bullets", bullets) system.setQuality("bullets", bullets)
$("#clip img").attr("src", "img/clip"+bullets+".png") $("#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', situation 'start',
content: "intro".l(), content: "intro".l(),
choices: ["#shoot"], choices: ["#shoot"],
@ -92,18 +97,13 @@ situation "hit",
return response() return response()
choices: ["#shoot"] choices: ["#shoot"]
before: (character, system, from) -> before: (character, system, from) ->
character.sandbox.nicked = 0 kill_enemy(character, system)
if character.qualities.enemies > 1
system.setQuality("enemies", character.qualities.enemies - 1)
if character.qualities.enemies == 0
system.doLink("finale")
choices: ["#shoot"] choices: ["#shoot"]
situation "nicked", situation "nicked",
content: (character, system, from) -> content: (character, system, from) ->
if character.sandbox.nicked == 1 if character.sandbox.nicked == 1
system.setQuality("enemies", character.qualities.enemies - 1) kill_enemy(character, system)
character.sandbox.nicked = 0
response = "player_finished".l().oneOf().randomly(system) response = "player_finished".l().oneOf().randomly(system)
return response() return response()
else else
@ -118,6 +118,15 @@ situation "miss",
return response() return response()
choices: ["#shoot"] 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", situation "shoot",
tags: ["shoot"], tags: ["shoot"],
optionText: (character, system, from) -> optionText: (character, system, from) ->
@ -126,19 +135,38 @@ situation "shoot",
return character.qualities.bullets > 0 return character.qualities.bullets > 0
before: (character, system, from) -> before: (character, system, from) ->
spend_bullet(character, system) spend_bullet(character, system)
character.sandbox.distance = 3
system.clearContent() system.clearContent()
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
miss_threshold = 18 miss_threshold = 18
if character.qualities.health < 2
hit_threshold = 18
switch switch
when roll < hit_threshold then system.doLink("hit") when roll < hit_threshold then system.doLink("hit")
when roll > miss_threshold then system.doLink("miss") when roll > miss_threshold then system.doLink("miss")
else system.doLink("nicked") 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", situation "reload",
tags: ["shoot"], tags: ["shoot"],
choices: ["#shoot"], choices: ["#shoot"],
@ -150,10 +178,12 @@ situation "reload",
before: (character, system) -> before: (character, system) ->
character.sandbox.seen_reload = 1 character.sandbox.seen_reload = 1
system.clearContent() system.clearContent()
character.sandbox.distance--
after: (character, system) -> after: (character, system) ->
spend_clip(character, system) spend_clip(character, system)
writemd(system, "reload_response".l()) 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 return true
situation "search", situation "search",
@ -166,16 +196,11 @@ situation "search",
before: (character, system) -> before: (character, system) ->
system.clearContent() system.clearContent()
character.sandbox.seen_search = 1 character.sandbox.seen_search = 1
character.sandbox.distance--
after: (character, system) -> after: (character, system) ->
response = "search_response".l().oneOf().randomly(system) response = "search_response".l().oneOf().randomly(system)
writemd(system, response()) writemd(system, response())
roll = system.rnd.dice(1,20) # d20 roll roll = system.rnd.dice(1,20) # d20 roll
find_threshold = 10 find_threshold = 10
if character.qualities.health < 2
find_threshold += 2
if character.sandbox.distance < 2
find_threshold += 2
if roll < find_threshold if roll < find_threshold
system.doLink("found") system.doLink("found")
else else
@ -208,20 +233,19 @@ qualities
bullets: qualities.integer("bullets".l()), bullets: qualities.integer("bullets".l()),
clips: qualities.integer("clips".l()), clips: qualities.integer("clips".l()),
enemies: qualities.integer("enemies".l()), enemies: qualities.integer("enemies".l()),
health: qualities.fudgeAdjectives("health".l()),
undum.game.init = (character, system) -> undum.game.init = (character, system) ->
system.setQuality("bullets", 6) system.setQuality("bullets", 6)
system.setQuality("clips", 6) system.setQuality("clips", 6)
system.setQuality("enemies", 35) system.setQuality("enemies", 35)
system.setQuality("health", 3)
character.sandbox.clips = [6,6,6,6,6,6] character.sandbox.clips = [6,6,6,6,6,6]
character.sandbox.current_clip = 0 character.sandbox.current_clip = 0
character.sandbox.nicked = 0 character.sandbox.nicked = 0
character.sandbox.distance = 3
character.sandbox.seen_reload = 0 character.sandbox.seen_reload = 0
character.sandbox.seen_search = 0 character.sandbox.seen_search = 0
character.sandbox.trick_shot = 0
character.sandbox.shots = 0 character.sandbox.shots = 0
character.sandbox.killed = 0
$("#title").click(() -> $("#title").click(() ->
$("#clip").fadeIn() $("#clip").fadeIn()
) )

View file

@ -12,7 +12,6 @@ module.exports.language =
link_not_valid: "Ссылка '{link}' не выглядит правильной." link_not_valid: "Ссылка '{link}' не выглядит правильной."
link_no_action: "Ссылка с ситуацией '.' должна иметь действие." link_no_action: "Ссылка с ситуацией '.' должна иметь действие."
unknown_situation: "Вы не можете переместиться в неизвестную ситуацию {id}." unknown_situation: "Вы не можете переместиться в неизвестную ситуацию {id}."
erase_message: "Это навсегда удалит вашего персонажа и немедленно вернёт вас к началу игры. Вы уверены?"
no_current_situation: "Я не могу отобразить, потому что у нас нет текущей ситуации." no_current_situation: "Я не могу отобразить, потому что у нас нет текущей ситуации."
no_local_storage: "Локальное хранилище недоступно." no_local_storage: "Локальное хранилище недоступно."
random_seed_error: "Вы должны задать верное случайное зерно." random_seed_error: "Вы должны задать верное случайное зерно."
@ -110,7 +109,6 @@ module.exports.language =
"Нет, ничего нет.", "Нет, ничего нет.",
"Ну хотя бы один! Нет, не нашёл." "Ну хотя бы один! Нет, не нашёл."
] ]
health: 'Здоровье'
enemies: 'Врагов впереди' enemies: 'Врагов впереди'
clips: 'Картриджей с патронами' clips: 'Картриджей с патронами'
bullets: 'Патронов в картридже' bullets: 'Патронов в картридже'
@ -123,3 +121,21 @@ module.exports.language =
"Андроид вовремя уворачивается от выстрела. Ничего, в следующий раз я не промахнусь.", "Андроид вовремя уворачивается от выстрела. Ничего, в следующий раз я не промахнусь.",
"Чёрт! Промазал." "Чёрт! Промазал."
] ]
trick_shot: "Попробовать хитрый выстрел",
trick_shot_discover: (character) ->
"""
Я пересчитываю картриджи.
Осталось всего четыре.
Я убил #{character.sandbox.killed} андроидов, то есть, впереди ещё... ой.
ОЙ.
Надо экономить патроны.
Я могу попробовать хитрые выстрелы, но это -- большой риск.
"""
player_trickshot: [
"""Я разбегаюсь к стене и прыгаю, стреляя в полёте.
Пуля пролетает сквозь голову андроида прямо в следующего, вырубая обоих.
""",
"""Я замечаю слабое место в потолке.
Один выстрел туда -- и секция разваливается, убирая под собой двух врагов.
"""
]

View file

@ -17,7 +17,6 @@
<h1>Thirty five shots</h1> <h1>Thirty five shots</h1>
<h3>An online sci-fi first person cybertext shooter</h3> <h3>An online sci-fi first person cybertext shooter</h3>
<p>by <b><a href="http://en.oreolek.ru/">Oreolek</a></b></p>
<noscript> <noscript>
<p class="noscript_message">This game requires Javascript.</p> <p class="noscript_message">This game requires Javascript.</p>
</noscript> </noscript>
@ -35,7 +34,6 @@
</div> </div>
<div id="legal"> <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>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>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> <p>Betatesting credit: headless zombie</p>