Example #1
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");
 }
Example #2
0
        public override void AttackHit()
        {
            base.AttackHit();

            var room = DfMonster.GetInRoom();

            Debug.Assert(room != null);

            var netArtifact = gADB[24];

            Debug.Assert(netArtifact != null);

            var rl = gEngine.RollDice(1, 100, 0);

            var isNetCarriedByDefender = DfMonster.IsCharacterMonster() ? netArtifact.IsCarriedByCharacter() : netArtifact.IsCarriedByMonster(DfMonster);

            // Various bats strangled by net

            if (OfMonster.Uid > 6 && OfMonster.Uid < 11 && isNetCarriedByDefender && rl > 50)
            {
                if (DfMonster.IsCharacterMonster() || room.IsLit())
                {
                    gOut.Write("{0}{1}{2} flies into the net that {3} carrying and is strangled!", Environment.NewLine, OmitBboaPadding ? "" : "  ", room.EvalLightLevel("The offender", OfMonster.GetTheName(true)), DfMonster.IsCharacterMonster() ? "you are" : DfMonster.GetTheName() + " is");
                }
                else
                {
                    gOut.Write("{0}{1}The offender is strangled by the defender!", Environment.NewLine, OmitBboaPadding ? "" : "  ");
                }

                DfMonster = OfMonster;

                _d2 = DfMonster.Hardiness - DfMonster.DmgTaken;

                CombatState = CombatState.CheckArmor;
            }
        }
Example #3
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() :
                       "");
        }
Example #4
0
        public override void CheckMonsterStatus()
        {
            var room = DfMonster.GetInRoom();

            Debug.Assert(room != null);

            var rl = gEngine.RollDice(1, 100, 0);

            // Apply special attacks

            if (OfMonster?.Uid == 9)
            {
                if (DfMonster.Uid > 17 && rl > 50)
                {
                    if (DfMonster.IsCharacterMonster() || room.IsLit())
                    {
                        gOut.Write("{0}{1}{2}", Environment.NewLine, OmitBboaPadding ? "" : "  ", DfMonster.IsCharacterMonster() ? "You suddenly feel weaker!" : DfMonster.GetTheName(true) + " suddenly looks weaker!");
                    }

                    var stat = gEngine.GetStats(Stat.Hardiness);

                    Debug.Assert(stat != null);

                    DfMonster.Hardiness--;

                    if (DfMonster.Hardiness < stat.MinValue)
                    {
                        DfMonster.Hardiness = stat.MinValue;
                    }
                    else if (DfMonster.IsCharacterMonster())
                    {
                        gGameState.PlayerHardinessPointsDrained++;
                    }

                    if (DfMonster.DmgTaken > DfMonster.Hardiness)
                    {
                        DfMonster.DmgTaken = DfMonster.Hardiness;
                    }
                }
            }
            else if (OfMonster?.Uid == 11)
            {
                var carrionCrawlerMonster = OfMonster as Framework.IMonster;

                Debug.Assert(carrionCrawlerMonster != null);

                if (DfMonster.Uid != 50 && carrionCrawlerMonster.AttackDesc.Equals("flail{0} at", StringComparison.OrdinalIgnoreCase) && rl > 50)
                {
                    var saved = DfMonster.IsCharacterMonster() ? gEngine.SaveThrow(Stat.Hardiness) : rl > 80;

                    if (!saved)
                    {
                        var rl02 = gEngine.RollDice(2, 2, 1);

                        if (ScoredCriticalHit)
                        {
                            rl02 *= 2;
                        }

                        var firstParalyzed = !gGameState.ParalyzedTargets.ContainsKey(DfMonster.Uid);

                        if (firstParalyzed)
                        {
                            gGameState.ParalyzedTargets[DfMonster.Uid] = 0;
                        }

                        if (DfMonster.IsCharacterMonster())
                        {
                            gOut.Write("{0}{1}You are{2} paralyzed!", Environment.NewLine, OmitBboaPadding ? "" : "  ", !firstParalyzed ? " further" : "");
                        }
                        else if (room.IsLit())
                        {
                            gOut.Write("{0}{1}{2} is{3} paralyzed!", Environment.NewLine, OmitBboaPadding ? "" : "  ", DfMonster.GetTheName(true), !firstParalyzed ? " further" : "");
                        }
                        else if (firstParalyzed)
                        {
                            gOut.Write("{0}{1}The defender falls silent!", Environment.NewLine, OmitBboaPadding ? "" : "  ");
                        }

                        gGameState.ParalyzedTargets[DfMonster.Uid] += rl02;
                    }
                }
            }
            else if (OfMonster?.Uid == 14 || OfMonster?.Uid == 16)
            {
                if (DfMonster.Uid > 17 && rl > 60)
                {
                    if (DfMonster.IsCharacterMonster() || room.IsLit())
                    {
                        gOut.Write("{0}{1}{2}", Environment.NewLine, OmitBboaPadding ? "" : "  ", DfMonster.IsCharacterMonster() ? "You suddenly feel less skillful!" : DfMonster.GetTheName(true) + " suddenly looks less skillful!");
                    }

                    // Only apply skill loss to the player character

                    if (DfMonster.IsCharacterMonster())
                    {
                        var weaponValues = EnumUtil.GetValues <Weapon>();

                        foreach (var wv in weaponValues)
                        {
                            var weapon = gEngine.GetWeapons(wv);

                            Debug.Assert(weapon != null);

                            gCharacter.ModWeaponAbilities(wv, -gEngine.RollDice(1, OfMonster?.Uid == 14 ? 4 : 2, 0));

                            if (gCharacter.GetWeaponAbilities(wv) < weapon.MinValue)
                            {
                                gCharacter.SetWeaponAbilities(wv, weapon.MinValue);
                            }
                        }
                    }
                }
            }
            else if (OfMonster?.Uid == 36)
            {
                var beholderMonster = OfMonster as Framework.IMonster;

                Debug.Assert(beholderMonster != null);

                if (beholderMonster.AttackDesc.Equals("cast{0} a clumsiness spell on", StringComparison.OrdinalIgnoreCase))
                {
                    var saved = DfMonster.IsCharacterMonster() ? gEngine.SaveThrow(Stat.Intellect) : rl > 50;

                    if (!saved)
                    {
                        var rl02 = gEngine.RollDice(1, 5, 2);

                        if (ScoredCriticalHit)
                        {
                            rl02 *= 2;
                        }

                        IList <long> roundsList = null;

                        if (gGameState.ClumsyTargets.ContainsKey(DfMonster.Uid))
                        {
                            roundsList = gGameState.ClumsyTargets[DfMonster.Uid];
                        }
                        else
                        {
                            roundsList = new List <long>();

                            gGameState.ClumsyTargets[DfMonster.Uid] = roundsList;
                        }

                        roundsList.Add(rl02);

                        if (DfMonster.IsCharacterMonster())
                        {
                            gOut.Write("{0}{1}You suddenly feel {2}less agile!", Environment.NewLine, OmitBboaPadding ? "" : "  ", ScoredCriticalHit ? "far " : "");
                        }
                        else
                        {
                            gOut.Write("{0}{1}{2} suddenly {3} {4}less agile!", Environment.NewLine, OmitBboaPadding ? "" : "  ", room.EvalLightLevel("The defender", DfMonster.GetTheName(true)), room.EvalLightLevel("sounds", "looks"), ScoredCriticalHit ? "far " : "");
                        }
                    }
                    else
                    {
                        if (DfMonster.IsCharacterMonster() || room.IsLit())
                        {
                            gOut.Write("{0}{1}Spell resisted!", Environment.NewLine, OmitBboaPadding ? "" : "  ");
                        }
                    }

                    CombatState = RTEnums.CombatState.EndAttack;

                    goto Cleanup;
                }
            }
            else if (OfMonster?.Uid == 38)
            {
                var waterWeirdMonster = OfMonster as Framework.IMonster;

                Debug.Assert(waterWeirdMonster != null);

                if (waterWeirdMonster.AttackDesc.Equals("envelop{0}", StringComparison.OrdinalIgnoreCase))
                {
                    var saved = DfMonster.IsCharacterMonster() ? gEngine.SaveThrow(Stat.Hardiness) : rl > 40;

                    if (!saved)
                    {
                        if (DfMonster.IsCharacterMonster())
                        {
                            gOut.Write("{0}{1}You are held down by {2}, and drown immediately!", Environment.NewLine, OmitBboaPadding ? "" : "  ", room.EvalLightLevel("the offender", OfMonster?.GetTheName()));
                        }
                        else
                        {
                            gOut.Write("{0}{1}{2} is held down by {3}, and drowns immediately!", Environment.NewLine, OmitBboaPadding ? "" : "  ", room.EvalLightLevel("The defender", DfMonster.GetTheName(true)), room.EvalLightLevel("the offender", OfMonster?.GetTheName()));
                        }

                        DfMonster.DmgTaken = DfMonster.Hardiness;
                    }
                    else
                    {
                        if (DfMonster.IsCharacterMonster())
                        {
                            gOut.Write("{0}{1}You break free of {2}'s grip!", Environment.NewLine, OmitBboaPadding ? "" : "  ", room.EvalLightLevel("the offender", OfMonster?.GetTheName()));
                        }
                        else
                        {
                            gOut.Write("{0}{1}{2} breaks free of {3}'s grip!", Environment.NewLine, OmitBboaPadding ? "" : "  ", room.EvalLightLevel("The defender", DfMonster.GetTheName(true)), room.EvalLightLevel("the offender", OfMonster?.GetTheName()));
                        }

                        CombatState = RTEnums.CombatState.EndAttack;

                        goto Cleanup;
                    }
                }
            }

            if (_d2 > 0 && gGameState.ShowCombatDamage && room.IsLit())
            {
                gOut.Write("{0}{1}Blow does {2} point{3} of damage.{4}", Environment.NewLine, OmitBboaPadding ? "" : "  ", _d2, _d2 != 1 ? "s" : "", BlastSpell || CrossbowTrap ? Environment.NewLine : "");
            }

            base.CheckMonsterStatus();

            // Bloodnettle selects its next victim

            if (OfMonster?.Uid == 20 && !DfMonster.IsInLimbo() && gGameState.BloodnettleVictimUid == 0)
            {
                gGameState.BloodnettleVictimUid = DfMonster.Uid;
            }

Cleanup:

            ;
        }