Ejemplo n.º 1
0
    public void EncounterBuilder_Generate_ReturnsAnyEnemies()
    {
        var enemy            = TestableObjectFactory.Create <Enemy>();
        var encounterBuilder = TestableObjectFactory.Create <EncounterBuilder>();

        encounterBuilder.Init(enemy.AsArray(), 10);

        var encounter = encounterBuilder.Generate();

        Assert.IsTrue(encounter.Any());
    }
Ejemplo n.º 2
0
    public static ReactionCardType Reaction(ReactiveMember src, ReactiveTargetScope target, EffectData e)
    {
        var resourceType     = TestableObjectFactory.Create <TestResourceType>().Initialized("Ammo");
        var reactionCardType = TestableObjectFactory.Create <ReactionCardType>()
                               .Initialized(
            new ResourceCost(0, resourceType),
            new ResourceCost(0, resourceType),
            new CardReactionSequence(src, target,
                                     TestableObjectFactory.Create <CardActionsData>()
                                     .Initialized(new CardActionV2(e))));

        return(reactionCardType);
    }
        public void CapsAt100()
        {
            var original = AccessTools.Method(typeof(BattleTech.UI.CombatHUDWeaponSlot), "SetHitChance", new Type[] { typeof(float) });

            Assert.NotNull(original);

            var transpiler = AccessTools.Method(typeof(CombatHUDWeaponSlotHitChancePatch), "Transpiler");

            Assert.NotNull(transpiler);

            var harmony = HarmonyInstance.Create("aa.battletech.realhitchance.tests");

            harmony.Patch(original, null, null, new HarmonyMethod(transpiler));

            var sut = TestableObjectFactory.Create <BattleTech.UI.CombatHUDWeaponSlot>();

            sut.HitChanceText = TestableObjectFactory.Create <TMPro.TextMeshProUGUI>();
            sut.SetHitChance(1.01f);
            Assert.Equal("100%", sut.HitChanceText.text);
        }