当前位置: 首页>>代码示例>>C#>>正文


C# Character.LoadMetatype方法代码示例

本文整理汇总了C#中Chummer.Character.LoadMetatype方法的典型用法代码示例。如果您正苦于以下问题:C# Character.LoadMetatype方法的具体用法?C# Character.LoadMetatype怎么用?C# Character.LoadMetatype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chummer.Character的用法示例。


在下文中一共展示了Character.LoadMetatype方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ArmorTest

        public void ArmorTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            // Add ArmorValue 6 Armor to the character. Their total Armor should be 6 with a Encumbrance penalty of 0 since there is nothing with a +value.
            Armor objArmor = new Armor(objCharacter);
            objArmor.ArmorValue = "6";
            objCharacter.Armor.Add(objArmor);

            Assert.AreEqual(6, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(6, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(0, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 0.");

            // Add an Armor Mod to the Armor. This should bring the Armor value up to 8.
            ArmorMod objMod = new ArmorMod(objCharacter);
            objMod.ArmorValue = 2;
            objCharacter.Armor[0].ArmorMods.Add(objMod);

            Assert.AreEqual(8, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 8.");
            Assert.AreEqual(8, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 8.");
            Assert.AreEqual(0, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 0.");

            // Add an additional +6 value Armor to the character. Their total Aromr should be 14 with an Encumbrance penalty of 2.
            Armor objPlusArmor = new Armor(objCharacter);
            objPlusArmor.ArmorValue = "+6";
            objCharacter.Armor.Add(objPlusArmor);

            Assert.AreEqual(14, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(14, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(2, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 2.");

            // Increase the character's STR to 4. This should reduce the Armor Encumbrance penalty to 1.
            objCharacter.STR.Value = 4;

            Assert.AreEqual(14, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(14, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 14.");
            Assert.AreEqual(1, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 1.");

            // Unequipping the Armor Mod should reduce the Armor value down to 12.
            objCharacter.Armor[0].ArmorMods[0].Equipped = false;

            Assert.AreEqual(12, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 12.");
            Assert.AreEqual(12, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 12.");
            Assert.AreEqual(1, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 1.");

            // Unequipping the +value Armor should put the character back to Armor 6 with no Encumbrance penalty.
            objCharacter.Armor[1].Equipped = false;

            Assert.AreEqual(6, objCharacter.ArmorValue, "ArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(6, objCharacter.TotalArmorValue, "TotalArmorValue does not equal the expected value of 6.");
            Assert.AreEqual(0, objCharacter.ArmorEncumbrance, "ArmorEncumbrance does not equal the expected value of 0.");
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:54,代码来源:CharacterTests.cs

示例2: CreateAllCritterPowersTest

        public void CreateAllCritterPowersTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            TreeNode objNode = new TreeNode();

            XmlDocument objXmlDocument = XmlManager.Instance.Load("critterpowers.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/powers/power"))
            {
                CritterPower objPower = new CritterPower(objCharacter);
                objPower.Create(objXmlNode, objCharacter, objNode, 0, "", false);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:15,代码来源:UniqueTests.cs

示例3: CreateAllArmorTest

        public void CreateAllArmorTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            TreeNode objNode = new TreeNode();
            ContextMenuStrip cmsArmor = new ContextMenuStrip();

            XmlDocument objXmlDocument = XmlManager.Instance.Load("armor.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/armors/armor"))
            {
                Armor objArmor = new Armor(objCharacter);
                objArmor.Create(objXmlNode, objNode, cmsArmor);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:16,代码来源:EquipmentTests.cs

示例4: CreateAllArmorModsTest

        public void CreateAllArmorModsTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            TreeNode objNode = new TreeNode();
            List<Weapon> lstWeapons = new List<Weapon>();
            List<TreeNode> lstTreeNodes = new List<TreeNode>();

            XmlDocument objXmlDocument = XmlManager.Instance.Load("armor.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/mods/mod"))
            {
                ArmorMod objMod = new ArmorMod(objCharacter);
                objMod.Create(objXmlNode, objNode, 1, lstWeapons, lstTreeNodes);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:17,代码来源:EquipmentTests.cs

示例5: CreateAllMetamagicsTest

        public void CreateAllMetamagicsTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            TreeNode objNode = new TreeNode();
            ContextMenuStrip cmsGear = new ContextMenuStrip();
            List<Weapon> lstWeapons = new List<Weapon>();
            List<TreeNode> lstTreeNodes = new List<TreeNode>();

            XmlDocument objXmlDocument = XmlManager.Instance.Load("metamagics.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/metamagics/metamagic"))
            {
                Metamagic objMetamagic = new Metamagic(objCharacter);
                objMetamagic.Create(objXmlNode, objCharacter, objNode, Improvement.ImprovementSource.Metamagic);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:18,代码来源:UniqueTests.cs

示例6: CMOverflowTest

        public void CMOverflowTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            // Set the character's BOD to 4 and verify the Overflow.
            objCharacter.BOD.Value = 4;
            Assert.AreEqual(5, objCharacter.CMOverflow, "CM Overflow does not equal the expected value of 5.");

            // Add an Overflow Improvement and verify it is correct.
            Improvement objImprovement = new Improvement();
            objImprovement.ImproveType = Improvement.ImprovementType.CMOverflow;
            objImprovement.Value = 1;
            objImprovement.ImproveSource = Improvement.ImprovementSource.Quality;
            objCharacter.Improvements.Add(objImprovement);

            Assert.AreEqual(6, objCharacter.CMOverflow, "CM Overflow does not equal the expected value of 6.");
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:19,代码来源:CharacterTests.cs

示例7: CreateAllBiowareTest

        public void CreateAllBiowareTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            TreeNode objNode = new TreeNode();
            List<Weapon> lstWeapons = new List<Weapon>();
            List<TreeNode> lstTreeNodes = new List<TreeNode>();

            GradeList objGradeList = new GradeList();
            objGradeList.LoadList(Improvement.ImprovementSource.Bioware);

            XmlDocument objXmlDocument = XmlManager.Instance.Load("bioware.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/biowares/bioware"))
            {
                Cyberware objCyberware = new Cyberware(objCharacter);
                objCyberware.Create(objXmlNode, objCharacter, objGradeList.GetGrade("Standard"), Improvement.ImprovementSource.Bioware, 1, objNode, lstWeapons, lstTreeNodes);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:20,代码来源:EquipmentTests.cs

示例8: CreateAllQualitiesTest

        public void CreateAllQualitiesTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));
            objCharacter.AdeptEnabled = true;
            objCharacter.MagicianEnabled = true;
            TreeNode objNode = new TreeNode();
            List<Weapon> lstWeapons = new List<Weapon>();
            List<TreeNode> lstTreeNodes = new List<TreeNode>();

            XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/qualities/quality"))
            {
                Quality objQuality = new Quality(objCharacter);
                objQuality.Create(objXmlNode, objCharacter, QualitySource.Selected, objNode, lstWeapons, lstTreeNodes);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:18,代码来源:UniqueTests.cs

示例9: EssenceCyberwareOnlyTest

        public void EssenceCyberwareOnlyTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            Cyberware objCyberware = new Cyberware(objCharacter);
            objCyberware.ESS = "0.3";
            objCharacter.Cyberware.Add(objCyberware);

            Assert.AreEqual(5.7m, objCharacter.Essence, "Essence does not equal the expected value of 5.7.");
            Assert.AreEqual(1, objCharacter.EssencePenalty, "Essence Penalty does not equal the expected value of 1.");
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:13,代码来源:CharacterTests.cs

示例10: EssenceCyberwareAndBiowareTest

        public void EssenceCyberwareAndBiowareTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            Cyberware objCybeware = new Cyberware(objCharacter);
            objCybeware.SourceType = Improvement.ImprovementSource.Cyberware;
            objCybeware.ESS = "0.6";

            Cyberware objBioware = new Cyberware(objCharacter);
            objBioware.SourceType = Improvement.ImprovementSource.Bioware;
            objBioware.ESS = "0.4";

            objCharacter.Cyberware.Add(objCybeware);
            objCharacter.Cyberware.Add(objBioware);

            // Bioware Essence should only be 0.2 since the lower of the Cyberware/Bioware totals is halved.
            Assert.AreEqual(5.2m, objCharacter.Essence, "Essence does not equal the expected value of 5.6.");
            Assert.AreEqual(0.6m, objCharacter.CyberwareEssence, "Cyberware Essence does not equal the expected value of 0.6.");
            Assert.AreEqual(0.2m, objCharacter.BiowareEssence, "Bioware Essence does not equal the expected value of 0.2.");
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:22,代码来源:CharacterTests.cs

示例11: CMThresholdTest

        public void CMThresholdTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            // Verify that the character's Treshold is correct.
            Assert.AreEqual(3, objCharacter.CMThreshold, "CM Threshold does not equal the expected value of 3.");

            // Add a Threshold Improvement and verify it is correct.
            Improvement objImprovement = new Improvement();
            objImprovement.ImproveType = Improvement.ImprovementType.CMThreshold;
            objImprovement.Value = 1;
            objImprovement.ImproveSource = Improvement.ImprovementSource.Quality;
            objCharacter.Improvements.Add(objImprovement);

            Assert.AreEqual(4, objCharacter.CMThreshold, "CM Threshold does not equal the expected value of 4.");
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:18,代码来源:CharacterTests.cs

示例12: CreateAllWeaponModsTest

        public void CreateAllWeaponModsTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            TreeNode objNode = new TreeNode();

            XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/mods/mod"))
            {
                WeaponMod objMod = new WeaponMod(objCharacter);
                objMod.Create(objXmlNode, objNode);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:15,代码来源:EquipmentTests.cs

示例13: StandardAttributeTest

        public void StandardAttributeTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            // Test the standard Attribute ranges.
            Assert.AreEqual(1, objCharacter.BOD.MetatypeMinimum, "BOD Minimum is not equal to the expected value of 1.");
            Assert.AreEqual(6, objCharacter.BOD.MetatypeMaximum, "BOD Maximum is not equal to the expected value of 6.");
            Assert.AreEqual(9, objCharacter.BOD.MetatypeAugmentedMaximum, "BOD Augmented Maximum is not equal to the expected value of 9.");

            // Try to go outside of the standard minimum and maximum values.
            objCharacter.BOD.Value = 10;
            Assert.AreEqual(6, objCharacter.BOD.TotalValue, "BOD value was able to extend beyond the Maximum value of 6.");
            objCharacter.BOD.Value = -10;
            Assert.AreEqual(1, objCharacter.BOD.TotalValue, "BOD value was able to extend beyond the Minimum value of 1.");

            // Make sure that adding an Improvement that would extend the Attribute's maximum range still only returns the absolute maximum.
            Improvement objImprovement = new Improvement();
            objImprovement.ImproveType = Improvement.ImprovementType.Attribute;
            objImprovement.Augmented = 20;
            objImprovement.ImprovedName = "BOD";
            objImprovement.CustomName = "BOD Value Improvement";
            objImprovement.ImproveSource = Improvement.ImprovementSource.Quality;
            objCharacter.Improvements.Add(objImprovement);
            Assert.AreEqual(9, objCharacter.BOD.TotalValue, "BOD value can extend beyond the Augmented Maximum value of 9.");

            // Increase the Attribute's augmented maximum and verify that the new maximum value from Improvements is correct.
            Improvement objSecondImprovement = new Improvement();
            objSecondImprovement.ImproveType = Improvement.ImprovementType.Attribute;
            objSecondImprovement.AugmentedMaximum = 1;
            objSecondImprovement.ImprovedName = "BOD";
            objSecondImprovement.CustomName = "BOD Augmented Maximum Improvement";
            objSecondImprovement.ImproveSource = Improvement.ImprovementSource.Quality;
            objCharacter.Improvements.Add(objSecondImprovement);
            Assert.AreEqual(10, objCharacter.BOD.TotalValue, "BOD value increased Augmented Maximum is not the expected value of 10.");
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:37,代码来源:UniqueTests.cs

示例14: CreateAllWeaponsTest

        public void CreateAllWeaponsTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            TreeNode objNode = new TreeNode();
            ContextMenuStrip cmsWeapon = new ContextMenuStrip();
            ContextMenuStrip cmsWeaponAccessory = new ContextMenuStrip();
            ContextMenuStrip cmsWeaponMod = new ContextMenuStrip();

            XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/weapons/weapon"))
            {
                Weapon objWeapon = new Weapon(objCharacter);
                objWeapon.Create(objXmlNode, objCharacter, objNode, cmsWeapon, cmsWeaponAccessory, cmsWeaponMod, true);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:18,代码来源:EquipmentTests.cs

示例15: SpecialAttributeTest

        public void SpecialAttributeTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            // Test the standard Attribute ranges.
            Assert.AreEqual(1, objCharacter.MAG.MetatypeMinimum, "MAG Minimum is not equal to the expected value of 1.");
            Assert.AreEqual(6, objCharacter.MAG.MetatypeMaximum, "MAG Maximum is not equal to the expected value of 6.");
            Assert.AreEqual(6, objCharacter.MAG.MetatypeAugmentedMaximum, "MAG Augmented Maximum is not equal to the expected value of 6.");

            // Try to go outside of the standard minimum and maximum values.
            objCharacter.MAG.Value = 10;
            Assert.AreEqual(6, objCharacter.MAG.TotalValue, "MAG value was able to extend beyond the Maximum value of 6.");
            objCharacter.MAG.Value = -10;
            Assert.AreEqual(1, objCharacter.MAG.TotalValue, "MAG value was able to extend beyond the Minimum value of 1.");

            // Set the character's MAG to 5, then apply an Essence penalty through Cyberware.
            objCharacter.MAG.Value = 5;

            // MAG should be 4 after adding an Essence Penalty.
            Cyberware objCyberware = new Cyberware(objCharacter);
            objCyberware.ESS = "0.3";
            objCharacter.Cyberware.Add(objCyberware);
            Assert.AreEqual(4, objCharacter.MAG.TotalValue, "MAG value after an Essence reduction is not equal to the expected value of 4.");
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:26,代码来源:UniqueTests.cs


注:本文中的Chummer.Character.LoadMetatype方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。