@@ -8,33 +8,15 @@ import fs = require('fs')
88import $ = require( '../common' )
99import Battle = require( '../battle' )
1010import xvt = require( 'xvt' )
11+ import { PortInfo } from 'aws-sdk/clients/lightsail' ;
1112
1213
1314module Dungeon
1415{
15- const iii = [ 'I' , 'II' , 'III' , 'IV' , 'V' , 'VI' , 'VII' , 'VIII' , 'IX' , 'X' ]
16- const potion = [
17- 'Potion of Cure Light Wounds' ,
18- 'Vial of Weakness' ,
19- 'Potion of Charm' ,
20- 'Vial of Stupidity' ,
21- 'Potion of Agility' ,
22- 'Vial of Clumsiness' ,
23- 'Potion of Wisdom' ,
24- 'Vile Vial' ,
25- 'Potion of Stamina' ,
26- 'Vial of Slaad Secretions' ,
27- 'Potion of Mana' ,
28- 'Flask of Fire Water' ,
29- 'Elixir of Restoration' ,
30- 'Vial of Crack' ,
31- 'Potion of Augment' ,
32- 'Beaker of Death'
33- ]
34-
3516 let fini : Function
3617 let monsters : monster = require ( '../etc/dungeon.json' )
3718 let party : active [ ]
19+ let potions : vial [ ] = [ ]
3820 let tl : number
3921
4022 let looked : boolean
@@ -79,6 +61,45 @@ module Dungeon
7961 'Y' : { description :'' }
8062 }
8163
64+ const iii = [ 'I' , 'II' , 'III' , 'IV' , 'V' , 'VI' , 'VII' , 'VIII' , 'IX' , 'X' ]
65+ const potion = [
66+ 'Potion of Cure Light Wounds' ,
67+ 'Vial of Weakness' ,
68+ 'Potion of Charm' ,
69+ 'Vial of Stupidity' ,
70+ 'Potion of Agility' ,
71+ 'Vial of Clumsiness' ,
72+ 'Potion of Wisdom' ,
73+ 'Vile Vial' ,
74+ 'Potion of Stamina' ,
75+ 'Vial of Slaad Secretions' ,
76+ 'Potion of Mana' ,
77+ 'Flask of Fire Water' ,
78+ 'Elixir of Restoration' ,
79+ 'Vial of Crack' ,
80+ 'Potion of Augment' ,
81+ 'Beaker of Death'
82+ ]
83+ // make some magic brew & bottle it up . . .
84+ let containers = [ 'beaker filled with' , 'bottle containing' , 'flask of' , 'vial holding' ]
85+ let v = 0
86+ while ( containers . length ) {
87+ let c = $ . dice ( containers . length ) - 1
88+ let liquids = [ 'bubbling' , 'clear' , 'milky' , 'sparkling' ]
89+ let colors = [ 'amber' , 'sapphire' , 'crimson' , 'emerald' , 'amethyst' ]
90+ let coded = [ xvt . yellow , xvt . blue , xvt . red , xvt . green , xvt . magenta ]
91+ while ( liquids . length ) {
92+ let l = $ . dice ( liquids . length ) - 1
93+ let i = $ . dice ( colors . length ) - 1
94+ potions . push ( { potion : v ++ , identified : false , image : 'potion/' + ( containers [ c ] . startsWith ( 'beaker' ) ? 'beaker' : colors [ i ] )
95+ , description : xvt . attr ( xvt . uline , containers [ c ] , xvt . nouline , ' a ' , liquids [ l ] , ' ' , coded [ i ] , colors [ i ] ) } )
96+ liquids . splice ( l , 1 )
97+ colors . splice ( i , 1 )
98+ coded . splice ( i , 1 )
99+ }
100+ containers . splice ( c , 1 )
101+ }
102+
82103export function DeepDank ( start : number , cb : Function ) {
83104 looked = false
84105 pause = false
@@ -381,7 +402,7 @@ function command() {
381402
382403 switch ( choice ) {
383404 case 'M' : // #tbt
384- if ( $ . access . sysop ) DL . map = 3
405+ DL . map = 3
385406 refresh = true
386407 break
387408
@@ -1124,10 +1145,10 @@ function doMove(): boolean {
11241145 }
11251146
11261147 let x = $ . dice ( DL . width ) - 1 , y = $ . dice ( DL . rooms . length ) - 1
1127- ROOM = DL . rooms [ y ] [ x ]
1128- if ( ROOM . occupant || $ . dice ( Z * ( $ . player . steal / 2 + 1 ) - deep ) > Z ) {
1129- if ( ! ROOM . occupant ) {
1130- ROOM . occupant = 5
1148+ let escape = DL . rooms [ y ] [ x ]
1149+ if ( escape . occupant || $ . dice ( Z * ( $ . player . steal / 2 + 1 ) - deep ) > Z ) {
1150+ if ( ! escape . occupant ) {
1151+ escape . occupant = 5
11311152 xvt . out ( [
11321153 'He silently ignores you' ,
11331154 'He recognizes your skill and winks' ,
@@ -1143,7 +1164,7 @@ function doMove(): boolean {
11431164 xvt . out ( xvt . reset , '\n' )
11441165 }
11451166 else {
1146- ROOM . occupant = 5
1167+ escape . occupant = 5
11471168 if ( DL . map > 1 )
11481169 xvt . out ( 'You expect nothing less from the coward.' )
11491170 else
@@ -1373,18 +1394,15 @@ function doMove(): boolean {
13731394 if ( typeof ROOM . giftID == 'undefined' && ! $ . player . coward )
13741395 ROOM . giftID = ! $ . player . novice && $ . dice ( 100 + ROOM . giftValue ) < ( $ . online . int / 20 * ( 1 << $ . player . poison ) + ( $ . online . int > 90 ? ( $ . online . int % 90 ) << 1 : 0 ) )
13751396 $ . sound ( 'bubbles' )
1376- xvt . out ( xvt . bright , xvt . cyan , 'On the ground, you find a ' ,
1377- [ 'bottle containing' , 'flask of some' , 'vial holding' ] [ $ . dice ( 3 ) - 1 ] , ' ' ,
1378- [ 'bubbling' , 'clear' , 'dark' , 'sparkling' , 'tainted' ] [ $ . dice ( 5 ) - 1 ] , ' ' )
1379- if ( ROOM . giftID || $ . access . sysop )
1397+ xvt . out ( xvt . bright , xvt . cyan , 'On the ground, you find a ' )
1398+ if ( potions [ ROOM . giftValue ] . identified || ROOM . giftID || $ . access . sysop ) {
1399+ $ . profile ( { png :potions [ ROOM . giftValue ] . image , handle :potion [ ROOM . giftValue ] , effect :'fadeInUp' } )
13801400 xvt . out ( potion [ ROOM . giftValue ] , '.' )
1401+ potions [ ROOM . giftValue ] . identified = $ . online . int > ( 85 - 4 * $ . player . poison ) // recall seeing this before
1402+ }
13811403 else {
1382- let p = $ . dice ( 5 ) - 1
1383- xvt . out (
1384- [ xvt . yellow , xvt . blue , xvt . red , xvt . green , xvt . magenta ] [ p ] ,
1385- [ 'amber' , 'blue' , 'crimson' , 'green' , 'purple' ] [ p ] ,
1386- xvt . cyan , ' potion' , xvt . reset , '.'
1387- )
1404+ $ . profile ( { png :potions [ ROOM . giftValue ] . image , handle :'Is it ' + 'nt' [ $ . dice ( 2 ) - 1 ] + 'asty ?' , effect :'fadeInUp' } )
1405+ xvt . out ( potions [ ROOM . giftValue ] . description , xvt . bright , xvt . cyan , ' potion' , xvt . reset , '.' )
13881406 }
13891407
13901408 if ( ROOM . giftID || $ . dice ( 100 + 10 * ROOM . giftValue * + $ . player . coward ) + $ . dice ( deep / 2 ) < 50 + $ . int ( $ . online . int / 2 ) ) {
@@ -2455,9 +2473,10 @@ function teleport() {
24552473function quaff ( v : number , it = true ) {
24562474 let m = $ . player . blessed ? 10 : 0
24572475 m = $ . player . cursed ? m - 10 : m
2458- xvt . out ( 'It was' , xvt . bright , v % 2 ? xvt . red : xvt . green , $ . an ( potion [ v ] ) , xvt . reset , '.\n' )
2459- if ( ! $ . access . sysop && ! ( v % 2 ) ) $ . news ( `\t${ it ? 'quaffed' : 'tossed' } ${ $ . an ( potion [ v ] ) } ` )
2476+ if ( ! ( v % 2 ) && ! potions [ v ] . identified ) $ . news ( `\t${ it ? 'quaffed' : 'tossed' } ${ $ . an ( potion [ v ] ) } ` )
24602477 if ( it ) {
2478+ potions [ v ] . identified = $ . online . int > ( 85 - 4 * $ . player . poison ) // recall seeing this before
2479+ xvt . out ( 'It was' , xvt . bright , v % 2 ? xvt . red : xvt . green , $ . an ( potion [ v ] ) , xvt . reset , '.\n' )
24612480 $ . sound ( 'quaff' , 6 )
24622481 switch ( v ) {
24632482 // Potion of Cure Light Wounds
@@ -2570,7 +2589,7 @@ function quaff(v: number, it = true) {
25702589
25712590 // Potion of Augment
25722591 case 14 :
2573- $ . sound ( 'power ' , 6 )
2592+ $ . sound ( 'hone ' , 6 )
25742593 $ . player . maxstr = $ . PC . ability ( $ . player . maxstr , $ . player . maxstr < 95 ? 2 : 1 )
25752594 $ . player . maxint = $ . PC . ability ( $ . player . maxint , $ . player . maxint < 95 ? 2 : 1 )
25762595 $ . player . maxdex = $ . PC . ability ( $ . player . maxdex , $ . player . maxdex < 95 ? 2 : 1 )
0 commit comments