Ejemplo n.º 1
0
        } /* fightd_ */

        /* BLOW- STRIKE BLOW */
        public static int blow_(Game game, int h, int v, int rmk, bool hflg, int output)
        {
            int rmiss = 0;
            int rout  = 1;
            int rkill = 2;
            int rstag = 5;
            int rlose = 6;
            int rhes  = 7;
            int rsit  = 8;

            int [] def1r  = { 1, 2, 3 };
            int [] def2r  = { 13, 23, 24, 25 };
            int [] def3r  = { 35, 36, 46, 47, 57 };
            int [] rvectr = { 0, 0, 0, 0, 5, 5, 1, 1, 2, 2, 2, 2, 0, 0, 0, 0, 0, 5,
                              5, 3, 3, 1, 0, 0, 0, 5, 5, 3, 3, 3, 1, 2, 2, 2, 0, 0, 0, 0, 0, 5, 5, 3, 3, 4, 4, 0, 0, 0, 5, 5,
                              3, 3, 3, 4, 4, 4, 0, 5, 5, 3, 3, 3, 3, 4, 4, 4 };
            int [] rstate = { 5000, 3005, 3008, 4011, 3015, 3018, 1021,
                              0,       0, 5022, 3027, 3030, 4033, 3037, 3040, 1043,    0,    0, 4044, 2048, 4050, 4054,
                              5058, 4063, 4067, 3071, 1074, 4075, 1079, 4080, 4084, 4088, 4092, 4096, 4100,
                              1104, 4105, 2109, 4111, 4115, 4119, 4123, 4127, 3131, 3134 };

            int ret_val, i__1, i__2;

            /* Local variables */
            bool f;
            int  i, j, oa, ra, od, mi, dv, def;
            int  tbl;
            int  att, res;
            int  dweap;
            int  pblose;

            ra = game.Objects.oactio[v - 1];
            /*                      !GET VILLAIN ACTION, */
            dv = game.Objects.odesc2[v - 1];
            /*                      !DESCRIPTION. */
            ret_val = rmiss;
            /*                      !ASSUME NO RESULT. */
            if (!(hflg))
            {
                goto L1000;
            }
            /*                      !HERO STRIKING BLOW? */

            /* HERO IS ATTACKER, VILLAIN IS DEFENDER. */

            pblose = 10;
            /*                      !BAD LK PROB. */
            game.Objects.oflag2[v - 1] |= ObjectFlags2.FITEBT;
            if ((game.Adventurers.Flags[h - 1] & game.astag) == 0)
            {
                goto L100;
            }

            MessageHandler.Speak(game, 591);
            /*                      !YES, CANT FIGHT. */
            game.Adventurers.Flags[h - 1] &= ~game.astag;
            return(ret_val);

L100:
            att = dso4.fights_(game, h, true);
            /*                      !GET HIS STRENGTH. */
            oa  = att;
            def = dso4.vilstr_(game, v);
            /*                      !GET VILL STRENGTH. */
            od    = def;
            dweap = 0;
            /*                      !ASSUME NO WEAPON. */
            i__1 = game.Objects.Count;
            for (i = 1; i <= i__1; ++i)
            {
                /*                      !SEARCH VILLAIN. */
                if (game.Objects.ocan[i - 1] == v && (game.Objects.oflag2[i - 1] & ObjectFlags2.WEAPBT) != 0)
                {
                    dweap = i;
                }
                /* L200: */
            }

            if (v == game.Adventurers.Objects[(int)AIndices.player - 1])
            {
                goto L300;
            }

            /*                      !KILLING SELF? */
            if (def != 0)
            {
                goto L2000;
            }

            /*                      !DEFENDER ALIVE? */
            MessageHandler.rspsub_(game, 592, dv);
            /*                      !VILLAIN DEAD. */
            return(ret_val);

L300:
            AdventurerHandler.jigsup_(game, 593);
            /*                      !KILLING SELF. */
            return(ret_val);

            /* VILLAIN IS ATTACKER, HERO IS DEFENDER. */

L1000:
            pblose = 50;
            /*                      !BAD LK PROB. */
            game.Adventurers.Flags[h - 1] &= ~game.astag;
            if ((game.Objects.oflag2[v - 1] & ObjectFlags2.STAGBT) == 0)
            {
                goto L1200;
            }
            game.Objects.oflag2[v - 1] &= ~ObjectFlags2.STAGBT;
            MessageHandler.rspsub_(game, 594, dv);
            /*                      !DESCRIBE. */
            return(ret_val);

L1200:
            att = dso4.vilstr_(game, v);
            /*                      !SET UP ATT, DEF. */
            oa  = att;
            def = dso4.fights_(game, h, true);
            if (def <= 0)
            {
                return(ret_val);
            }
            /*                      !DONT ALLOW DEAD DEF. */
            od    = dso4.fights_(game, h, false);
            i__1  = Parser.fwim_(0, (int)ObjectFlags2.WEAPBT, 0, 0, h, true, game);
            dweap = Math.Abs(i__1);
            /*                      !FIND A WEAPON. */
            /* BLOW, PAGE 4 */

            /* PARTIES ARE NOW EQUIPPED.  DEF CANNOT BE ZERO. */
            /* ATT MUST BE > 0. */

L2000:
            if (def > 0)
            {
                goto L2100;
            }
            /*                      !DEF ALIVE? */
            res = rkill;
            if (hflg)
            {
                MessageHandler.rspsub_(595, dv, game);
            }

            /*                      !DEADER. */
            goto L3000;

L2100:
            if ((i__1 = def - 2) < 0)
            {
                goto L2200;
            }
            else if (i__1 == 0)
            {
                goto L2300;
            }
            else
            {
                goto L2400;
            }
            /*                      !DEF <2,=2,>2 */
L2200:
            att = Math.Min(att, 3);
            /*                      !SCALE ATT. */
            tbl = def1r[att - 1];
            /*                      !CHOOSE TABLE. */
            goto L2500;

L2300:
            att = Math.Min(att, 4);
            /*                      !SCALE ATT. */
            tbl = def2r[att - 1];
            /*                      !CHOOSE TABLE. */
            goto L2500;

L2400:
            att -= def;
            /*                      !SCALE ATT. */
            /* Computing MIN */
            i__1 = 2;
            i__2 = Math.Max(-2, att);
            att  = Math.Min(i__1, i__2) + 3;
            tbl  = def3r[att - 1];

L2500:
            res = rvectr[tbl + game.rnd_(10) - 1];
            /*                      !GET RESULT. */
            if (output == 0)
            {
                goto L2600;
            }

            /*                      !WAS HE OUT? */
            if (res == rstag)
            {
                goto L2550;
            }
            /*                      !YES, STAG--> HES. */
            res = rsit;
            /*                      !OTHERWISE, SITTING. */
            goto L2600;
L2550:
            res = rhes;
L2600:
            if (res == rstag && dweap != 0 && RoomHandler.prob_(game, 25, pblose))
            {
                res = rlose;
            }

            mi = rstate[(rmk - 1) * 9 + res];
            /*                      !CHOOSE TABLE ENTRY. */
            if (mi == 0)
            {
                goto L3000;
            }

            i__1 = mi / 1000;
            i    = mi % 1000 + game.rnd_(i__1) + game.Star.mbase + 1;
            j    = dv;
            if (!(hflg) && dweap != 0)
            {
                j = game.Objects.odesc2[dweap - 1];
            }

            MessageHandler.rspsub_(i, j, game);
            /*                      !PRESENT RESULT. */
            /* BLOW, PAGE 5 */

            /* NOW APPLY RESULT */

L3000:
            switch (res + 1)
            {
            case 1: goto L4000;

            case 2: goto L3100;

            case 3: goto L3200;

            case 4: goto L3300;

            case 5: goto L3400;

            case 6: goto L3500;

            case 7: goto L3600;

            case 8: goto L4000;

            case 9: goto L3200;
            }

L3100:
            if (hflg)
            {
                def = -def;
            }
            /*                      !UNCONSCIOUS. */
            goto L4000;

L3200:
            def = 0;
            /*                      !KILLED OR SITTING DUCK. */
            goto L4000;

L3300:
            /* Computing MAX */
            i__1 = 0;
            i__2 = def - 1;
            def  = Math.Max(i__1, i__2);
            /*                      !LIGHT WOUND. */
            goto L4000;

L3400:
            /* Computing MAX */
            i__1 = 0;
            i__2 = def - 2;
            def  = Math.Max(i__1, i__2);
            /*                      !SERIOUS WOUND. */
            goto L4000;

L3500:
            if (hflg)
            {
                goto L3550;
            }
            /*                      !STAGGERED. */
            game.Adventurers.Flags[h - 1] |= game.astag;
            goto L4000;

L3550:
            game.Objects.oflag2[v - 1] |= ObjectFlags2.STAGBT;
            goto L4000;

L3600:
            ObjectHandler.newsta_(dweap, 0, game.Player.Here, 0, 0, game);
            /*                      !LOSE WEAPON. */
            dweap = 0;
            if (hflg)
            {
                goto L4000;
            }

            /*                      !IF HERO, DONE. */
            i__1  = Parser.fwim_(0, (int)ObjectFlags2.WEAPBT, 0, 0, h, true, game);
            dweap = Math.Abs(i__1);
            /*                      !GET NEW. */
            if (dweap != 0)
            {
                MessageHandler.rspsub_(605, game.Objects.odesc2[dweap - 1], game);
            }
            /* BLOW, PAGE 6 */

L4000:
            ret_val = res;
            /*                      !RETURN RESULT. */
            if (!(hflg))
            {
                goto L4500;
            }
            /*                      !HERO? */
            game.Objects.ocapac[v - 1] = def;
            /*                      !STORE NEW CAPACITY. */
            if (def != 0)
            {
                goto L4100;
            }
            /*                      !DEAD? */
            game.Objects.oflag2[v - 1] &= ~ObjectFlags2.FITEBT;
            MessageHandler.rspsub_(game, 572, dv);
            /*                      !HE DIES. */
            ObjectHandler.newsta_(v, 0, 0, 0, 0, game);
            /*                      !MAKE HIM DISAPPEAR. */
            if (ra == 0)
            {
                return(ret_val);
            }
            /*                      !IF NX TO DO, EXIT. */
            game.ParserVectors.prsa = (int)VIndices.deadxw;
            /*                      !LET HIM KNOW. */
            f = ObjectHandler.oappli_(ra, 0, game);
            return(ret_val);

L4100:
            if (res != rout || ra == 0)
            {
                return(ret_val);
            }
            game.ParserVectors.prsa = (int)VIndices.outxw;
            /*                      !LET HIM BE OUT. */
            f = ObjectHandler.oappli_(ra, 0, game);
            return(ret_val);

L4500:
            game.Adventurers.astren[h - 1] = -10000;
            /*                      !ASSUME DEAD. */
            if (def != 0)
            {
                game.Adventurers.astren[h - 1] = def - od;
            }
            if (def >= od)
            {
                goto L4600;
            }
            game.Clock.Ticks[(int)ClockIndices.cevcur - 1] = 30;
            game.Clock.Flags[(int)ClockIndices.cevcur - 1] = true;

L4600:
            if (dso4.fights_(game, h, true) > 0)
            {
                return(ret_val);
            }

            game.Adventurers.astren[h - 1] = 1 - dso4.fights_(game, h, false);
            /*                      !HE'S DEAD. */
            AdventurerHandler.jigsup_(game, 596);
            ret_val = -1;
            return(ret_val);
        } /* blow_ */
Ejemplo n.º 2
0
        } /* trollp_ */

        /* CYCLOP-	CYCLOPS FUNCTION */

        /* DECLARATIONS */

        public static bool cyclop_(Game game, int arg)
        {
            /* System generated locals */
            int  i__1, i__2;
            bool ret_val;

            /* Local variables */
            int i;

            ret_val = true;
            /*                      !ASSUME WINS. */
            if (!game.Flags.cyclof)
            {
                goto L100;
            }

            /*                      !ASLEEP? */
            if (game.ParserVectors.prsa != (int)VIndices.alarmw && game.ParserVectors.prsa != (int)VIndices.mungw &&
                game.ParserVectors.prsa != (int)VIndices.hellow && game.ParserVectors.prsa !=
                (int)VIndices.burnw && game.ParserVectors.prsa != (int)VIndices.killw &&
                game.ParserVectors.prsa != (int)VIndices.attacw)
            {
                goto L10;
            }
            game.Flags.cyclof = false;
            /*                      !WAKE CYCLOPS. */
            MessageHandler.rspsub_(game, 187);
            /*                      !DESCRIBE. */
            game.Switches.rvcyc = Math.Abs(game.Switches.rvcyc);
            game.Objects.oflag2[(int)ObjectIndices.cyclo - 1] = (game.Objects.oflag2[(int)ObjectIndices.cyclo - 1] | ObjectFlags2.FITEBT) & ~ObjectFlags2.SLEPBT;
            return(ret_val);

L100:
            if (game.ParserVectors.prsa == (int)VIndices.fightw || game.ParserVectors.prsa == (int)VIndices.frstqw)
            {
                goto L10;
            }
            if (Math.Abs(game.Switches.rvcyc) <= 5)
            {
                goto L200;
            }
            /*                      !ANNOYED TOO MUCH? */
            game.Switches.rvcyc = 0;
            /*                      !RESTART COUNT. */
            AdventurerHandler.jigsup_(game, 188);
            /*                      !YES, EATS PLAYER. */
            return(ret_val);

L200:
            if (game.ParserVectors.prsa != (int)VIndices.givew)
            {
                goto L500;
            }
            /*                      !GIVE? */
            if (game.ParserVectors.prso != (int)ObjectIndices.food || game.Switches.rvcyc < 0)
            {
                goto L300;
            }
            /*                      !FOOD WHEN HUNGRY? */
            ObjectHandler.newsta_(game, (int)ObjectIndices.food, 189, 0, 0, 0);
            /*                      !EATS PEPPERS. */
            /* Computing MIN */
            i__1 = -1;
            i__2 = -game.Switches.rvcyc;
            game.Switches.rvcyc = Math.Min(i__1, i__2);
            /*                      !GETS THIRSTY. */
            return(ret_val);

L300:
            if (game.ParserVectors.prso != (int)ObjectIndices.water)
            {
                goto L400;
            }
            /*                      !DRINK WHEN THIRSTY? */
            if (game.Switches.rvcyc >= 0)
            {
                goto L350;
            }
            ObjectHandler.newsta_(game, game.ParserVectors.prso, 190, 0, 0, 0);
            /*                      !DRINKS AND */
            game.Flags.cyclof = true;
            /*                      !FALLS ASLEEP. */
            game.Objects.oflag2[(int)ObjectIndices.cyclo - 1] = (game.Objects.oflag2[(int)ObjectIndices.cyclo - 1] | ObjectFlags2.SLEPBT) & ~ObjectFlags2.FITEBT;
            return(ret_val);

L350:
            MessageHandler.rspeak_(game, 191);
            /*                      !NOT THIRSTY. */
L10:
            ret_val = false;
            /*                      !FAILS. */
            return(ret_val);

L400:
            i = 192;
            /*                      !ASSUME INEDIBLE. */
            if (game.ParserVectors.prso == (int)ObjectIndices.garli)
            {
                i = 193;
            }
            /*                      !GARLIC IS JOKE. */
L450:
            MessageHandler.rspeak_(game, i);
            /*                      !DISDAIN IT. */
            if (game.Switches.rvcyc < 0)
            {
                --game.Switches.rvcyc;
            }
            if (game.Switches.rvcyc >= 0)
            {
                ++game.Switches.rvcyc;
            }
            if (!game.Flags.cyclof)
            {
                i__1 = Math.Abs(game.Switches.rvcyc) + 193;
                MessageHandler.rspeak_(game, i__1);
            }
            return(ret_val);

L500:
            i = 0;
            /*                      !ASSUME NOT HANDLED. */
            if (game.ParserVectors.prsa == (int)VIndices.hellow)
            {
                goto L450;
            }
            /*                      !HELLO IS NO GO. */
            if (game.ParserVectors.prsa == (int)VIndices.throww || game.ParserVectors.prsa == (int)VIndices.mungw)
            {
                i = game.rnd_(2) + 200;
            }
            if (game.ParserVectors.prsa == (int)VIndices.takew)
            {
                i = 202;
            }
            if (game.ParserVectors.prsa == (int)VIndices.tiew)
            {
                i = 203;
            }
            if (i <= 0)
            {
                goto L10;
            }
            else
            {
                goto L450;
            }
            /*                      !SEE IF HANDLED. */
        } /* cyclop_ */
Ejemplo n.º 3
0
        public static bool moveto_(Game game, int nr, int who)
        {
            // System generated locals
            bool ret_val;

            // Local variables
            int  j;
            bool lhr;
            bool lnr, nlv;
            int  bits;

            ret_val = false;
            // !ASSUME FAILS.
            lhr = (game.Rooms.RoomFlags[game.Player.Here - 1] & RoomFlags.RLAND) != 0;
            lnr = (game.Rooms.RoomFlags[nr - 1] & RoomFlags.RLAND) != 0;
            j   = game.Adventurers.Vehicles[who - 1];
            // !HIS VEHICLE

            if (j != 0)
            {
                goto L100;
            }

            // !IN VEHICLE?
            if (lnr)
            {
                goto L500;
            }

            // !NO, GOING TO LAND?
            MessageHandler.Speak(427, game);
            // !CAN'T GO WITHOUT VEHICLE.
            return(ret_val);

L100:
            bits = 0;
            // !ASSUME NOWHERE.
            if (j == (int)ObjectIndices.rboat)
            {
                bits = (int)RoomFlags.RWATER;
            }

            // !IN BOAT?
            if (j == (int)ObjectIndices.ballo)
            {
                bits = (int)RoomFlags.RAIR;
            }

            // !IN BALLOON?
            if (j == (int)ObjectIndices.bucke)
            {
                bits = (int)RoomFlags.RBUCK;
            }

            // !IN BUCKET?
            nlv = (game.Rooms.RoomFlags[nr - 1] & (RoomFlags)bits) == 0;
            if (!lnr && nlv || lnr && lhr && nlv && bits != (int)RoomFlags.RLAND)
            {
                goto L800;
            }

L500:
            ret_val = true;
            // !MOVE SHOULD SUCCEED.
            if ((game.Rooms.RoomFlags[nr - 1] & RoomFlags.RMUNG) == 0)
            {
                goto L600;
            }

            MessageHandler.Speak(game.Rooms.RoomActions[nr - 1], game);
            // !YES, TELL HOW.
            return(ret_val);

L600:
            if (who != (int)AIndices.player)
            {
                ObjectHandler.newsta_(game.Adventurers.Objects[who - 1], 0, nr, 0, 0, game);
            }

            if (j != 0)
            {
                ObjectHandler.newsta_(j, 0, nr, 0, 0, game);
            }

            game.Player.Here = nr;
            game.Adventurers.Rooms[who - 1] = game.Player.Here;
            AdventurerHandler.scrupd_(game, game.Rooms.RoomValues[nr - 1]);
            // !SCORE ROOM
            game.Rooms.RoomValues[nr - 1] = 0;
            return(ret_val);

L800:
            MessageHandler.rspsub_(428, game.Objects.odesc2[j - 1], game);
            // !WRONG VEHICLE.
            return(ret_val);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// jigsup_ - You are dead
        /// </summary>
        /// <param name="desc"></param>
        public static void jigsup_(Game game, int desc)
        {
            int[] rlist = new int[] { 8, 6, 36, 35, 34, 4, 34, 6, 5 };

            int  i__1;
            int  nonofl;
            bool f;
            int  i, j;

            MessageHandler.Speak(desc, game);
            // !DESCRIBE SAD STATE.
            game.ParserVectors.prscon = 1;
            // !STOP PARSER.
            //            if (debug_1.dbgflg != 0)
            //            {
            //                return;
            //            }

            // !IF DBG, EXIT.
            game.Adventurers.Vehicles[game.Player.Winner - 1] = 0;

            // !GET RID OF VEHICLE.
            if (game.Player.Winner == (int)AIndices.player)
            {
                goto L100;
            }

            // !HIMSELF?
            MessageHandler.rspsub_(432, game.Objects.odesc2[game.Adventurers.Objects[game.Player.Winner - 1] - 1], game);
            // !NO, SAY WHO DIED.
            ObjectHandler.newsta_(game.Adventurers.Objects[game.Player.Winner - 1], 0, 0, 0, 0, game);
            // !SEND TO HYPER SPACE.
            return;

L100:
            if (game.Flags.endgmf)
            {
                goto L900;
            }
            // !NO RECOVERY IN END GAME.

            // always exit for plopbot's purposes
            goto L1000;
            //    if (game.State.Deaths >= 2) {
            //	goto L1000;
            //    }

            // !DEAD TWICE? KICK HIM OFF.
            if (!dso3.yesno_(game, 10, 9, 8))
            {
                goto L1100;
            }
            // !CONTINUE?

            i__1 = game.Objects.Count;
            for (j = 1; j <= i__1; ++j)
            {
                // !TURN OFF FIGHTING.
                if (ObjectHandler.qhere_(j, game.Player.Here, game))
                {
                    game.Objects.oflag2[j - 1] &= ~ObjectFlags2.FITEBT;
                }
                // L50:
            }

            ++game.State.Deaths;
            AdventurerHandler.scrupd_(game, -10);
            // !CHARGE TEN POINTS.
            f = AdventurerHandler.moveto_(game, RoomIndices.fore1, game.Player.Winner);
            // !REPOSITION HIM.
            game.Flags.egyptf = true;
            // !RESTORE COFFIN.
            if (game.Objects.oadv[(int)ObjectIndices.coffi - 1] == game.Player.Winner)
            {
                ObjectHandler.newsta_(ObjectIndices.coffi, 0, RoomIndices.egypt, 0, 0, game);
            }

            game.Objects.oflag2[(int)ObjectIndices.door - 1] &= ~ObjectFlags2.TCHBT;
            game.Objects.oflag1[(int)ObjectIndices.robot - 1] = (game.Objects.oflag1[(int)ObjectIndices.robot - 1] | ObjectFlags.VISIBT) & ~ObjectFlags.NDSCBT;

            if (game.Objects.oroom[(int)ObjectIndices.lamp - 1] != 0 || game.Objects.oadv[(int)ObjectIndices.lamp - 1] == game.Player.Winner)
            {
                ObjectHandler.newsta_(ObjectIndices.lamp, 0, RoomIndices.lroom, 0, 0, game);
            }

            // NOW REDISTRIBUTE HIS VALUABLES AND OTHER BELONGINGS.

            // THE LAMP HAS BEEN PLACED IN THE LIVING ROOM.
            // THE FIRST 8 NON-VALUABLES ARE PLACED IN LOCATIONS AROUND THE HOUSE.
            // HIS VALUABLES ARE PLACED AT THE END OF THE MAZE.
            // REMAINING NON-VALUABLES ARE PLACED AT THE END OF THE MAZE.

            i    = 1;
            i__1 = game.Objects.Count;
            for (j = 1; j <= i__1; ++j)
            {
                // !LOOP THRU OBJECTS.
                if (game.Objects.oadv[j - 1] != game.Player.Winner || game.Objects.otval[j - 1] != 0)
                {
                    goto L200;
                }

                ++i;
                if (i > 9)
                {
                    goto L400;
                }
                // !MOVE TO RANDOM LOCATIONS.

                ObjectHandler.newsta_(j, 0, rlist[i - 1], 0, 0, game);
L200:
                ;
            }

L400:
            i = game.Rooms.Count + 1;

            // !NOW MOVE VALUABLES.
            nonofl = (int)(RoomFlags.RAIR + (int)RoomFlags.RWATER + (int)RoomFlags.RSACRD + (int)RoomFlags.REND);
            // !DONT MOVE HERE.
            i__1 = game.Objects.Count;
            for (j = 1; j <= i__1; ++j)
            {
                if (game.Objects.oadv[j - 1] != game.Player.Winner || game.Objects.otval[j - 1] == 0)
                {
                    goto L300;
                }
L250:
                --i;
                // !FIND NEXT ROOM.
                if ((game.Rooms.RoomFlags[i - 1] & (RoomFlags)nonofl) != 0)
                {
                    goto L250;
                }

                ObjectHandler.newsta_(j, 0, i, 0, 0, game);
                // !YES, MOVE.
L300:
                ;
            }

            i__1 = game.Objects.Count;
            for (j = 1; j <= i__1; ++j)
            {
                // !NOW GET RID OF REMAINDER.
                if (game.Objects.oadv[j - 1] != game.Player.Winner)
                {
                    goto L500;
                }
L450:
                --i;
                // !FIND NEXT ROOM.
                if ((game.Rooms.RoomFlags[i - 1] & (RoomFlags)nonofl) != 0)
                {
                    goto L450;
                }

                ObjectHandler.newsta_(j, 0, i, 0, 0, game);
L500:
                ;
            }
            return;

            // CAN'T OR WON'T CONTINUE, CLEAN UP AND EXIT.

L900:
            MessageHandler.Speak(625, game);
            // !IN ENDGAME, LOSE.
            goto L1100;

L1000:
            MessageHandler.Speak(7, game);
            // !INVOLUNTARY EXIT.
L1100:
            AdventurerHandler.score_(game, false);
            // !TELL SCORE.

            game.Exit();
        }
Ejemplo n.º 5
0
        /* WALK- MOVE IN SPECIFIED DIRECTION */

        public static bool walk_(Game game)
        {
            /* System generated locals */
            bool ret_val;

            ret_val = true;
            /*                      !ASSUME WINS. */
            if (game.Player.Winner != (int)AIndices.player || RoomHandler.IsRoomLit(game.Player.Here, game) || RoomHandler.prob_(game, 25, 25))
            {
                goto L500;
            }

            if (!dso3.findxt_(game, game.ParserVectors.prso, game.Player.Here))
            {
                goto L450;
            }
            /*                      !INVALID EXIT? GRUE */
            /*                      ! */
            switch (game.curxt_.xtype)
            {
            case 1: goto L400;

            case 2: goto L200;

            case 3: goto L100;

            case 4: goto L300;
            }
            /*                      !DECODE EXIT TYPE. */
            throw new InvalidOperationException();
            //bug_(9, game.curxt_.xtype);

L100:
            if (cxappl_(game, game.curxt_.xactio) != 0)
            {
                goto L400;
            }
            /*                      !CEXIT... RETURNED ROOM? */
            // TODO: chadj: figure out how to do this
            //if (game.Flags[game.curxt_.xobj - 1])
            {
                //  goto L400;
            }
            /*                      !NO, FLAG ON? */
L200:
            AdventurerHandler.jigsup_(game, 523);
            /*                      !BAD EXIT, GRUE */
            /*                      ! */
            return(ret_val);

L300:
            if (cxappl_(game, game.curxt_.xactio) != 0)
            {
                goto L400;
            }
            /*                      !DOOR... RETURNED ROOM? */
            if ((game.Objects.oflag2[game.curxt_.xobj - 1] & ObjectFlags2.OPENBT) != 0)
            {
                goto L400;
            }
            /*                      !NO, DOOR OPEN? */
            AdventurerHandler.jigsup_(game, 523);
            /*                      !BAD EXIT, GRUE */
            /*                      ! */
            return(ret_val);

L400:
            if (RoomHandler.IsRoomLit(game.curxt_.xroom1, game))
            {
                goto L900;
            }
            /*                      !VALID ROOM, IS IT LIT? */
L450:
            AdventurerHandler.jigsup_(game, 522);
            /*                      !NO, GRUE */
            /*                      ! */
            return(ret_val);

            /* ROOM IS LIT, OR WINNER IS NOT PLAYER (NO GRUE). */

L500:
            if (dso3.findxt_(game, game.ParserVectors.prso, game.Player.Here))
            {
                goto L550;
            }
            /*                      !EXIT EXIST? */
L525:
            game.curxt_.xstrng = 678;
            /*                      !ASSUME WALL. */
            if (game.ParserVectors.prso == (int)XSearch.xup)
            {
                game.curxt_.xstrng = 679;
            }
            /*                      !IF UP, CANT. */
            if (game.ParserVectors.prso == (int)XSearch.xdown)
            {
                game.curxt_.xstrng = 680;
            }
            /*                      !IF DOWN, CANT. */
            if ((game.Rooms.RoomFlags[game.Player.Here - 1] & RoomFlags.RNWALL) != 0)
            {
                game.curxt_.xstrng = 524;
            }

            MessageHandler.rspeak_(game, game.curxt_.xstrng);
            game.ParserVectors.prscon = 1;
            /*                      !STOP CMD STREAM. */
            return(ret_val);

L550:
            switch (game.curxt_.xtype)
            {
            case 1: goto L900;

            case 2: goto L600;

            case 3: goto L700;

            case 4: goto L800;
            }
            /*                      !BRANCH ON EXIT TYPE. */
            throw new InvalidOperationException();
            //bug_(9, curxt_.xtype);

L700:
            if (cxappl_(game, game.curxt_.xactio) != 0)
            {
                goto L900;
            }
            /*                      !CEXIT... RETURNED ROOM? */
            // TODO: chadj figure this out
            //if (game.Flags[game.curxt_.xobj - 1])
            {
                //  goto L900;
            }
            /*                      !NO, FLAG ON? */
L600:
            if (game.curxt_.xstrng == 0)
            {
                goto L525;
            }
            /*                      !IF NO REASON, USE STD. */
            MessageHandler.rspeak_(game, game.curxt_.xstrng);
            /*                      !DENY EXIT. */
            game.ParserVectors.prscon = 1;
            /*                      !STOP CMD STREAM. */
            return(ret_val);

L800:
            if (cxappl_(game, game.curxt_.xactio) != 0)
            {
                goto L900;
            }
            /*                      !DOOR... RETURNED ROOM? */
            if ((game.Objects.oflag2[game.curxt_.xobj - 1] & ObjectFlags2.OPENBT) != 0)
            {
                goto L900;
            }
            /*                      !NO, DOOR OPEN? */
            if (game.curxt_.xstrng == 0)
            {
                game.curxt_.xstrng = 525;
            }
            /*                      !IF NO REASON, USE STD. */
            MessageHandler.rspsub_(game.curxt_.xstrng, game.Objects.odesc2[game.curxt_.xobj - 1], game);
            game.ParserVectors.prscon = 1;
            /*                      !STOP CMD STREAM. */
            return(ret_val);

L900:
            ret_val = AdventurerHandler.moveto_(game, game.curxt_.xroom1, game.Player.Winner);
            /*                      !MOVE TO ROOM. */
            if (ret_val)
            {
                ret_val = RoomHandler.RoomDescription(0, game);
            }
            /*                      !DESCRIBE ROOM. */
            return(ret_val);
        } /* walk_ */
Ejemplo n.º 6
0
        } /* drop_ */

        /* PUT- PUT VERB PROCESSOR */

        public static bool put_(Game game, bool flg)
        {
            /* System generated locals */
            bool ret_val;

            /* Local variables */
            int j;
            int svi, svo;

            ret_val = false;
            if (game.ParserVectors.prso <= game.Star.strbit && game.ParserVectors.prsi <= game.Star.strbit)
            {
                goto L200;
            }
            if (!ObjectHandler.objact_(game))
            {
                MessageHandler.rspeak_(game, 560);
            }
            /*                      !STAR */
            ret_val = true;
            return(ret_val);

L200:
            if ((game.Objects.oflag2[game.ParserVectors.prsi - 1] & ObjectFlags2.OPENBT) != 0 ||
                (game.Objects.oflag1[game.ParserVectors.prsi - 1] & (int)ObjectFlags.DOORBT + ObjectFlags.CONTBT) != 0 || (game.Objects.oflag2[game.ParserVectors.prsi - 1] & ObjectFlags2.VEHBT) != 0)
            {
                goto L300;
            }

            MessageHandler.rspeak_(game, 561);
            /*                      !CANT PUT IN THAT. */
            return(ret_val);

L300:
            if ((game.Objects.oflag2[game.ParserVectors.prsi - 1] & ObjectFlags2.OPENBT) != 0)
            {
                goto L400;
            }
            /*                      !IS IT OPEN? */
            MessageHandler.rspeak_(game, 562);
            /*                      !NO, JOKE */
            return(ret_val);

L400:
            if (game.ParserVectors.prso != game.ParserVectors.prsi)
            {
                goto L500;
            }
            /*                      !INTO ITSELF? */
            MessageHandler.rspeak_(game, 563);
            /*                      !YES, JOKE. */
            return(ret_val);

L500:
            if (game.Objects.ocan[game.ParserVectors.prso - 1] != game.ParserVectors.prsi)
            {
                goto L600;
            }
            /*                      !ALREADY INSIDE. */
            MessageHandler.rspsb2_(game, 564, game.Objects.odesc2[game.ParserVectors.prso - 1], game.Objects.odesc2[game.ParserVectors.prsi - 1]);
            ret_val = true;
            return(ret_val);

L600:
            if (ObjectHandler.weight_(0, game.ParserVectors.prso, 0, game) + ObjectHandler.weight_(0, game.ParserVectors.prsi, 0, game) + game.Objects.osize[game.ParserVectors.prso - 1] <= game.Objects.ocapac[game.ParserVectors.prsi - 1])
            {
                goto L700;
            }

            MessageHandler.rspeak_(game, 565);
            /*                      !THEN CANT DO IT. */
            return(ret_val);

            /* NOW SEE IF OBJECT (OR ITS CONTAINER) IS IN ROOM */

L700:
            j = game.ParserVectors.prso;
            /*                      !START SEARCH. */
L725:
            if (ObjectHandler.qhere_(game, j, game.Player.Here))
            {
                goto L750;
            }
            /*                      !IS IT HERE? */
            j = game.Objects.ocan[j - 1];
            if (j != 0)
            {
                goto L725;
            }
            /*                      !MORE TO DO? */
            goto L800;
            /*                      !NO, SCH FAILS. */

L750:
            svo = game.ParserVectors.prso;
            /*                      !SAVE PARSER. */
            svi = game.ParserVectors.prsi;
            game.ParserVectors.prsa = (int)VIndices.takew;
            game.ParserVectors.prsi = 0;
            if (!take_(game, false))
            {
                return(ret_val);
            }
            /*                      !TAKE OBJECT. */
            game.ParserVectors.prsa = (int)VIndices.putw;
            game.ParserVectors.prso = svo;
            game.ParserVectors.prsi = svi;
            goto L1000;

            /* NOW SEE IF OBJECT IS ON PERSON. */

L800:
            if (game.Objects.ocan[game.ParserVectors.prso - 1] == 0)
            {
                goto L1000;
            }
            /*                      !INSIDE? */
            if ((game.Objects.oflag2[game.Objects.ocan[game.ParserVectors.prso - 1] - 1] & ObjectFlags2.OPENBT) != 0)
            {
                goto L900;
            }
            /*                      !OPEN? */
            MessageHandler.rspsub_(game, 566, game.Objects.odesc2[game.ParserVectors.prso - 1]);
            /*                      !LOSE. */
            return(ret_val);

L900:
            AdventurerHandler.scrupd_(game, game.Objects.ofval[game.ParserVectors.prso - 1]);
            /*                      !SCORE OBJECT. */
            game.Objects.ofval[game.ParserVectors.prso - 1]   = 0;
            game.Objects.oflag2[game.ParserVectors.prso - 1] |= ObjectFlags2.TCHBT;
            ObjectHandler.newsta_(game, game.ParserVectors.prso, 0, 0, 0, game.Player.Winner);
            /*                      !TEMPORARILY ON WINNER. */

L1000:
            if (ObjectHandler.objact_(game))
            {
                return(ret_val);
            }
            /*                      !NO, GIVE OBJECT A SHOT. */
            ObjectHandler.newsta_(game, game.ParserVectors.prso, 2, 0, game.ParserVectors.prsi, 0);
            /*                      !CONTAINED INSIDE. */
            ret_val = true;
            return(ret_val);
        } /* put_ */
Ejemplo n.º 7
0
        } /* take_ */

        /* DROP- DROP VERB PROCESSOR */

        public static bool drop_(Game game, bool z)
        {
            /* System generated locals */
            bool ret_val;

            /* Local variables */
            bool f;
            int  i, x;

            ret_val = true;
            /*                      !ASSUME WINS. */
            x = game.Objects.ocan[game.ParserVectors.prso - 1];
            /*                      !GET CONTAINER. */
            if (x == 0)
            {
                goto L200;
            }
            /*                      !IS IT INSIDE? */
            if (game.Objects.oadv[x - 1] != game.Player.Winner)
            {
                goto L1000;
            }
            /*                      !IS HE CARRYING CON? */
            if ((game.Objects.oflag2[x - 1] & ObjectFlags2.OPENBT) != 0)
            {
                goto L300;
            }
            MessageHandler.rspsub_(game, 525, game.Objects.odesc2[x - 1]);
            /*                      !CANT REACH. */
            return(ret_val);

L200:
            if (game.Objects.oadv[game.ParserVectors.prso - 1] != game.Player.Winner)
            {
                goto L1000;
            }
            /*                      !IS HE CARRYING OBJ? */
L300:
            if (game.Adventurers.Vehicles[game.Player.Winner - 1] == 0)
            {
                goto L400;
            }
            /*                      !IS HE IN VEHICLE? */
            game.ParserVectors.prsi = game.Adventurers.Vehicles[game.Player.Winner - 1];
            /*                      !YES, */
            f = put_(game, true);
            /*                      !DROP INTO VEHICLE. */
            game.ParserVectors.prsi = 0;
            /*                      !DISARM PARSER. */
            return(ret_val);

            /*                      !DONE. */

L400:
            ObjectHandler.newsta_(game, game.ParserVectors.prso, 0, game.Player.Here, 0, 0);
            /*                      !DROP INTO ROOM. */
            if (game.Player.Here == (int)RoomIndices.mtree)
            {
                ObjectHandler.newsta_(game, game.ParserVectors.prso, 0, (int)RoomIndices.fore3, 0, 0);
            }

            AdventurerHandler.scrupd_(game, game.Objects.ofval[game.ParserVectors.prso - 1]);
            /*                      !SCORE OBJECT. */
            game.Objects.ofval[game.ParserVectors.prso - 1] = 0;
            /*                      !CANT BE SCORED AGAIN. */
            game.Objects.oflag2[game.ParserVectors.prso - 1] |= ObjectFlags2.TCHBT;

            if (ObjectHandler.objact_(game))
            {
                return(ret_val);
            }
            /*                      !DID IT HANDLE? */
            i = 0;
            /*                      !ASSUME NOTHING TO SAY. */
            if (game.ParserVectors.prsa == (int)VIndices.dropw)
            {
                i = 528;
            }

            if (game.ParserVectors.prsa == (int)VIndices.throww)
            {
                i = 529;
            }
            if (i != 0 && game.Player.Here == (int)RoomIndices.mtree)
            {
                i = 659;
            }
            MessageHandler.rspsub_(game, i, game.Objects.odesc2[game.ParserVectors.prso - 1]);
            return(ret_val);

L1000:
            MessageHandler.rspeak_(game, 527);
            /*                      !DONT HAVE IT. */
            return(ret_val);
        } /* drop_ */
Ejemplo n.º 8
0
        /* TAKE-- BASIC TAKE SEQUENCE */
        /* TAKE AN OBJECT (FOR VERBS TAKE, PUT, DROP, READ, ETC.) */

        public static bool take_(Game game, bool flg)
        {
            /* System generated locals */
            int  i__1;
            bool ret_val;

            /* Local variables */
            int oa;
            int x;

            ret_val = false;
            /*                      !ASSUME LOSES. */
            oa = game.Objects.oactio[game.ParserVectors.prso - 1];
            /*                      !GET OBJECT ACTION. */
            if (game.ParserVectors.prso <= game.Star.strbit)
            {
                goto L100;
            }
            /*                      !STAR? */
            ret_val = ObjectHandler.objact_(game);
            /*                      !YES, LET IT HANDLE. */
            return(ret_val);

L100:
            x = game.Objects.ocan[game.ParserVectors.prso - 1];
            /*                      !INSIDE? */
            if (game.ParserVectors.prso != game.Adventurers.Vehicles[game.Player.Winner - 1])
            {
                goto L400;
            }
            /*                      !HIS VEHICLE? */
            MessageHandler.rspeak_(game, 672);
            /*                      !DUMMY. */
            return(ret_val);

L400:
            if ((game.Objects.oflag1[game.ParserVectors.prso - 1] & ObjectFlags.TAKEBT) != 0)
            {
                goto L500;
            }
            if (!ObjectHandler.oappli_(oa, 0, game))
            {
                i__1 = game.rnd_(5) + 552;
                MessageHandler.rspeak_(game, i__1);
            }
            return(ret_val);

            /* OBJECT IS TAKEABLE AND IN POSITION TO BE TAKEN. */

L500:
            if (x != 0 || ObjectHandler.qhere_(game, game.ParserVectors.prso, game.Player.Here))
            {
                goto L600;
            }
            if (game.Objects.oadv[game.ParserVectors.prso - 1] == game.Player.Winner)
            {
                MessageHandler.rspeak_(game, 557);
            }
            /*                      !ALREADY GOT IT? */
            return(ret_val);

L600:
            if (x != 0 && game.Objects.oadv[x - 1] == game.Player.Winner || ObjectHandler.weight_(0, game.ParserVectors.prso, game.Player.Winner, game) + game.Objects.osize[game.ParserVectors.prso - 1] <= game.State.MaxLoad)
            {
                goto L700;
            }
            MessageHandler.rspeak_(game, 558);
            /*                      !TOO MUCH WEIGHT. */
            return(ret_val);

L700:
            ret_val = true;
            /*                      !AT LAST. */
            if (ObjectHandler.oappli_(oa, 0, game))
            {
                return(ret_val);
            }
            /*                      !DID IT HANDLE? */
            ObjectHandler.newsta_(game, game.ParserVectors.prso, 0, 0, 0, game.Player.Winner);
            /*                      !TAKE OBJECT FOR WINNER. */
            game.Objects.oflag2[game.ParserVectors.prso - 1] |= ObjectFlags2.TCHBT;
            AdventurerHandler.scrupd_(game, game.Objects.ofval[game.ParserVectors.prso - 1]);
            /*                      !UPDATE SCORE. */
            game.Objects.ofval[game.ParserVectors.prso - 1] = 0;
            /*                      !CANT BE SCORED AGAIN. */
            if (flg)
            {
                MessageHandler.rspeak_(game, 559);
            }
            /*                      !TELL TAKEN. */
            return(ret_val);
        } /* take_ */
Ejemplo n.º 9
0
        /* AAPPLI- APPLICABLES FOR ADVENTURERS */
        public static bool aappli_(Game game, int ri)
        {
            /* System generated locals */
            bool ret_val;

            /* Local variables */
            bool f;
            int  i;

            if (ri == 0)
            {
                goto L10;
            }
            /*                      !IF ZERO, NO APP. */
            ret_val = true;
            /*                      !ASSUME WINS. */
            switch (ri)
            {
            case 1: goto L1000;

            case 2: goto L2000;
            }
            /*                      !BRANCH ON ADV. */
            throw new InvalidOperationException();
            //bug_(11, ri);

            /* COMMON FALSE RETURN. */

L10:
            ret_val = false;
            return(ret_val);

            /* A1--	ROBOT.  PROCESS MOST COMMANDS GIVEN TO ROBOT. */

L1000:
            if (game.ParserVectors.prsa != (int)VIndices.raisew || game.ParserVectors.prso != (int)ObjectIndices.rcage)
            {
                goto L1200;
            }
            game.Clock.Flags[(int)ClockIndices.cevsph - 1] = false;
            /*                      !ROBOT RAISED CAGE. */
            game.Player.Winner = (int)AIndices.player;
            /*                      !RESET FOR PLAYER. */
            f = AdventurerHandler.moveto_(game, (int)RoomIndices.cager, game.Player.Winner);
            /*                      !MOVE TO NEW ROOM. */
            ObjectHandler.newsta_(game, (int)ObjectIndices.cage, 567, (int)RoomIndices.cager, 0, 0);
            /*                      !INSTALL CAGE IN ROOM. */
            ObjectHandler.newsta_(game, (int)ObjectIndices.robot, 0, (int)RoomIndices.cager, 0, 0);
            /*                      !INSTALL ROBOT IN ROOM. */
            game.Adventurers.Rooms[(int)AIndices.arobot - 1] = (int)RoomIndices.cager;
            /*                      !ALSO MOVE ROBOT/ADV. */
            game.Flags.cagesf = true;
            /*                      !CAGE SOLVED. */
            game.Objects.oflag1[(int)ObjectIndices.robot - 1] &= ~ObjectFlags.NDSCBT;
            game.Objects.oflag1[(int)ObjectIndices.spher - 1] |= ObjectFlags.TAKEBT;
            return(ret_val);

L1200:
            if (game.ParserVectors.prsa != (int)VIndices.drinkw && game.ParserVectors.prsa != (int)VIndices.eatw)
            {
                goto L1300;
            }

            MessageHandler.rspeak_(game, 568);
            /*                      !EAT OR DRINK, JOKE. */
            return(ret_val);

L1300:
            if (game.ParserVectors.prsa != (int)VIndices.readw)
            {
                goto L1400;
            }
            /*                      !READ, */
            MessageHandler.rspsub_(game, 569);
            /*                      !JOKE. */
            return(ret_val);

L1400:
            if (game.ParserVectors.prsa == (int)VIndices.walkw || game.ParserVectors.prsa == (int)VIndices.takew ||
                game.ParserVectors.prsa == (int)VIndices.dropw || game.ParserVectors.prsa == (int)VIndices.putw ||
                game.ParserVectors.prsa == (int)VIndices.pushw || game.ParserVectors.prsa ==
                (int)VIndices.throww || game.ParserVectors.prsa == (int)VIndices.turnw ||
                game.ParserVectors.prsa == (int)VIndices.leapw)
            {
                goto L10;
            }
            MessageHandler.rspsub_(game, 570);
            /*                      !JOKE. */
            return(ret_val);

            /* AAPPLI, PAGE 3 */

            /* A2--	MASTER.  PROCESS MOST COMMANDS GIVEN TO MASTER. */

L2000:
            if ((game.Objects.oflag2[(int)ObjectIndices.qdoor - 1] & ObjectFlags2.OPENBT) != 0)
            {
                goto L2100;
            }
            MessageHandler.rspsub_(game, 783);
            /*                      !NO MASTER YET. */
            return(ret_val);

L2100:
            if (game.ParserVectors.prsa != (int)VIndices.walkw)
            {
                goto L2200;
            }
            /*                      !WALK? */
            i = 784;
            /*                      !ASSUME WONT. */
            if (game.Player.Here == (int)RoomIndices.scorr && (game.ParserVectors.prso == (int)XSearch.xnorth ||
                                                               game.ParserVectors.prso == (int)XSearch.xenter) || game.Player.Here == (int)RoomIndices.ncorr &&
                (game.ParserVectors.prso == (int)XSearch.xsouth || game.ParserVectors.prso ==
                 (int)XSearch.xenter))
            {
                i = 785;
            }
            MessageHandler.rspsub_(game, i);
            return(ret_val);

L2200:
            if (game.ParserVectors.prsa == (int)VIndices.takew || game.ParserVectors.prsa == (int)VIndices.dropw ||
                game.ParserVectors.prsa == (int)VIndices.putw || game.ParserVectors.prsa ==
                (int)VIndices.throww || game.ParserVectors.prsa == (int)VIndices.pushw ||
                game.ParserVectors.prsa == (int)VIndices.turnw || game.ParserVectors.prsa ==
                (int)VIndices.spinw || game.ParserVectors.prsa == (int)VIndices.trntow ||
                game.ParserVectors.prsa == (int)VIndices.follow || game.ParserVectors.prsa ==
                (int)VIndices.stayw || game.ParserVectors.prsa == (int)VIndices.openw ||
                game.ParserVectors.prsa == (int)VIndices.closew || game.ParserVectors.prsa ==
                (int)VIndices.killw)
            {
                goto L10;
            }
            MessageHandler.rspsub_(game, 786);
            /*                      !MASTER CANT DO IT. */
            return(ret_val);
        } /* aappli_ */