Exemplo 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_ */
Exemplo n.º 2
0
        } /* blow_ */

        /* SWORDD- SWORD INTERMOVE DEMON */
        public static void swordd_(Game game)
        {
            /* System generated locals */
            int i__1, i__2;

            /* Local variables */
            int i, ng;

            if (game.Objects.oadv[(int)ObjectIndices.sword - 1] != (int)AIndices.player)
            {
                goto L500;
            }
            /*                      !HOLDING SWORD? */
            ng = 2;
            /*                      !ASSUME VILL CLOSE. */
            if (infest_(game, game.Player.Here))
            {
                goto L300;
            }
            /*                      !VILL HERE? */
            ng   = 1;
            i__1 = (int)XSearch.xmax;
            i__2 = (int)XSearch.xmin;
            for (i = (int)XSearch.xmin; i__2 < 0 ? i >= i__1 : i <= i__1; i += i__2)
            {
                /*                      !NO, SEARCH ROOMS. */
                if (!dso3.findxt_(game, i, game.Player.Here))
                {
                    goto L200;
                }
                /*                      !ROOM THAT WAY? */
                switch (game.curxt_.xtype)
                {
                case 1: goto L50;

                case 2: goto L200;

                case 3: goto L50;

                case 4: goto L50;
                }
                /*                      !SEE IF ROOM AT ALL. */
L50:
                if (infest_(game, game.curxt_.xroom1))
                {
                    goto L300;
                }
                /*                      !CHECK ROOM. */
L200:
                ;
            }
            ng = 0;
            /*                      !NO GLOW. */

L300:
            if (ng == game.Hack.swdsta)
            {
                return;
            }
            /*                      !ANY STATE CHANGE? */
            i__2 = ng + 495;
            MessageHandler.Speak(game, i__2);
            /*                      !YES, TELL NEW STATE. */
            game.Hack.swdsta = ng;
            return;

L500:
            game.Hack.swdact = false;
            /*                      !DROPPED SWORD, */
            return;
            /*                      !DISABLE DEMON. */
        } /* swordd_ */
Exemplo n.º 3
0
        /// <summary>
        /// score_ - Print out current score
        /// </summary>
        /// <param name="game"></param>
        /// <param name="flg"></param>
        public static void score_(Game game, bool flg)
        {
            int[] rank  = { 20, 19, 18, 16, 12, 8, 4, 2, 1, 0 };
            int[] erank = { 20, 15, 10, 5, 0 };

            int i__1;

            int i, intAs;

            intAs = game.Adventurers.Scores[game.Player.Winner - 1];

            if (game.Flags.endgmf)
            {
                goto L60;
            }

            // !ENDGAME?
            MessageHandler.more_output(string.Empty);

            MessageHandler.more_output("Your score ");
            if (flg)
            {
                MessageHandler.more_output("would be");
            }
            else
            {
                MessageHandler.more_output("is");
            }

            MessageHandler.more_output($" {intAs} [total of {game.State.MaxScore} points], in {game.State.Moves} move");

            if (game.State.Moves != 1)
            {
                MessageHandler.more_output("s");
            }

            MessageHandler.more_output(".\n");

            for (i = 1; i <= 10; ++i)
            {
                if (intAs * 20 / game.State.MaxScore >= rank[i - 1])
                {
                    goto L50;
                }
                // L10:
            }

L50:
            i__1 = i + 484;
            MessageHandler.Speak(i__1, game);
            return;

L60:
            MessageHandler.more_output(string.Empty);
            MessageHandler.more_output("Your score in the endgame ");

            if (flg)
            {
                MessageHandler.more_output("would be");
            }
            else
            {
                MessageHandler.more_output("is");
            }

            MessageHandler.more_output($" {game.State.egscor} [total of {game.State.egmxsc} points], in {game.State.Moves} moves.\n");

            for (i = 1; i <= 5; ++i)
            {
                if (game.State.egscor * 20 / game.State.egmxsc >= erank[i - 1])
                {
                    goto L80;
                }
                // L70:
            }

L80:
            i__1 = i + 786;
            MessageHandler.Speak(i__1, game);
        }
Exemplo 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();
        }
Exemplo n.º 5
0
        /// <summary>
        /// invent_ - PRINT CONTENTS OF ADVENTURER
        /// </summary>
        /// <param name="game"></param>
        public static void PrintContents(int adventurer, Game game)
        {
            int i__1;

            // Local variables
            int i, j;

            i = 575;
            // !FIRST LINE.
            if (adventurer != (int)AIndices.player)
            {
                i = 576;
            }
            // !IF NOT ME.
            i__1 = game.Objects.Count;
            for (j = 1; j <= i__1; ++j)
            {
                // !LOOP
                if (game.Objects.oadv[j - 1] != adventurer || (game.Objects.oflag1[j - 1] & ObjectFlags.VISIBT) == 0)
                {
                    goto L10;
                }

                MessageHandler.rspsub_(i, game.Objects.odesc2[game.Adventurers.Objects[adventurer - 1] - 1], game);
                i = 0;

                MessageHandler.rspsub_(502, game.Objects.odesc2[j - 1], game);
L10:
                ;
            }

            if (i == 0)
            {
                goto L25;
            }

            // !ANY OBJECTS?
            if (adventurer == (int)AIndices.player)
            {
                MessageHandler.Speak(578, game);
            }

            // !NO, TELL HIM.
            return;

L25:
            i__1 = game.Objects.Count;
            for (j = 1; j <= i__1; ++j)
            {
                // !LOOP.
                if (game.Objects.oadv[j - 1] != adventurer || (game.Objects.oflag1[j - 1] &
                                                               ObjectFlags.VISIBT) == 0 || (game.Objects.oflag1[j - 1] &
                                                                                            ObjectFlags.TRANBT) == 0 && (game.Objects.oflag2[j - 1] &
                                                                                                                         ObjectFlags2.OPENBT) == 0)
                {
                    goto L100;
                }
                if (!ObjectHandler.IsObjectEmpty(j, game))
                {
                    ObjectHandler.PrintDescription(j, 573, game);
                }

                // !IF NOT EMPTY, LIST.
L100:
                ;
            }
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public static bool ballop_(Game game, int arg)
        {
            /* System generated locals */
            bool ret_val;

            ret_val = true;
            /*                      !ASSUME WINS. */
            if (arg != 2)
            {
                goto L200;
            }
            /*                      !READOUT? */
            if (game.ParserVectors.prsa != (int)VIndices.lookw)
            {
                goto L10;
            }
            /*                      !ONLY PROCESS LOOK. */
            if (game.Switches.binff != 0)
            {
                goto L50;
            }
            /*                      !INFLATED? */
            MessageHandler.Speak(game, 543);
            /*                      !NO. */
            goto L100;
L50:
            MessageHandler.rspsub_(game, 544, game.Objects.odesc2[game.Switches.binff - 1]);
            /*                      !YES. */
L100:
            if (game.Switches.btief != 0)
            {
                MessageHandler.Speak(game, 545);
            }
            /*                      !HOOKED? */
            return(ret_val);

L200:
            if (arg != 1)
            {
                goto L500;
            }
            /*                      !READIN? */
            if (game.ParserVectors.prsa != (int)VIndices.walkw)
            {
                goto L300;
            }
            /*                      !WALK? */
            if (dso3.findxt_(game, game.ParserVectors.prso, game.Player.Here))
            {
                goto L250;
            }
            /*                      !VALID EXIT? */
            MessageHandler.Speak(game, 546);
            /*                      !NO, JOKE. */
            return(ret_val);

L250:
            if (game.Switches.btief == 0)
            {
                goto L275;
            }
            /*                      !TIED UP? */
            MessageHandler.Speak(game, 547);
            /*                      !YES, JOKE. */
            return(ret_val);

L275:
            if (game.curxt_.xtype != xpars_.xnorm)
            {
                goto L10;
            }
            /*                      !NORMAL EXIT? */
            if ((game.Rooms.RoomFlags[game.curxt_.xroom1 - 1] & RoomFlags.RMUNG) == 0)
            {
                game.State.bloc = game.curxt_.xroom1;
            }
L10:
            ret_val = false;
            return(ret_val);

L300:
            if (game.ParserVectors.prsa != (int)VIndices.takew || game.ParserVectors.prso != game.Switches.binff)
            {
                goto L350;
            }
            MessageHandler.rspsub_(game, 548, game.Objects.odesc2[game.Switches.binff - 1]);
            /*                      !RECEP CONT TOO HOT. */
            return(ret_val);

L350:
            if (game.ParserVectors.prsa != (int)VIndices.putw ||
                game.ParserVectors.prsi != (int)ObjectIndices.recep ||
                ObjectHandler.qempty_(game, ObjectIndices.recep))
            {
                goto L10;
            }

            MessageHandler.Speak(game, 549);
            return(ret_val);

L500:
            if (game.ParserVectors.prsa != (int)VIndices.unboaw || (game.Rooms.RoomFlags[game.Player.Here - 1] & RoomFlags.RLAND) == 0)
            {
                goto L600;
            }
            if (game.Switches.binff != 0)
            {
                game.Clock.Ticks[(int)ClockIndices.cevbal - 1] = 3;
            }
            /*                      !HE GOT OUT, START BALLOON. */
            goto L10;

L600:
            if (game.ParserVectors.prsa != (int)VIndices.burnw || game.Objects.ocan[game.ParserVectors.prso - 1] != (int)ObjectIndices.recep)
            {
                goto L700;
            }

            MessageHandler.rspsub_(game, 550, game.Objects.odesc2[game.ParserVectors.prso - 1]);
            /*                      !LIGHT FIRE IN RECEP. */
            game.Clock.Ticks[(int)ClockIndices.cevbrn - 1]    = game.Objects.osize[game.ParserVectors.prso - 1] * 20;
            game.Objects.oflag1[game.ParserVectors.prso - 1] |= ((int)ObjectFlags.ONBT + ObjectFlags.FLAMBT + (int)ObjectFlags.LITEBT) & ~((int)ObjectFlags.TAKEBT + ObjectFlags.READBT);

            if (game.Switches.binff != 0)
            {
                return(ret_val);
            }
            if (!game.Flags.blabf)
            {
                ObjectHandler.newsta_(ObjectIndices.blabe, 0, 0, ObjectIndices.ballo, 0, game);
            }
            game.Flags.blabf    = true;
            game.Switches.binff = game.ParserVectors.prso;
            game.Clock.Ticks[(int)ClockIndices.cevbal - 1] = 3;
            MessageHandler.Speak(game, 551);
            return(ret_val);

L700:
            if (game.ParserVectors.prsa == (int)VIndices.unboaw && game.Switches.binff != 0 &&
                (game.Rooms.RoomFlags[game.Player.Here - 1] & RoomFlags.RLAND) != 0)
            {
                game.Clock.Ticks[(int)ClockIndices.cevbal - 1] = 3;
            }

            goto L10;
        }
Exemplo n.º 8
0
        public static bool lightp_(Game game, ObjectIndices obj)
        {
            bool ret_val;

            ObjectFlags flobts;
            int         i;

            ret_val = true;
            /*                      !ASSUME WINS */
            flobts = ObjectFlags.FLAMBT + (int)ObjectFlags.LITEBT + (int)ObjectFlags.ONBT;
            if (obj != ObjectIndices.candl)
            {
                goto L20000;
            }
            /*                      !CANDLE? */
            if (game.Switches.orcand != 0)
            {
                goto L19100;
            }
            /*                      !FIRST REF? */
            game.Switches.orcand = 1;
            /*                      !YES, CANDLES ARE */
            game.Clock.Ticks[(int)ClockIndices.cevcnd - 1] = 50;
            /*                      !BURNING WHEN SEEN. */

L19100:
            if (game.ParserVectors.prsi == (int)ObjectIndices.candl)
            {
                goto L10;
            }
            /*                      !IGNORE IND REFS. */
            if (game.ParserVectors.prsa != (int)VIndices.trnofw)
            {
                goto L19200;
            }
            /*                      !TURN OFF? */
            i = 513;
            /*                      !ASSUME OFF. */
            if ((game.Objects.oflag1[(int)ObjectIndices.candl - 1] & ObjectFlags.ONBT) != 0)
            {
                i = 514;
            }
            /*                      !IF ON, DIFFERENT. */
            game.Clock.Flags[(int)ClockIndices.cevcnd - 1] = false;
            /*                      !DISABLE COUNTDOWN. */
            game.Objects.oflag1[(int)ObjectIndices.candl - 1] &= ~ObjectFlags.ONBT;
            MessageHandler.Speak(i, game);
            return(ret_val);

L19200:
            if (game.ParserVectors.prsa != (int)VIndices.burnw && game.ParserVectors.prsa != (int)VIndices.trnonw)
            {
                goto L10;
            }
            if ((game.Objects.oflag1[(int)ObjectIndices.candl - 1] & ObjectFlags.LITEBT) != 0)
            {
                goto L19300;
            }
            MessageHandler.Speak(game, 515);
            /*                      !CANDLES TOO SHORT. */
            return(ret_val);

L19300:
            if (game.ParserVectors.prsi != 0)
            {
                goto L19400;
            }

            /*                      !ANY FLAME? */
            MessageHandler.Speak(game, 516);
            /*                      !NO, LOSE. */
            game.ParserVectors.prswon = false;
            return(ret_val);

L19400:
            if (game.ParserVectors.prsi != (int)ObjectIndices.match || !((game.Objects.oflag1[(int)ObjectIndices.match - 1] & ObjectFlags.ONBT) != 0))
            {
                goto L19500;
            }
            i = 517;
            /*                      !ASSUME OFF. */
            if ((game.Objects.oflag1[(int)ObjectIndices.candl - 1] & ObjectFlags.ONBT) != 0)
            {
                i = 518;
            }
            /*                      !IF ON, JOKE. */
            game.Objects.oflag1[(int)ObjectIndices.candl - 1] |= ObjectFlags.ONBT;
            game.Clock.Flags[(int)ClockIndices.cevcnd - 1]     = true;
            /*                      !RESUME COUNTDOWN. */
            MessageHandler.Speak(i, game);
            return(ret_val);

L19500:
            if (game.ParserVectors.prsi != (int)ObjectIndices.torch || !((game.Objects.oflag1[(int)ObjectIndices.torch - 1] & ObjectFlags.ONBT) != 0))
            {
                goto L19600;
            }
            if ((game.Objects.oflag1[(int)ObjectIndices.candl - 1] & ObjectFlags.ONBT) != 0)
            {
                goto L19700;
            }
            /*                      !ALREADY ON? */

            ObjectHandler.newsta_(ObjectIndices.candl, 521, 0, 0, 0, game);
            /*                      !NO, VAPORIZE. */
            return(ret_val);

L19600:
            MessageHandler.Speak(game, 519);
            /*                      !CANT LIGHT WITH THAT. */
            return(ret_val);

L19700:
            MessageHandler.Speak(game, 520);
            /*                      !ALREADY ON. */
            return(ret_val);

L20000:
            if (obj != ObjectIndices.match)
            {
                throw new InvalidOperationException();
                //bug_(6, obj);
            }

            if (game.ParserVectors.prsa != (int)VIndices.trnonw || game.ParserVectors.prso != (int)ObjectIndices.match)
            {
                goto L20500;
            }
            if (game.Switches.ormtch != 0)
            {
                goto L20100;
            }
            /*                      !ANY MATCHES LEFT? */
            MessageHandler.Speak(183, game);
            /*                      !NO, LOSE. */
            return(ret_val);

L20100:
            --game.Switches.ormtch;
            /*                      !DECREMENT NO MATCHES. */
            game.Objects.oflag1[(int)ObjectIndices.match - 1] |= flobts;
            game.Clock.Ticks[(int)ClockIndices.cevmat - 1]     = 2;
            /*                      !COUNTDOWN. */
            MessageHandler.Speak(184, game);
            return(ret_val);

L20500:
            if (game.ParserVectors.prsa != (int)VIndices.trnofw || (game.Objects.oflag1[(int)ObjectIndices.match - 1] & ObjectFlags.ONBT) == 0)
            {
                goto L10;
            }

            game.Objects.oflag1[(int)ObjectIndices.match - 1] &= ~flobts;
            game.Clock.Ticks[(int)ClockIndices.cevmat - 1]     = 0;
            MessageHandler.Speak(185, game);
            return(ret_val);

            /* HERE FOR FALSE RETURN */

L10:
            ret_val = false;
            return(ret_val);
        }
Exemplo n.º 9
0
        public void Play()
        {
            MessageHandler.Speak(1, this);
            bool result = RoomHandler.RoomDescription(3, this);
            bool f      = false;
            int  i      = 0;

            while (this.isRunning)
            {
L100:
                if (!this.isRunning)
                {
                    // Game is over, exit this game loop.
                    continue;
                }

                this.Player.Winner  = (int)AIndices.player;
                this.Player.TelFlag = false;

                string input = string.Empty;

                if (this.ParserVectors.prscon <= 1)
                {
                    input = Parser.ReadLine(1);
                    this.ParserVectors.prscon = 1;
                }

                ++this.State.Moves;
                this.ParserVectors.prswon = Parser.Parse(input, true, this);

                if (!this.ParserVectors.prswon)
                {
                    goto L400;
                }

                if (xvehic_(1))
                {
                    goto L400;
                }

                if (this.ParserVectors.prsa == (int)VIndices.tellw)
                {
                    //goto L2000;
                }

L300:
                if (this.ParserVectors.prso == (int)ObjectIndices.valua || this.ParserVectors.prso == (int)ObjectIndices.every)
                {
                    goto L900;
                }

                if (!Parser.vappli_(input, this.ParserVectors.prsa, this))
                {
                    goto L400;
                }

L350:
                if (!Flags.echof && this.Player.Here == (int)RoomIndices.echor)
                {
                    goto L1000;
                }

                f = RoomHandler.rappli_(this.Rooms.RoomActions[this.Player.Here - 1], this);

L400:
                xendmv_(this.Player.TelFlag);

                // !DO END OF MOVE.
                if (!RoomHandler.IsRoomLit(this.Player.Here, this))
                {
                    this.ParserVectors.prscon = 1;
                }

                goto L100;

L900:
                dverb1.valuac_(this, (int)ObjectIndices.valua);
                goto L350;
                // GAME, PAGE 3

                // SPECIAL CASE-- ECHO ROOM.
                // IF INPUT IS NOT 'ECHO' OR A DIRECTION, JUST ECHO.

L1000:
                input = Parser.ReadLine(0);

                // !CHARGE FOR MOVES.
                ++this.State.Moves;

                if (input.Equals("ECHO"))
                {
                    goto L1300;
                }

                MessageHandler.Speak(571, this);

                // !KILL THE ECHO.
                Flags.echof = true;
                this.Objects.oflag2[(int)ObjectIndices.bar - 1] &= ~ObjectFlags2.SCRDBT;
                this.ParserVectors.prswon = true;
                // !FAKE OUT PARSER.
                this.ParserVectors.prscon = 1;
                // !FORCE NEW INPUT.
                goto L400;

L1300:
                this.ParserVectors.prswon = Parser.Parse(input, false, this);
                if (!this.ParserVectors.prswon || this.ParserVectors.prsa != (int)VIndices.walkw)
                {
                    goto L1400;
                }
                if (dso3.findxt_(this, this.ParserVectors.prso, this.Player.Here))
                {
                    goto L300;
                }
                // !VALID EXIT?

L1400:
                MessageHandler.more_output(input);
                this.Player.TelFlag = true;
                // !INDICATE OUTPUT.
                goto L1000;
                // !MORE ECHO ROOM.
                // GAME, PAGE 4

                // SPECIAL CASE-- TELL <ACTOR>, NEW COMMAND
                // NOTE THAT WE CANNOT BE IN THE ECHO ROOM.

L2000:
                if ((this.Objects.oflag2[this.ParserVectors.prso - 1] & ObjectFlags2.ACTRBT) != 0)
                {
                    goto L2100;
                }

                MessageHandler.Speak(602, this);
                // !CANT DO IT.
                goto L350;
                // !VAPPLI SUCCEEDS.

L2100:
                this.Player.Winner = ObjectHandler.GetActor(this.ParserVectors.prso, this);
                // !NEW PLAYER.
                this.Player.Here = this.Adventurers.Rooms[this.Player.Winner - 1];

                // !NEW LOCATION.
                if (this.ParserVectors.prscon <= 1)
                {
                    goto L2700;
                }

                // !ANY INPUT?
                if (Parser.Parse(input, true, this))
                {
                    goto L2150;
                }

L2700:
                i = 341;
                // !FAILS.
                if (this.Player.TelFlag)
                {
                    i = 604;
                }
                // !GIVE RESPONSE.
                MessageHandler.Speak(i, this);

L2600:
                this.Player.Winner = (int)AIndices.player;
                // !RESTORE STATE.
                this.Player.Here = this.Adventurers.Rooms[this.Player.Winner - 1];
                goto L350;

L2150:
                //if (ObjectHandler.aappli_(this.Adventurers.Actions[this.Player.Winner - 1], game))
                //{
                //    goto L2400;
                //}

                // !ACTOR HANDLE?
                //if (xvehic_(1))
                //{
                //    goto L2400;
                //}

                // !VEHICLE HANDLE?
                if (this.ParserVectors.prso == (int)ObjectIndices.valua || this.ParserVectors.prso == (int)ObjectIndices.every)
                {
                    goto L2900;
                }
                if (!Parser.vappli_(input, this.ParserVectors.prsa, this))
                {
                    goto L2400;
                }
                // !VERB HANDLE?
                // L2350:
                f = RoomHandler.rappli_(this.Rooms.RoomActions[this.Player.Here - 1], this);

L2400:
                xendmv_(this.Player.TelFlag);
                // !DO END OF MOVE.
                goto L2600;
                // !DONE.

L2900:
                dverb1.valuac_(this, (int)ObjectIndices.valua);
                // !ALL OR VALUABLES.
                goto L350;
            }
        }
Exemplo n.º 10
0
 public static void Speak(Game game, int messageNumber) => MessageHandler.Speak(messageNumber, game);
Exemplo n.º 11
0
 public static void rspeak_(Game game, int messageNumber) => MessageHandler.Speak(game, messageNumber);