Beispiel #1
0
        public void TestGearFactory()
        {
            Ability[] a;
            var       gfLocal  = new GearFactory("ActI", true);
            var       gfRemote = new GearFactory("ActI", false);

            a = new Ability[] {
                new Ability(1, AbilityType.Range, 0, 0),
                new Ability(1, AbilityType.Damage, 1, 0),
                new Ability(1, AbilityType.Pierce, 1, 0),
            };
            var mainHand = new WeoponItem(
                "Iron Spear", new AttackDice("blue", "yellow"),
                HandCatagory.MeleeWeopon, a,
                new ItemCatagory[] { ItemCatagory.Exotic }, 1);

            Assert.Equal(mainHand, gfLocal.MainHand[0]);
            Assert.Equal(mainHand, gfRemote.MainHand[0]);

            var offHand = new ShieldItem("Iron Shield", new Ability[0]);

            Assert.Equal(offHand, gfLocal.OffHand[0]);
            Assert.Equal(offHand, gfRemote.OffHand[0]);

            var armor = new ArmorItem("Chainmail", new DefenceDice("grey"),
                                      ItemCatagory.HeavyArmor, new Ability[0]);

            a = new Ability[] { new Ability(1, AbilityType.Range, 0, 0) };
            var helmet  = new ItemCatagory[] { ItemCatagory.Helmet };
            var trinket = new TrinketItem("Scorpion Helmet", helmet, a);

            Assert.Equal(trinket, gfLocal.Trinket[0]);
            Assert.Equal(trinket, gfRemote.Trinket[0]);
        }
Beispiel #2
0
        public void TestTrinket()
        {
            Ability[] a        = new Ability[] { new Ability(1, AbilityType.Range, 0, 0) };
            var       helmet   = new ItemCatagory[] { ItemCatagory.Helmet };
            var       trinket1 = new TrinketItem("Scorpion Helmet", helmet, a);
            var       trinket2 = new TrinketItem("Scorpion Helmet", helmet, a);

            Assert.Equal(trinket1, trinket2);
        }
Beispiel #3
0
        private TrinketItem trinketItem;  // Reference to TrinketItem we're displaying

        public override void OnInspectorGUI()
        {
            trinketItem = target as TrinketItem;  // Telling unity to target this object as TrinketItem

            if (trinketItem)
            {
                DrawGeneralItem();                           // Drawing all trinket fields
            }
            var buttonStyle = new GUIStyle(GUI.skin.button); // Style for our save changes button

            buttonStyle.normal.textColor = Color.red;
            buttonStyle.fontStyle        = FontStyle.Bold;

            if (GUILayout.Button("Save changes", buttonStyle))
            {
                EditorUtility.SetDirty(trinketItem);                             // Marking this trinket item as dirty to ensure all changes are registered
                EditorSceneManager.MarkSceneDirty(trinketItem.gameObject.scene); // Marking the scene as modified so it takes our changes
            }
        }
Beispiel #4
0
        public void ResolveSurges(AttackDieFace attackRoll,
                                  DefenceDieFace defenceRoll, int range,
                                  int expectedDamage)
        {
            Hero leoric = GetLeoric();

            var dice   = new DiceOutcome(attackRoll, defenceRoll);
            int damage = leoric.ResolveSurges(dice, range);

            Assert.Equal(expectedDamage, damage);

            if (expectedDamage != 0)
            {
                dice = new DiceOutcome(attackRoll, defenceRoll);
                TrinketItem damageTrinket = new TrinketItem("Free Damage",
                                                            new ItemCatagory[] { ItemCatagory.Helmet },
                                                            new Ability[] { new Ability(1, AbilityType.Damage, 0) });
                leoric.Equip(damageTrinket);

                damage = leoric.ResolveSurges(dice, range);
                Assert.Equal(expectedDamage + 1, damage);
            }
        }