Пример #1
0
        public void DefaultAttackScryptShouldAttack()
        {
            var test = new TestGameWithActors();

            test.ArmAlice();

            test.playerAlice.SetScrypt(ScryptUtil.defaultAttack);
            test.playerAlice.SetScryptLogger(new Action <string>(s => { Console.WriteLine($"scrypt log: {s}"); }));
            test.game.PlayRound_Scrypt();

            Assert.AreNotEqual(0, test.game.Mobs.Where(a => a.Health < a.baseHealth).Count());
        }
Пример #2
0
        public void AttackTargetShouldDealDamage()
        {
            var test = new TestGameWithActors();

            test.ArmAlice();
            test.mobCarly.Targeted = true;

            var jint = new Jint.Engine();

            jint.Execute(ScryptUtil.attackTargets.body);
            jint.Invoke(ScryptUtil.attackTargets.name, test.game, test.playerAlice);

            Assert.AreEqual(test.mobCarly.Health, test.mobCarly.baseHealth - test.playerAlice.Weapon.damage);
        }
Пример #3
0
        public void AttackTargetShouldClearTargetAfterAttack()
        {
            var test = new TestGameWithActors();

            test.ArmAlice();
            test.AggroAliceAndTargetCarly();

            var jint = new Jint.Engine();

            jint.Execute(ScryptUtil.attackTargets.body);
            jint.Invoke(ScryptUtil.attackTargets.name, test.game, test.playerAlice);

            Assert.IsFalse(test.mobCarly.Targeted);
        }
Пример #4
0
        public void DoRoundShouldFireAttackEvents()
        {
            bool startFired = false;
            bool endFired   = false;

            GameEvents.Instance.AttackStart += (a, b) =>
            {
                Assert.AreEqual(a, testData.playerAlice);
                Assert.AreEqual(b, testData.mobCarly);
                startFired = true;
            };
            GameEvents.Instance.AttackEnd += (a, b) =>
            {
                Assert.AreEqual(a, testData.playerAlice);
                Assert.AreEqual(b, testData.mobCarly);
                endFired = true;
            };
            testData.ArmAlice();
            testData.AggroAliceAndTargetCarly();
            testData.game.PlayRound();

            Assert.IsTrue(startFired);
            Assert.IsTrue(endFired);
        }