コード例 #1
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            float length;
            int   ab;
            int   chance;

            switch (perkLevel)
            {
            case 1:
                length = 12.0f;
                ab     = 1;
                chance = 10;
                break;

            case 2:
                length = 12.0f;
                ab     = 1;
                chance = 20;
                break;

            case 3:
                length = 12.0f;
                ab     = 2;
                chance = 20;
                break;

            case 4:
                length = 12.0f;
                ab     = 2;
                chance = 30;
                break;

            case 5:
                length = 12.0f;
                ab     = 3;
                chance = 30;
                break;

            default:
                return;
            }

            if (creature.IsPlayer)
            {
                var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(creature.Object);
                int luck           = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky) + effectiveStats.Luck;
                chance += luck;
            }

            if (RandomService.Random(100) + 1 <= chance)
            {
                _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectAttackIncrease(ab), creature.Object, length);
                creature.SendMessage(ColorTokenService.Combat("You perform a defensive maneuver."));
            }
        }
コード例 #2
0
        public void ColorTokenService_NullText_ShouldThrowArgumentException()
        {
            ColorTokenService service = new ColorTokenService();

            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Black(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Blue(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Gray(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Green(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.LightPurple(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Orange(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Pink(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Purple(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Red(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.White(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Yellow(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Cyan(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Combat(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Dialog(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.DialogAction(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.DialogCheck(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.DialogHighlight(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.DialogReply(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.DM(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.GameEngine(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.SavingThrow(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Script(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Server(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Shout(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.SkillCheck(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Talk(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Tell(null);
            });
            Assert.Throws(typeof(ArgumentException), () =>
            {
                service.Whisper(null);
            });
        }