• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Chummer.Spell类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Spell类属于Chummer命名空间,在下文中一共展示了Spell类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: frmCreateSpell

		public frmCreateSpell(Character objCharacter)
		{
			_objCharacter = objCharacter;
			_objSpell = new Spell(_objCharacter);
			InitializeComponent();
			LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);
			_objXmlDocument = XmlManager.Instance.Load("spells.xml");
			MoveControls();
		}
开发者ID:AMDX9,项目名称:chummer5a,代码行数:9,代码来源:frmCreateSpell.cs


示例2: cmdAddSpell_Click

        private void cmdAddSpell_Click(object sender, EventArgs e)
        {		
            frmSelectSpell frmPickSpell = new frmSelectSpell(_objCharacter);
			frmPickSpell.ExpandedCategories = lstExpandSpellCategories;
			frmPickSpell.ShowDialog(this);
            // Make sure the dialogue window was not canceled.
            if (frmPickSpell.DialogResult == DialogResult.Cancel)
                return;

            // Open the Spells XML file and locate the selected piece.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("spells.xml");

            XmlNode objXmlSpell = objXmlDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + frmPickSpell.SelectedSpell + "\"]");

			lstExpandSpellCategories = frmPickSpell.ExpandedCategories;
            Spell objSpell = new Spell(_objCharacter);
            TreeNode objNode = new TreeNode();
            objSpell.Create(objXmlSpell, _objCharacter, objNode, "", frmPickSpell.Limited, frmPickSpell.Extended, frmPickSpell.Alchemical);
            objNode.ContextMenuStrip = cmsSpell;
            if (objSpell.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.Spells.Add(objSpell);

            switch (objSpell.Category)
            {
                case "Combat":
                    treSpells.Nodes[0].Nodes.Add(objNode);
                    treSpells.Nodes[0].Expand();
                    break;
                case "Detection":
                    treSpells.Nodes[1].Nodes.Add(objNode);
                    treSpells.Nodes[1].Expand();
                    break;
                case "Health":
                    treSpells.Nodes[2].Nodes.Add(objNode);
                    treSpells.Nodes[2].Expand();
                    break;
                case "Illusion":
                    treSpells.Nodes[3].Nodes.Add(objNode);
                    treSpells.Nodes[3].Expand();
                    break;
                case "Manipulation":
                    treSpells.Nodes[4].Nodes.Add(objNode);
                    treSpells.Nodes[4].Expand();
                    break;
                case "Rituals":
                    int intNode = 5;
                    if (_objCharacter.AdeptEnabled && !_objCharacter.MagicianEnabled)
                        intNode = 0;
                    treSpells.Nodes[intNode].Nodes.Add(objNode);
                    treSpells.Nodes[intNode].Expand();
                    break;
            }

            treSpells.SelectedNode = objNode;

            treSpells.SortCustom();
            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();

            int intSpellCount = 0;
            foreach (TreeNode nodCategory in treSpells.Nodes)
            {
                foreach (TreeNode nodSpell in nodCategory.Nodes)
                {
                    intSpellCount++;
                }
            }
            //if (intSpellCount - _objCharacter.SpellLimit > 0)
            //    lblPBuildSpells.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (0).ToString(), _objCharacter.SpellLimit.ToString());
            //else
            lblPBuildSpells.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.SpellLimit - intSpellCount).ToString(), _objCharacter.SpellLimit.ToString());

			if (frmPickSpell.AddAgain)
			{
				cmdAddSpell_Click(sender, e);
			}
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:81,代码来源:frmCreate.cs


示例3: tsMetamagicAddRitual_Click

        private void tsMetamagicAddRitual_Click(object sender, EventArgs e)
        {
			if (treMetamagic.SelectedNode.Level != 0)
				return;

			int intGrade = 0;
			foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
			{
				if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
				{
					intGrade = objGrade.Grade;
					break;
				}
			}

			frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
			frmPickArt.WindowMode = frmSelectArt.Mode.Ritual;
			frmPickArt.ShowDialog(this);

			// Make sure a value was selected.
			if (frmPickArt.DialogResult == DialogResult.Cancel)
				return;

			string strEnchantment = frmPickArt.SelectedItem;

			XmlDocument objXmlDocument = new XmlDocument();
			XmlNode objXmlArt;

			TreeNode objNode = new TreeNode();
			Spell objNewSpell = new Spell(_objCharacter);
			Improvement.ImprovementSource objSource;

			objXmlDocument = XmlManager.Instance.Load("spells.xml");
			objXmlArt = objXmlDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + strEnchantment + "\"]");
			objSource = Improvement.ImprovementSource.Initiation;

			objNewSpell.Create(objXmlArt, _objCharacter, objNode, "", false, false, false, objSource);
			objNewSpell.Grade = intGrade;
			objNode.ContextMenuStrip = cmsInitiationNotes;
			if (objNewSpell.InternalId == Guid.Empty.ToString())
				return;

			_objCharacter.Spells.Add(objNewSpell);

			TreeNode objSpellNode = new TreeNode();
			objSpellNode.Text = objNode.Text;
			objSpellNode.Tag = objNode.Tag;

			string strCategory = "";
			if (objNewSpell.Category == "Rituals")
				strCategory = LanguageManager.Instance.GetString("Label_Ritual") + " ";
			if (objNewSpell.Category == "Enchantments")
				strCategory = LanguageManager.Instance.GetString("Label_Enchantment") + " ";
			objNode.Text = strCategory + objNode.Text;
			treMetamagic.SelectedNode.Nodes.Add(objNode);
			treMetamagic.SelectedNode.Expand();

			int intNode = 5;
			if (!_objCharacter.MagicianEnabled)
				intNode = 0;
			treSpells.Nodes[intNode].Nodes.Add(objSpellNode);
			treSpells.Nodes[intNode].Expand();

			UpdateCharacterInfo();

			_blnIsDirty = true;
			UpdateWindowTitle();
		}
开发者ID:cormanater,项目名称:chummer5a,代码行数:68,代码来源:frmCreate.cs


示例4: AddPACKSKit


//.........这里部分代码省略.........
                }
            }

            // Update Complex Forms.
            if (objXmlKit["programs"] != null)
            {
                // Open the Programs XML file and locate the selected program.
                XmlDocument objXmlProgramDocument = XmlManager.Instance.Load("complexforms.xml");

                foreach (XmlNode objXmlProgram in objXmlKit.SelectNodes("complexforms/complexform"))
                {
                    XmlNode objXmlProgramNode = objXmlProgramDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + objXmlProgram["name"].InnerText + "\"]");

                    string strForceValue = "";
                    if (objXmlProgram.Attributes["select"] != null)
                        strForceValue = objXmlProgram.Attributes["select"].InnerText;

                    TreeNode objNode = new TreeNode();
                    ComplexForm objProgram = new ComplexForm(_objCharacter);
                    objProgram.Create(objXmlProgramNode, _objCharacter, objNode, strForceValue);

                    treComplexForms.Nodes[0].Nodes.Add(objNode);
                    treComplexForms.Nodes[0].Expand();

                    _objCharacter.ComplexForms.Add(objProgram);

                    treComplexForms.SortCustom();
                }
            }

            // Update Spells.
            if (objXmlKit["spells"] != null)
            {
                XmlDocument objXmlSpellDocument = XmlManager.Instance.Load("spells.xml");

                foreach (XmlNode objXmlSpell in objXmlKit.SelectNodes("spells/spell"))
                {
                    // Make sure the Spell has not already been added to the character.
                    bool blnFound = false;
                    foreach (TreeNode nodSpell in treSpells.Nodes[0].Nodes)
                    {
                        if (nodSpell.Text == objXmlSpell.InnerText)
                        {
                            blnFound = true;
                            break;
                        }
                    }

                    // The Spell is not in the list, so add it.
                    if (!blnFound)
                    {
                        string strForceValue = "";
                        if (objXmlSpell.Attributes["select"] != null)
                            strForceValue = objXmlSpell.Attributes["select"].InnerText;

                        XmlNode objXmlSpellNode = objXmlSpellDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + objXmlSpell.InnerText + "\"]");

                        Spell objSpell = new Spell(_objCharacter);
                        TreeNode objNode = new TreeNode();
                        objSpell.Create(objXmlSpellNode, _objCharacter, objNode, strForceValue);
                        objNode.ContextMenuStrip = cmsSpell;
                        _objCharacter.Spells.Add(objSpell);

                        switch (objSpell.Category)
                        {
                            case "Combat":
开发者ID:cormanater,项目名称:chummer5a,代码行数:67,代码来源:frmCreate.cs


示例5: Load


//.........这里部分代码省略.........
            }

            try
            {
                _blnOverrideSpecialAttributeESSLoss = Convert.ToBoolean(objXmlCharacter["overridespecialattributeessloss"].InnerText);
            }
            catch
            {
            }

            try
            {
                _intContactPoints = Convert.ToInt32(objXmlCharacter["contactpoints"].InnerText);
            }
            catch
            {
            }
            try
            {
                _intContactPointsUsed = Convert.ToInt32(objXmlCharacter["contactpointsused"].InnerText);
            }
            catch
            {
            }
            try
            {
                _intCFPLimit = Convert.ToInt32(objXmlCharacter["cfplimit"].InnerText);
            }
            catch
            {
            }
            try
            {
                _intSpellLimit = Convert.ToInt32(objXmlCharacter["spelllimit"].InnerText);
            }
            catch
            {
            }
            try
            {
                _intKarma = Convert.ToInt32(objXmlCharacter["karma"].InnerText);
            }
            catch
            {
            }
            try
            {
                _intTotalKarma = Convert.ToInt32(objXmlCharacter["totalkarma"].InnerText);
            }
            catch
            {
            }

            try
            {
                _intSpecial = Convert.ToInt32(objXmlCharacter["special"].InnerText);
            }
            catch
            {
            }
            try
            {
                _intTotalSpecial = Convert.ToInt32(objXmlCharacter["totalspecial"].InnerText);
            }
            catch
            {
开发者ID:ercflemng,项目名称:chummer5a,代码行数:67,代码来源:clsCharacter.cs


示例6: tsMetamagicAddEnchantment_Click

        private void tsMetamagicAddEnchantment_Click(object sender, EventArgs e)
        {
            // Character can only have a number of Metamagics/Echoes equal to their Initiate Grade. Additional ones cost Karma.
            bool blnPayWithKarma = false;
            string strType = "";

            if (treMetamagic.SelectedNode.Level != 0)
                return;

            int intGrade = 0;
            foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
            {
                if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
                {
                    intGrade = objGrade.Grade;
                    break;
                }
            }

            // Evaluate each object
            foreach (Metamagic objMetamagic in _objCharacter.Metamagics)
            {
                if (objMetamagic.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            foreach (Spell objSpell in _objCharacter.Spells)
            {
                if (objSpell.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
            frmPickArt.WindowMode = frmSelectArt.Mode.Enchantment;
            frmPickArt.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickArt.DialogResult == DialogResult.Cancel)
                return;

            string strEnchantment = frmPickArt.SelectedItem;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlArt;

            TreeNode objNode = new TreeNode();
            Spell objNewSpell = new Spell(_objCharacter);
            Improvement.ImprovementSource objSource;

            objXmlDocument = XmlManager.Instance.Load("spells.xml");
            objXmlArt = objXmlDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + strEnchantment + "\"]");
            objSource = Improvement.ImprovementSource.Initiation;

            objNewSpell.Create(objXmlArt, _objCharacter, objNode, "", false, false, false, objSource);
            objNewSpell.Grade = intGrade;
            objNode.ContextMenuStrip = cmsInitiationNotes;
            if (objNewSpell.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.Spells.Add(objNewSpell);

            TreeNode objSpellNode = new TreeNode();
            objSpellNode.Text = objNode.Text;
            objSpellNode.Tag = objNode.Tag;

            string strCategory = "";
            if (objNewSpell.Category == "Rituals")
                strCategory = LanguageManager.Instance.GetString("Label_Ritual") + " ";
            if (objNewSpell.Category == "Enchantments")
                strCategory = LanguageManager.Instance.GetString("Label_Enchantment") + " ";
            objNode.Text = strCategory + objNode.Text;
            treMetamagic.SelectedNode.Nodes.Add(objNode);
            treMetamagic.SelectedNode.Expand();

            treSpells.Nodes[6].Nodes.Add(objSpellNode);
            treSpells.Nodes[6].Expand();

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:knightaries,项目名称:chummer5a,代码行数:82,代码来源:frmCreate.cs


示例7: cmdAddSpell_Click

        private void cmdAddSpell_Click(object sender, EventArgs e)
        {
            // Count the number of Spells the character currently has and make sure they do not try to select more Spells than they are allowed.
            // The maximum number of Spells a character can start with is 2 x (highest of Spellcasting or Ritual Spellcasting Skill).
            int intSpellCount = 0;
            foreach (TreeNode nodCategory in treSpells.Nodes)
            {
                foreach (TreeNode nodSpell in nodCategory.Nodes)
                {
                    intSpellCount++;
                }
            }

            // Run through the list of Active Skills and pick out the two applicable ones.
            int intSkillValue = 0;
            foreach (SkillControl objSkillControl in panActiveSkills.Controls)
            {
                if ((objSkillControl.SkillName == "Spellcasting" || objSkillControl.SkillName == "Ritual Spellcasting") && objSkillControl.SkillRating > intSkillValue)
                    intSkillValue = objSkillControl.SkillRating + objSkillControl.SkillObject.RatingModifiers;
            }

            if (intSpellCount >= ((2 * intSkillValue) + _objImprovementManager.ValueOf(Improvement.ImprovementType.SpellLimit)) && !_objCharacter.IgnoreRules)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SpellLimit"), LanguageManager.Instance.GetString("MessageTitle_SpellLimit"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectSpell frmPickSpell = new frmSelectSpell(_objCharacter);
            frmPickSpell.ShowDialog(this);
            // Make sure the dialogue window was not canceled.
            if (frmPickSpell.DialogResult == DialogResult.Cancel)
                return;

            // Open the Spells XML file and locate the selected piece.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("spells.xml");

            XmlNode objXmlSpell = objXmlDocument.SelectSingleNode("/chummer/spells/spell[id = \"" + frmPickSpell.SelectedSpell + "\"]");

            Spell objSpell = new Spell(_objCharacter);
            TreeNode objNode = new TreeNode();
            objSpell.Create(objXmlSpell, _objCharacter, objNode, "", frmPickSpell.Limited, frmPickSpell.Extended);
            objNode.ContextMenuStrip = cmsSpell;
            if (objSpell.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.Spells.Add(objSpell);

            switch (objSpell.Category)
            {
                case "Combat":
                    treSpells.Nodes[0].Nodes.Add(objNode);
                    treSpells.Nodes[0].Expand();
                    break;
                case "Detection":
                    treSpells.Nodes[1].Nodes.Add(objNode);
                    treSpells.Nodes[1].Expand();
                    break;
                case "Health":
                    treSpells.Nodes[2].Nodes.Add(objNode);
                    treSpells.Nodes[2].Expand();
                    break;
                case "Illusion":
                    treSpells.Nodes[3].Nodes.Add(objNode);
                    treSpells.Nodes[3].Expand();
                    break;
                case "Manipulation":
                    treSpells.Nodes[4].Nodes.Add(objNode);
                    treSpells.Nodes[4].Expand();
                    break;
            }

            treSpells.SelectedNode = objNode;

            _objFunctions.SortTree(treSpells);
            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickSpell.AddAgain)
                cmdAddSpell_Click(sender, e);
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:82,代码来源:frmCreate.cs


示例8: cmdAddSpell_Click

        private void cmdAddSpell_Click(object sender, EventArgs e)
        {
            // Make sure the character has enough Karma before letting them select a Spell.
            if (_objCharacter.Karma < _objOptions.KarmaSpell)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Run through the list of Active Skills and pick out the two applicable ones.
            int intSkillValue = 0;
            foreach (SkillControl objSkillControl in panActiveSkills.Controls)
            {
                if ((objSkillControl.SkillName == "Spellcasting" || objSkillControl.SkillName == "Ritual Spellcasting") && objSkillControl.SkillRating > intSkillValue)
                    intSkillValue = objSkillControl.SkillRating;
            }

            frmSelectSpell frmPickSpell = new frmSelectSpell(_objCharacter);
            frmPickSpell.ShowDialog(this);
            // Make sure the dialogue window was not canceled.
            if (frmPickSpell.DialogResult == DialogResult.Cancel)
                return;

            // Open the Spells XML file and locate the selected piece.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("spells.xml");

            XmlNode objXmlSpell = objXmlDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + frmPickSpell.SelectedSpell + "\"]");

            Spell objSpell = new Spell(_objCharacter);
            TreeNode objNode = new TreeNode();
            objSpell.Create(objXmlSpell, _objCharacter, objNode, "", frmPickSpell.Limited, frmPickSpell.Extended, frmPickSpell.Alchemical);
            objNode.ContextMenuStrip = cmsSpell;
            if (objSpell.InternalId == Guid.Empty.ToString())
                return;

            if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", objSpell.DisplayName).Replace("{1}", _objOptions.KarmaSpell.ToString())))
                return;

            _objCharacter.Spells.Add(objSpell);

            switch (objSpell.Category)
            {
                case "Combat":
                    treSpells.Nodes[0].Nodes.Add(objNode);
                    treSpells.Nodes[0].Expand();
                    break;
                case "Detection":
                    treSpells.Nodes[1].Nodes.Add(objNode);
                    treSpells.Nodes[1].Expand();
                    break;
                case "Health":
                    treSpells.Nodes[2].Nodes.Add(objNode);
                    treSpells.Nodes[2].Expand();
                    break;
                case "Illusion":
                    treSpells.Nodes[3].Nodes.Add(objNode);
                    treSpells.Nodes[3].Expand();
                    break;
                case "Manipulation":
                    treSpells.Nodes[4].Nodes.Add(objNode);
                    treSpells.Nodes[4].Expand();
                    break;
                case "Rituals":
                    int intNode = 5;
                    if (_objCharacter.AdeptEnabled && !_objCharacter.MagicianEnabled)
                        intNode = 0;
                    treSpells.Nodes[intNode].Nodes.Add(objNode);
                    treSpells.Nodes[intNode].Expand();
                    break;
                case "Enchantments":
                    treSpells.Nodes[6].Nodes.Add(objNode);
                    treSpells.Nodes[6].Expand();
                    break;
            }

            treSpells.SelectedNode = objNode;

            // Create the Expense Log Entry.
            ExpenseLogEntry objEntry = new ExpenseLogEntry();
            objEntry.Create(_objOptions.KarmaSpell * -1, LanguageManager.Instance.GetString("String_ExpenseLearnSpell") + " " + objSpell.Name, ExpenseType.Karma, DateTime.Now);
            _objCharacter.ExpenseEntries.Add(objEntry);
            _objCharacter.Karma -= _objOptions.KarmaSpell;

            ExpenseUndo objUndo = new ExpenseUndo();
            objUndo.CreateKarma(KarmaExpenseType.AddSpell, objSpell.InternalId);
            objEntry.Undo = objUndo;

            _objFunctions.SortTree(treSpells);
            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickSpell.AddAgain)
                cmdAddSpell_Click(sender, e);
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:96,代码来源:frmCareer.cs


示例9: tsMetamagicAddRitual_Click

        private void tsMetamagicAddRitual_Click(object sender, EventArgs e)
        {
            // Character can only have a number of Metamagics/Echoes equal to their Initiate Grade. Additional ones cost Karma.
            bool blnPayWithKarma = false;
            string strType = "";

            if (treMetamagic.SelectedNode.Level != 0)
                return;

            int intGrade = 0;
            foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
            {
                if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
                {
                    intGrade = objGrade.Grade;
                    break;
                }
            }

            // Evaluate each object
            foreach (Metamagic objMetamagic in _objCharacter.Metamagics)
            {
                if (objMetamagic.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            foreach (Spell objSpell in _objCharacter.Spells)
            {
                if (objSpell.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            if (blnPayWithKarma && _objCharacter.Karma < _objOptions.KarmaSpell)
            {
                // Make sure the Karma expense would not put them over the limit.
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (blnPayWithKarma)
                if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", LanguageManager.Instance.GetString("String_Ritual")).Replace("{1}", _objOptions.KarmaSpell.ToString())))
                    return;

            frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
            frmPickArt.WindowMode = frmSelectArt.Mode.Ritual;
            frmPickArt.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickArt.DialogResult == DialogResult.Cancel)
                return;

            string strEnchantment = frmPickArt.SelectedItem;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlArt;

            TreeNode objNode = new TreeNode();
            Spell objNewSpell = new Spell(_objCharacter);
            Improvement.ImprovementSource objSource;

            objXmlDocument = XmlManager.Instance.Load("spells.xml");
            objXmlArt = objXmlDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + strEnchantment + "\"]");
            objSource = Improvement.ImprovementSource.Initiation;

            objNewSpell.Create(objXmlArt, _objCharacter, objNode, "", false, false, false, objSource);
            objNewSpell.Grade = intGrade;
            objNode.ContextMenuStrip = cmsInitiationNotes;
            if (objNewSpell.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.Spells.Add(objNewSpell);

            if (blnPayWithKarma)
            {
                // Create the Expense Log Entry.
                ExpenseLogEntry objEntry = new ExpenseLogEntry();
                objEntry.Create(_objOptions.KarmaSpell * -1, strType + " " + frmPickArt.SelectedItem, ExpenseType.Karma, DateTime.Now);
                _objCharacter.ExpenseEntries.Add(objEntry);

                ExpenseUndo objUndo = new ExpenseUndo();
                objUndo.CreateKarma(KarmaExpenseType.AddSpell, objNewSpell.InternalId);
                objEntry.Undo = objUndo;

                // Adjust the character's Karma total.
                _objCharacter.Karma -= _objOptions.KarmaSpell;
            }

            TreeNode objSpellNode = new TreeNode();
            objSpellNode.Text = objNode.Text;
            objSpellNode.Tag = objNode.Tag;

            string strCategory = "";
            if (objNewSpell.Category == "Rituals")
                strCategory = LanguageManager.Instance.GetString("Label_Ritual") + " ";
            if (objNewSpell.Category == "Enchantments")
                strCategory = LanguageManager.Instance.GetString("Label_Enchantment") + " ";
            objNode.Text = strCategory + objNode.Text;
            treMetamagic.SelectedNode.Nodes.Add(objNode);
            treMetamagic.SelectedNode.Expand();

//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例10: CreateAllSpellsTest

        public void CreateAllSpellsTest()
        {
            // 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("spells.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/spells/spell"))
            {
                Spell objSpell = new Spell(objCharacter);
                objSpell.Create(objXmlNode, objCharacter, objNode, "", false, false, false);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:15,代码来源:UniqueTests.cs


示例11: Load


//.........这里部分代码省略.........
                objContact.Load(objXmlContact);
                _lstContacts.Add(objContact);
            }

            // Armor.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/armors/armor");
            foreach (XmlNode objXmlArmor in objXmlNodeList)
            {
                Armor objArmor = new Armor(this);
                objArmor.Load(objXmlArmor);
                _lstArmor.Add(objArmor);
            }

            // Weapons.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/weapons/weapon");
            foreach (XmlNode objXmlWeapon in objXmlNodeList)
            {
                Weapon objWeapon = new Weapon(this);
                objWeapon.Load(objXmlWeapon);
                _lstWeapons.Add(objWeapon);
            }

            // Cyberware/Bioware.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/cyberwares/cyberware");
            foreach (XmlNode objXmlCyberware in objXmlNodeList)
            {
                Cyberware objCyberware = new Cyberware(this);
                objCyberware.Load(objXmlCyberware);
                _lstCyberware.Add(objCyberware);
            }

            // Spells.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/spells/spell");
            foreach (XmlNode objXmlSpell in objXmlNodeList)
            {
                Spell objSpell = new Spell(this);
                objSpell.Load(objXmlSpell);
                _lstSpells.Add(objSpell);
            }

            // Foci.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/foci/focus");
            foreach (XmlNode objXmlFocus in objXmlNodeList)
            {
                Focus objFocus = new Focus();
                objFocus.Load(objXmlFocus);
                _lstFoci.Add(objFocus);
            }

            // Stacked Foci.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/stackedfoci/stackedfocus");
            foreach (XmlNode objXmlStack in objXmlNodeList)
            {
                StackedFocus objStack = new StackedFocus(this);
                objStack.Load(objXmlStack);
                _lstStackedFoci.Add(objStack);
            }

            // Powers.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/powers/power");
            foreach (XmlNode objXmlPower in objXmlNodeList)
            {
                Power objPower = new Power(this);
                objPower.Load(objXmlPower);
                _lstPowers.Add(objPower);
            }
开发者ID:Nebual,项目名称:chummer,代码行数:67,代码来源:clsCharacter.cs


示例12: GetSmallSpellControl

 /// <summary>
 /// Creates a new SmallSpellControl and returns it. 
 /// </summary>
 /// <param name="spell"></param>
 /// <returns></returns>
 private SmallSpellControl GetSmallSpellControl(Spell spell)
 {
     SmallSpellControl ucSpell = new SmallSpellControl(this);
     ucSpell.Spell = spell;
     ucSpell.DiceClick += DiceClick_Clicked;
     ucSpell.DrainResist = GetSpellDrainResist();
     return ucSpell;
 }
开发者ID:GhostWhoWalksInside,项目名称:chummer5a_Dashboard,代码行数:13,代码来源:frmGMDashboard.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Chummer.Spirit类代码示例发布时间:2022-05-24
下一篇:
C# Chummer.SortListItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap