Example #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() :
                       "");
        }
Example #2
0
        /// <summary></summary>
        public virtual void SetAttackDesc()
        {
            AttackDesc = "attack{0}";

            if (!UseAttacks)
            {
                if (OfMonster.IsCharacterMonster() || (OfMonster.IsInRoomLit() && OfMonster.CombatCode != CombatCode.Attacks))
                {
                    AttackDesc = OfMonster.GetAttackDescString(OfWeapon);
                }
            }
        }
Example #3
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");
 }
Example #4
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 #5
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();
            }
        }
Example #6
0
        protected override void SetAttackDesc()
        {
            AttackDesc = "attack{0}";

            if (!UseAttacks)
            {
                if (OfMonster.IsCharacterMonster())
                {
                    AttackDesc = OfMonster.GetAttackDescString(OfWeapon);
                }
                else if (OfMonster.IsInRoomLit())
                {
                    if (OfMonster.Uid > 19 && OfMonster.Uid < 23)
                    {
                        AttackDesc = "zap{0}";
                    }
                    else if (OfMonster.CombatCode != CombatCode.Attacks && (!((Framework.IMonster)OfMonster).IsAndroid() || OfMonster.Weapon > 0))
                    {
                        AttackDesc = OfMonster.GetAttackDescString(OfWeapon);
                    }
                }
            }
        }
Example #7
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:

            ;
        }
Example #8
0
        /// <summary></summary>
        public virtual void BeginAttack()
        {
            Debug.Assert(OfMonster != null && OfMonster.CombatCode != CombatCode.NeverFights);

            Debug.Assert(DfMonster != null);

            Debug.Assert(MemberNumber > 0);

            OfWeaponUid = OfMonster.Weapon;

            if (OfWeaponUid > 0 && OfMonster.GroupCount == 1 && AttackNumber > 1 && OfMonster.CanAttackWithMultipleWeapons())
            {
                var weaponList = OfMonster.GetCarriedList().Where(x => x.IsReadyableByMonster(OfMonster)).ToList();

                var weaponCount = weaponList.Count;

                if ((AttackNumber - 1) % weaponCount != 0)
                {
                    OfWeapon = gEngine.GetNthArtifact(weaponList, (AttackNumber - 1) % weaponCount, x => x.Uid != OfWeaponUid);

                    OfWeaponUid = OfWeapon.Uid;
                }
                else
                {
                    OfWeapon = gADB[OfWeaponUid];
                }
            }
            else if (OfWeaponUid > 0 && OfMonster.CurrGroupCount > 1 && MemberNumber > 1)
            {
                OfWeapon = gEngine.GetNthArtifact(OfMonster.GetCarriedList(), MemberNumber - 1, x => x.IsReadyableByMonster(OfMonster) && x.Uid != OfWeaponUid);

                OfWeaponUid = OfWeapon != null ? OfWeapon.Uid : OfMonster.NwDice > 0 && OfMonster.NwSides > 0 ? 0 : -1;

                if (OfWeaponUid < 0)
                {
                    CombatState = CombatState.EndAttack;

                    goto Cleanup;
                }
            }
            else
            {
                OfWeapon = OfWeaponUid > 0 ? gADB[OfWeaponUid] : null;
            }

            Debug.Assert(OfWeaponUid == 0 || (OfWeapon != null && OfWeapon.GeneralWeapon != null));

            OfAc = OfWeapon != null ? OfWeapon.GeneralWeapon : null;

            Af = gEngine.GetArmorFactor(gGameState.Ar, gGameState.Sh);

            gEngine.GetOddsToHit(OfMonster, DfMonster, OfAc, Af, ref _odds);

            RollToHitOrMiss();

            if (OfMonster.IsCharacterMonster() && _rl < 97 && (_rl < 5 || _rl <= _odds) && !OmitSkillGains)
            {
                gEngine.CheckPlayerSkillGains(OfAc, Af);
            }

            OfWeaponType = (Weapon)(OfAc != null ? OfAc.Field2 : 0);

            PrintAttack();

            if (_rl < 97 && (_rl < 5 || _rl <= _odds))
            {
                CombatState = CombatState.AttackHit;
            }
            else
            {
                CombatState = CombatState.AttackMiss;
            }

Cleanup:

            ;
        }