예제 #1
0
 public virtual void BuildContentsSpillToFloor()
 {
     Globals.Buf.AppendFormat("; {0} contents spill to the {1}", DobjArtifact.EvalPlural("its", "their"), ActorRoom.EvalRoomType("floor", "ground"));
 }
예제 #2
0
 public virtual void PrintHackToBits()
 {
     gOut.Print("You {0} {1} to bits!", BlastSpell ? "blast" : "hack", DobjArtifact.EvalPlural("it", "them"));
 }
예제 #3
0
 public virtual void BuildSmashesToPieces()
 {
     Globals.Buf.SetFormat("{0}{1} {2} to pieces", Environment.NewLine, DobjArtifact.GetTheName(true, buf: Globals.Buf01), DobjArtifact.EvalPlural("smashes", "smash"));
 }
예제 #4
0
        public override void Execute()
        {
            Debug.Assert(DobjArtifact != null);

            DobjArtAc = DobjArtifact.Wearable;

            if (DobjArtAc == null)
            {
                PrintCantVerbObj(DobjArtifact);

                NextState = Globals.CreateInstance <IStartState>();

                goto Cleanup;
            }

            if (DobjArtifact.IsWornByCharacter())
            {
                gOut.Print("You're already wearing {0}!", DobjArtifact.EvalPlural("it", "them"));

                NextState = Globals.CreateInstance <IStartState>();

                goto Cleanup;
            }

            if (!DobjArtifact.IsCarriedByCharacter())
            {
                if (!GetCommandCalled)
                {
                    RedirectToGetCommand <IWearCommand>(DobjArtifact);
                }
                else if (DobjArtifact.DisguisedMonster == null)
                {
                    NextState = Globals.CreateInstance <IStartState>();
                }

                goto Cleanup;
            }

            if (DobjArtAc.Field1 > 0)
            {
                ArmorArtifact = gADB[gGameState.Ar];

                ShieldArtifact = gADB[gGameState.Sh];

                ArmorArtifactAc = ArmorArtifact != null ? ArmorArtifact.Wearable : null;

                ShieldArtifactAc = ShieldArtifact != null ? ShieldArtifact.Wearable : null;

                if (DobjArtAc.Field1 > 1)
                {
                    if (DobjArtAc.Field1 > 14)
                    {
                        DobjArtAc.Field1 = 14;
                    }

                    if (ArmorArtifactAc != null)
                    {
                        gOut.Print("You're already wearing armor!");

                        NextState = Globals.CreateInstance <IStartState>();

                        goto Cleanup;
                    }

                    gGameState.Ar = DobjArtifact.Uid;

                    ActorMonster.Armor = (DobjArtAc.Field1 / 2) + ((DobjArtAc.Field1 / 2) >= 3 ? 2 : 0) + (ShieldArtifactAc != null ? ShieldArtifactAc.Field1 : 0);
                }
                else
                {
                    if (ShieldArtifactAc != null)
                    {
                        gOut.Print("You're already wearing a shield!");

                        NextState = Globals.CreateInstance <IStartState>();

                        goto Cleanup;
                    }

                    // can't wear shield while using two-handed weapon

                    WeaponArtifact = ActorMonster.Weapon > 0 ? gADB[ActorMonster.Weapon] : null;

                    WeaponArtifactAc = WeaponArtifact != null ? WeaponArtifact.GeneralWeapon : null;

                    if (WeaponArtifactAc != null && WeaponArtifactAc.Field5 > 1)
                    {
                        PrintCantWearShieldWithWeapon(DobjArtifact, WeaponArtifact);

                        NextState = Globals.CreateInstance <IStartState>();

                        goto Cleanup;
                    }

                    gGameState.Sh = DobjArtifact.Uid;

                    ActorMonster.Armor = (ArmorArtifactAc != null ? (ArmorArtifactAc.Field1 / 2) + ((ArmorArtifactAc.Field1 / 2) >= 3 ? 2 : 0) : 0) + DobjArtAc.Field1;
                }
            }

            DobjArtifact.SetWornByCharacter();

            PrintWorn(DobjArtifact);

            ProcessEvents(EventType.AfterWearArtifact);

            if (GotoCleanup)
            {
                goto Cleanup;
            }

Cleanup:

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IMonsterStartState>();
            }
        }