Ejemplo n.º 1
0
        /// <summary></summary>
        public virtual void PrintAttack()
        {
            SetAttackDesc();

            AttackDesc01 = string.Format(AttackDesc, OfMonster.IsCharacterMonster() ? "" : "s");

            OfMonsterName = OfMonster.IsCharacterMonster() ? "You" :
                            OfMonster.EvalInRoomLightLevel(AttackNumber == 1 ? "An unseen offender" : "The unseen offender",
                                                           OfMonster.InitGroupCount > 1 && AttackNumber == 1 ? OfMonster.GetArticleName(true, true, false, true) : OfMonster.GetTheName(true, true, false, true));

            DfMonsterName = DfMonster.IsCharacterMonster() ? "you" :
                            DfMonster.EvalInRoomLightLevel("an unseen defender",
                                                           DfMonster.InitGroupCount > 1 ? DfMonster.GetArticleName(groupCountOne: true) : DfMonster.GetTheName(groupCountOne: true));

            gOut.Write("{0}{1} {2} {3}{4}.",
                       Environment.NewLine,
                       OfMonsterName,
                       AttackDesc01,
                       DfMonsterName,
                       OfWeapon != null &&
                       (WeaponRevealType == WeaponRevealType.Always ||
                        (WeaponRevealType == WeaponRevealType.OnlyIfSeen && OfWeapon.Seen)) ?
                       " with " + OfWeapon.GetArticleName() :
                       "");
        }
Ejemplo n.º 2
0
 /// <summary></summary>
 public virtual void PrintSparksFly()
 {
     gOut.Write("{0}  Sparks fly from {1}!",
                Environment.NewLine,
                OfMonster.IsCharacterMonster() || OfMonster.IsInRoomLit() ?
                (
                    (WeaponRevealType == WeaponRevealType.Never ||
                     (WeaponRevealType == WeaponRevealType.OnlyIfSeen && !OfWeapon.Seen)) ?
                    OfWeapon.GetArticleName() :
                    OfWeapon.GetTheName()
                ) :
                "a weapon");
 }
Ejemplo n.º 3
0
 /// <summary></summary>
 public virtual void PrintWeaponDropped()
 {
     gOut.Write("{0}  {1} {2} {3}!",
                Environment.NewLine,
                OfMonster.IsCharacterMonster() ? "You" :
                OfMonster.EvalInRoomLightLevel("The offender", OfMonster.GetTheName(true, true, false, true)),
                OfMonster.IsCharacterMonster() ? "drop" : "drops",
                OfMonster.IsCharacterMonster() || OfMonster.IsInRoomLit() ?
                (
                    (WeaponRevealType == WeaponRevealType.Never ||
                     (WeaponRevealType == WeaponRevealType.OnlyIfSeen && !OfWeapon.Seen)) ?
                    OfWeapon.GetArticleName(buf: Globals.Buf01) :
                    OfWeapon.GetTheName(buf: Globals.Buf01)
                ) :
                "a weapon");
 }
Ejemplo n.º 4
0
        public override void PrintSparksFly()
        {
            // Falcon

            if (OfWeapon.Uid == 5)
            {
                gOut.Write("{0}  {1} fails to launch!",
                           Environment.NewLine,
                           OfMonster.IsCharacterMonster() || OfMonster.IsInRoomLit() ?
                           (
                               (WeaponRevealType == WeaponRevealType.Never ||
                                (WeaponRevealType == WeaponRevealType.OnlyIfSeen && !OfWeapon.Seen)) ?
                               OfWeapon.GetArticleName(true) :
                               OfWeapon.GetTheName(true)
                           ) :
                           "A weapon");
            }
            else
            {
                base.PrintSparksFly();
            }
        }
Ejemplo n.º 5
0
        /// <summary></summary>
        public virtual void AttackFumble()
        {
            RetCode rc;

            PrintFumble();

            _rl = gEngine.RollDice(1, 100, 0);

            if ((Globals.IsRulesetVersion(5, 15, 25) && _rl < 36) || (!Globals.IsRulesetVersion(5, 15, 25) && _rl < 41))
            {
                PrintRecovered();

                CombatState = CombatState.EndAttack;

                goto Cleanup;
            }

            if ((Globals.IsRulesetVersion(5, 15, 25) && _rl < 76) || (!Globals.IsRulesetVersion(5, 15, 25) && _rl < 81))
            {
                if (gGameState.Ls > 0 && gGameState.Ls == OfWeaponUid)
                {
                    LightOut = true;
                }

                OfWeapon.SetInRoom(OfMonster.GetInRoom());

                WpnArtifact = gADB[OfMonster.Weapon];

                Debug.Assert(WpnArtifact != null);

                rc = WpnArtifact.RemoveStateDesc(WpnArtifact.GetReadyWeaponDesc());

                Debug.Assert(gEngine.IsSuccess(rc));

                OfMonster.Weapon = !OfMonster.IsCharacterMonster() ? -OfWeaponUid - 1 : -1;

                PrintWeaponDropped();

                CombatState = CombatState.EndAttack;

                goto Cleanup;
            }

            if (_rl > 95)
            {
                PrintWeaponHitsUser();

                DfMonster = OfMonster;

                CombatState = CombatState.AttackHit;

                goto Cleanup;
            }

            if (OfAc.Type == ArtifactType.MagicWeapon)
            {
                PrintSparksFly();

                CombatState = CombatState.EndAttack;

                goto Cleanup;
            }

            if (_rl < 91)
            {
                OfAc.Field4--;

                if (OfAc.Field4 > 0)
                {
                    PrintWeaponDamaged();

                    CombatState = CombatState.EndAttack;

                    goto Cleanup;
                }
            }

            PrintWeaponBroken();

            if (gGameState.Ls > 0 && gGameState.Ls == OfWeaponUid)
            {
                LightOut = true;
            }

            OfWeapon.SetInLimbo();

            WpnArtifact = gADB[OfMonster.Weapon];

            Debug.Assert(WpnArtifact != null);

            rc = WpnArtifact.RemoveStateDesc(WpnArtifact.GetReadyWeaponDesc());

            Debug.Assert(gEngine.IsSuccess(rc));

            OfMonster.Weapon = -1;

            _rl = gEngine.RollDice(1, 100, 0);

            if (_rl > 50 || OfAc.Field4 <= 0)
            {
                CombatState = CombatState.EndAttack;

                goto Cleanup;
            }

            PrintBrokenWeaponHitsUser();

            DfMonster = OfMonster;

            _rl = gEngine.RollDice(1, 5, 95);

            CombatState = CombatState.AttackHit;

Cleanup:

            ;
        }
Ejemplo n.º 6
0
        public override void CheckArmor()
        {
            var beholderMonster = gMDB[36] as Framework.IMonster;

            Debug.Assert(beholderMonster != null);

            var waterWeirdMonster = gMDB[38] as Framework.IMonster;

            Debug.Assert(waterWeirdMonster != null);

            // Bypass armor check for beholder clumsiness spell and water weird envelopment

            if ((OfMonster?.Uid == 36 && beholderMonster.AttackDesc.Equals("cast{0} a clumsiness spell on", StringComparison.OrdinalIgnoreCase)) || (OfMonster?.Uid == 38 && waterWeirdMonster.AttackDesc.Equals("envelop{0}", StringComparison.OrdinalIgnoreCase)))
            {
                CombatState = RTEnums.CombatState.CheckMonsterStatus;
            }
            else
            {
                var room = gRDB[gGameState.Ro];

                Debug.Assert(room != null);

                var artTypes = new Enums.ArtifactType[] { Enums.ArtifactType.Weapon, Enums.ArtifactType.MagicWeapon };

                var immuneMonsterUids = new long[] { 8, 9, 14, 15, 16, 17 };

                var ac = OfWeapon != null?OfWeapon.GetArtifactCategory(artTypes) : null;

                // Apply special defenses

                if (OfMonster?.Uid != 50 && !BlastSpell)
                {
                    // Some monsters are immune to non-magical weapons

                    if (immuneMonsterUids.Contains(DfMonster.Uid))
                    {
                        if (ac == null || ac.Field1 < 20)
                        {
                            if (DfMonster.IsInRoom(room))
                            {
                                gOut.Write("{0}{1}{2} seems unaffected{3}!", Environment.NewLine, OmitBboaPadding ? "" : "  ", room.EvalLightLevel("The defender", DfMonster.GetTheName(true)), OfWeapon != null ? " by the weapon" : "");
                            }

                            CombatState = RTEnums.CombatState.EndAttack;

                            goto Cleanup;
                        }
                    }

                    // Skeleton and crimson amoeba are resistant to non-club weapons (half damage)

                    else if (DfMonster.Uid == 3 || DfMonster.Uid == 25)
                    {
                        if (ac == null || ac.Field2 != (long)Enums.Weapon.Club)
                        {
                            _d2 = (long)Math.Round((double)_d2 / 2.0);
                        }
                    }

                    // Water weird is extremely resistant to non-club weapons (minimum damage)

                    else if (DfMonster.Uid == 38)
                    {
                        if (ac == null || ac.Field2 != (long)Enums.Weapon.Club)
                        {
                            if (_d2 > 1)
                            {
                                _d2 = 1;
                            }
                        }
                    }
                }

                // Bloodnettle always injures when draining blood

                if (OfMonster?.Uid == 20 && DfMonster.Uid == gGameState.BloodnettleVictimUid && _d2 < 1)
                {
                    _d2 = 1;
                }

                base.CheckArmor();

Cleanup:

                ;
            }
        }