Beispiel #1
0
        public override IArtifact ConvertWeaponToArtifact(ICharacterArtifact weapon)
        {
            var artifact = base.ConvertWeaponToArtifact(weapon);

            var i = FindIndex(gCharacter.Weapons, x => x == weapon);

            if (i != gGameState.UsedWpnIdx)
            {
                artifact.SetInLimbo();

                gGameState.SetHeldWpnUids(HeldWpnIdx++, artifact.Uid);
            }

            return(artifact);
        }
Beispiel #2
0
        public virtual RetCode GetBaseOddsToHit(ICharacterArtifact weapon, ref long baseOddsToHit)
        {
            long    ar1, sh1, af, x, a, d, f, odds;
            RetCode rc;

            if (weapon == null)
            {
                rc = RetCode.InvalidArg;

                // PrintError

                goto Cleanup;
            }

            rc = RetCode.Success;

            if (!weapon.IsActive())
            {
                baseOddsToHit = 0;

                goto Cleanup;
            }

            /*
             *      Full Credit:  Derived wholly from Frank Black's Eamon Deluxe
             *
             *      File: MAINHALL.BAS
             *      SUB	: Examine.Character
             */

            /* COMPUTE ARMOR FACTOR */

            ar1 = (long)ArmorClass / 2;

            sh1 = (long)ArmorClass % 2;

            f = ar1;

            if (f > 3)
            {
                f = 3;
            }

            af = (-5 * sh1) - f * 10;

            if (f == 3)
            {
                af -= 30;
            }

            /* COMPUTE BASE ODDS TO HIT */

            x = GetStats(Stat.Agility);

            a = GetWeaponAbilities((Weapon)weapon.Field2);

            d = weapon.Field1;

            if (x > 30)
            {
                x = 30;
            }

            if (a > 122)
            {
                a = 122;
            }

            if (d > 50)
            {
                d = 50;
            }

            odds = 50 + 2 * (x - (ar1 + sh1));

            odds = (long)Math.Round((double)odds + ((double)d / 2.0));

            odds += ((af + ArmorExpertise) * (-af > ArmorExpertise ? 1 : 0));

            odds = (long)Math.Round((double)odds + ((double)a / 4.0));

            /*
             * if (odds > 100)
             * {
             *      odds = 100;
             * }
             */

            baseOddsToHit = odds;

Cleanup:

            return(rc);
        }
Beispiel #3
0
 public virtual void SetWeapons(long index, ICharacterArtifact value)
 {
     Weapons[index] = value;
 }