本文整理汇总了C#中Chummer.ComplexForm.Create方法的典型用法代码示例。如果您正苦于以下问题:C# ComplexForm.Create方法的具体用法?C# ComplexForm.Create怎么用?C# ComplexForm.Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chummer.ComplexForm
的用法示例。
在下文中一共展示了ComplexForm.Create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPACKSKit
/// <summary>
/// Add a PACKS Kit to the character.
/// </summary>
public void AddPACKSKit()
{
frmSelectPACKSKit frmPickPACKSKit = new frmSelectPACKSKit(_objCharacter);
frmPickPACKSKit.ShowDialog(this);
bool blnCreateChildren = true;
// If the form was canceled, don't do anything.
if (frmPickPACKSKit.DialogResult == DialogResult.Cancel)
return;
XmlDocument objXmlDocument = XmlManager.Instance.Load("packs.xml");
// Do not create child items for Gear if the chosen Kit is in the Custom category since these items will contain the exact plugins desired.
if (frmPickPACKSKit.SelectedCategory == "Custom")
blnCreateChildren = false;
XmlNode objXmlKit = objXmlDocument.SelectSingleNode("/chummer/packs/pack[name = \"" + frmPickPACKSKit.SelectedKit + "\" and category = \"" + frmPickPACKSKit.SelectedCategory + "\"]");
// Update Qualities.
if (objXmlKit["qualities"] != null)
{
XmlDocument objXmlQualityDocument = XmlManager.Instance.Load("qualities.xml");
// Positive Qualities.
foreach (XmlNode objXmlQuality in objXmlKit.SelectNodes("qualities/positive/quality"))
{
XmlNode objXmlQualityNode = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQuality.InnerText + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(_objCharacter);
string strForceValue = "";
if (objXmlQuality.Attributes["select"] != null)
strForceValue = objXmlQuality.Attributes["select"].InnerText;
objQuality.Create(objXmlQualityNode, _objCharacter, QualitySource.Selected, objNode, objWeapons, objWeaponNodes, strForceValue);
_objCharacter.Qualities.Add(objQuality);
treQualities.Nodes[0].Nodes.Add(objNode);
treQualities.Nodes[0].Expand();
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objWeapons)
_objCharacter.Weapons.Add(objWeapon);
// Create the Weapon Node if one exists.
foreach (TreeNode objWeaponNode in objWeaponNodes)
{
objWeaponNode.ContextMenuStrip = cmsWeapon;
treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
treWeapons.Nodes[0].Expand();
}
}
// Negative Qualities.
foreach (XmlNode objXmlQuality in objXmlKit.SelectNodes("qualities/negative/quality"))
{
XmlNode objXmlQualityNode = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQuality.InnerText + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(_objCharacter);
string strForceValue = "";
if (objXmlQuality.Attributes["select"] != null)
strForceValue = objXmlQuality.Attributes["select"].InnerText;
objQuality.Create(objXmlQualityNode, _objCharacter, QualitySource.Selected, objNode, objWeapons, objWeaponNodes, strForceValue);
_objCharacter.Qualities.Add(objQuality);
treQualities.Nodes[1].Nodes.Add(objNode);
treQualities.Nodes[1].Expand();
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objWeapons)
_objCharacter.Weapons.Add(objWeapon);
// Create the Weapon Node if one exists.
foreach (TreeNode objWeaponNode in objWeaponNodes)
{
objWeaponNode.ContextMenuStrip = cmsWeapon;
treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
treWeapons.Nodes[0].Expand();
}
}
}
// Update Attributes.
if (objXmlKit["attributes"] != null)
{
// Reset all Attributes back to 1 so we don't go over any BP limits.
nudBOD.Value = nudBOD.Minimum;
nudAGI.Value = nudAGI.Minimum;
nudREA.Value = nudREA.Minimum;
//.........这里部分代码省略.........
示例2: cmdAddComplexForm_Click
private void cmdAddComplexForm_Click(object sender, EventArgs e)
{
if (_objCharacter.BuildMethod == CharacterBuildMethod.Priority || _objCharacter.BuildMethod == CharacterBuildMethod.SumtoTen)
{
// The number of Complex Form Points cannot exceed the priority limit.
int intCFP = 0;
foreach (ComplexForm tp in _objCharacter.ComplexForms)
{
intCFP++;
}
}
else
{
// The number of Complex Forms cannot exceed twice the character's LOG.
if (_objCharacter.ComplexForms.Count >= ((_objCharacter.LOG.Value * 2) + _objImprovementManager.ValueOf(Improvement.ImprovementType.ComplexFormLimit)) && !_objCharacter.IgnoreRules)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_ComplexFormLimit"), LanguageManager.Instance.GetString("MessageTitle_ComplexFormLimit"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
// Let the user select a Program.
frmSelectProgram frmPickProgram = new frmSelectProgram(_objCharacter);
frmPickProgram.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickProgram.DialogResult == DialogResult.Cancel)
return;
XmlDocument objXmlDocument = XmlManager.Instance.Load("complexforms.xml");
XmlNode objXmlProgram = objXmlDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + frmPickProgram.SelectedProgram + "\"]");
// Check for SelectText.
string strExtra = "";
if (objXmlProgram["bonus"] != null)
{
if (objXmlProgram["bonus"]["selecttext"] != null)
{
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", frmPickProgram.SelectedProgram);
frmPickText.ShowDialog(this);
strExtra = frmPickText.SelectedValue;
}
}
TreeNode objNode = new TreeNode();
ComplexForm objProgram = new ComplexForm(_objCharacter);
objProgram.Create(objXmlProgram, _objCharacter, objNode, strExtra);
if (objProgram.InternalId == Guid.Empty.ToString())
return;
_objCharacter.ComplexForms.Add(objProgram);
treComplexForms.Nodes[0].Nodes.Add(objNode);
treComplexForms.Nodes[0].Expand();
treComplexForms.SortCustom();
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
int intComplexForms = 0;
foreach (ComplexForm tp in _objCharacter.ComplexForms)
{
intComplexForms++;
}
//if (_objCharacter.CFPLimit - intComplexForms < 0)
// lblPBuildComplexForms.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (0).ToString(), _objCharacter.CFPLimit.ToString());
//else
lblPBuildComplexForms.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.CFPLimit - intComplexForms).ToString(), _objCharacter.CFPLimit.ToString());
if (frmPickProgram.AddAgain)
cmdAddComplexForm_Click(sender, e);
}
示例3: cmdAddComplexForm_Click
private void cmdAddComplexForm_Click(object sender, EventArgs e)
{
// The number of Complex Forms cannot exceed the character's LOG.
if (_objCharacter.ComplexForms.Count >= ((_objCharacter.RES.Value * 2) + _objImprovementManager.ValueOf(Improvement.ImprovementType.ComplexFormLimit)))
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_ComplexFormLimitCareer"), LanguageManager.Instance.GetString("MessageTitle_ComplexFormLimit"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Let the user select a Program.
frmSelectProgram frmPickProgram = new frmSelectProgram(_objCharacter);
frmPickProgram.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickProgram.DialogResult == DialogResult.Cancel)
return;
int intKarmaCost = _objOptions.KarmaNewComplexForm;
XmlDocument objXmlDocument = XmlManager.Instance.Load("complexforms.xml");
XmlNode objXmlProgram = objXmlDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + frmPickProgram.SelectedProgram + "\"]");
// Check for SelectText.
string strExtra = "";
if (objXmlProgram["bonus"] != null)
{
if (objXmlProgram["bonus"]["selecttext"] != null)
{
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", frmPickProgram.SelectedProgram);
frmPickText.ShowDialog(this);
strExtra = frmPickText.SelectedValue;
}
}
TreeNode objNode = new TreeNode();
ComplexForm objProgram = new ComplexForm(_objCharacter);
objProgram.Create(objXmlProgram, _objCharacter, objNode, strExtra);
if (objProgram.InternalId == Guid.Empty.ToString())
return;
_objCharacter.ComplexForms.Add(objProgram);
// If using the optional rule for costing the same as Spells, change the Karma cost.
if (_objOptions.AlternateComplexFormCost)
intKarmaCost = _objOptions.KarmaSpell;
// Make sure the character has enough Karma before letting them select a Complex Form.
if (_objCharacter.Karma < intKarmaCost)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
// Remove the Improvements created by the Complex Form.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.ComplexForm, objProgram.InternalId);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", objProgram.DisplayNameShort).Replace("{1}", intKarmaCost.ToString())))
{
// Remove the Improvements created by the Complex Form.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.ComplexForm, objProgram.InternalId);
return;
}
treComplexForms.Nodes[0].Nodes.Add(objNode);
treComplexForms.Nodes[0].Expand();
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseLearnComplexForm") + " " + objProgram.DisplayNameShort, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.AddComplexForm, objProgram.InternalId);
objExpense.Undo = objUndo;
_objFunctions.SortTree(treComplexForms);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
if (frmPickProgram.AddAgain)
cmdAddComplexForm_Click(sender, e);
}
示例4: CreateCritter
/// <summary>
/// Create a Critter, put them into Career Mode, link them, and open the newly-created Critter.
/// </summary>
/// <param name="strCritterName">Name of the Critter's Metatype.</param>
/// <param name="intForce">Critter's Force.</param>
private void CreateCritter(string strCritterName, int intForce)
{
// The Critter should use the same settings file as the character.
Character objCharacter = new Character();
objCharacter.SettingsFile = _objSpirit.CharacterObject.SettingsFile;
// Override the defaults for the setting.
objCharacter.IgnoreRules = true;
objCharacter.IsCritter = true;
objCharacter.BuildMethod = CharacterBuildMethod.Karma;
objCharacter.BuildPoints = 0;
if (txtCritterName.Text != string.Empty)
objCharacter.Name = txtCritterName.Text;
// Make sure that Running Wild is one of the allowed source books since most of the Critter Powers come from this book.
bool blnRunningWild = false;
blnRunningWild = (objCharacter.Options.Books.Contains("RW"));
if (!blnRunningWild)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_Main_RunningWild"), LanguageManager.Instance.GetString("MessageTitle_Main_RunningWild"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Ask the user to select a filename for the new character.
string strForce = LanguageManager.Instance.GetString("String_Force");
if (_objSpirit.EntityType == SpiritType.Sprite)
strForce = LanguageManager.Instance.GetString("String_Rating");
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Chummer5 Files (*.chum5)|*.chum5|All Files (*.*)|*.*";
saveFileDialog.FileName = strCritterName + " (" + strForce + " " + _objSpirit.Force.ToString() + ").chum5";
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
{
string strFileName = saveFileDialog.FileName;
objCharacter.FileName = strFileName;
}
else
return;
// Code from frmMetatype.
ImprovementManager objImprovementManager = new ImprovementManager(objCharacter);
XmlDocument objXmlDocument = XmlManager.Instance.Load("critters.xml");
XmlNode objXmlMetatype = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + strCritterName + "\"]");
// If the Critter could not be found, show an error and get out of here.
if (objXmlMetatype == null)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_UnknownCritterType").Replace("{0}", strCritterName), LanguageManager.Instance.GetString("MessageTitle_SelectCritterType"), MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
// Set Metatype information.
if (strCritterName == "Ally Spirit")
{
objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["bodaug"].InnerText, intForce, 0));
objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["agiaug"].InnerText, intForce, 0));
objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["reaaug"].InnerText, intForce, 0));
objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["strmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["straug"].InnerText, intForce, 0));
objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chamax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["chaaug"].InnerText, intForce, 0));
objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["intaug"].InnerText, intForce, 0));
objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["logaug"].InnerText, intForce, 0));
objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["wilaug"].InnerText, intForce, 0));
objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["magaug"].InnerText, intForce, 0));
objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["resaug"].InnerText, intForce, 0));
objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["edgaug"].InnerText, intForce, 0));
objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
}
else
{
int intMinModifier = -3;
if (objXmlMetatype["category"].InnerText == "Mutant Critters")
intMinModifier = 0;
objCharacter.BOD.AssignLimits(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 3));
objCharacter.AGI.AssignLimits(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 3));
objCharacter.REA.AssignLimits(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 3));
objCharacter.STR.AssignLimits(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 3));
objCharacter.CHA.AssignLimits(ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["chamin"].InnerText, intForce, 3));
objCharacter.INT.AssignLimits(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 3));
objCharacter.LOG.AssignLimits(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 3));
objCharacter.WIL.AssignLimits(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 3));
objCharacter.INI.AssignLimits(ExpressionToString(objXmlMetatype["inimin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["iniaug"].InnerText, intForce, 0));
objCharacter.MAG.AssignLimits(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 3));
objCharacter.RES.AssignLimits(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 3));
objCharacter.EDG.AssignLimits(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, intMinModifier), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3), ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 3));
objCharacter.ESS.AssignLimits(ExpressionToString(objXmlMetatype["essmin"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0), ExpressionToString(objXmlMetatype["essaug"].InnerText, intForce, 0));
}
// If we're working with a Critter, set the Attributes to their default values.
objCharacter.BOD.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["bodmin"].InnerText, intForce, 0));
objCharacter.AGI.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["agimin"].InnerText, intForce, 0));
objCharacter.REA.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["reamin"].InnerText, intForce, 0));
objCharacter.STR.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["strmin"].InnerText, intForce, 0));
//.........这里部分代码省略.........
示例5: MetatypeSelected
//.........这里部分代码省略.........
_objCharacter.REA.AssignLimits("0", "0", "0");
_objCharacter.STR.AssignLimits("0", "0", "0");
_objCharacter.WIL.AssignLimits("0", "0", "0");
_objCharacter.INI.MetatypeMinimum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
_objCharacter.INI.MetatypeMaximum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
}
// If this is a Shapeshifter, a Metavariant must be selected. Default to Human if None is selected.
if (cboCategory.SelectedValue.ToString() == "Shapeshifter" && cboMetavariant.SelectedValue.ToString() == "None")
cboMetavariant.SelectedValue = "Human";
_objCharacter.Metatype = lstMetatypes.SelectedValue.ToString();
_objCharacter.MetatypeCategory = cboCategory.SelectedValue.ToString();
if (cboMetavariant.SelectedValue.ToString() == "None")
{
_objCharacter.Metavariant = "";
_objCharacter.MetatypeBP = Convert.ToInt32(lblBP.Text);
}
else
{
_objCharacter.Metavariant = cboMetavariant.SelectedValue.ToString();
_objCharacter.MetatypeBP = Convert.ToInt32(lblMetavariantBP.Text);
}
if (objXmlMetatype["movement"] != null)
_objCharacter.Movement = objXmlMetatype["movement"].InnerText;
// Load the Qualities file.
XmlDocument objXmlQualityDocument = XmlManager.Instance.Load("qualities.xml");
if (cboMetavariant.SelectedValue.ToString() == "None")
{
// Determine if the Metatype has any bonuses.
if (objXmlMetatype.InnerXml.Contains("bonus"))
objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Metatype, lstMetatypes.SelectedValue.ToString(), objXmlMetatype.SelectSingleNode("bonus"), false, 1, lstMetatypes.SelectedValue.ToString());
// Create the Qualities that come with the Metatype.
foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/positive/quality"))
{
XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQualityItem.InnerText + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(_objCharacter);
string strForceValue = "";
if (objXmlQualityItem.Attributes["select"] != null)
strForceValue = objXmlQualityItem.Attributes["select"].InnerText;
QualitySource objSource = new QualitySource();
objSource = QualitySource.Metatype;
if (objXmlQualityItem.Attributes["removable"] != null)
objSource = QualitySource.MetatypeRemovable;
objQuality.Create(objXmlQuality, _objCharacter, objSource, objNode, objWeapons, objWeaponNodes, strForceValue);
objQuality.ContributeToLimit = false;
_objCharacter.Qualities.Add(objQuality);
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objWeapons)
_objCharacter.Weapons.Add(objWeapon);
}
foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/negative/quality"))
{
XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQualityItem.InnerText + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(_objCharacter);
string strForceValue = "";
示例6: MetatypeSelected
//.........这里部分代码省略.........
_objCharacter.AGI.AssignLimits("0", "0", "0");
_objCharacter.REA.AssignLimits("0", "0", "0");
_objCharacter.STR.AssignLimits("0", "0", "0");
_objCharacter.WIL.AssignLimits("0", "0", "0");
_objCharacter.INI.MetatypeMinimum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
_objCharacter.INI.MetatypeMaximum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
}
// If this is a Shapeshifter, a Metavariant must be selected. Default to Human if None is selected.
if (cboCategory.SelectedValue.ToString() == "Shapeshifter" && cboMetavariant.SelectedValue.ToString() == "None")
cboMetavariant.SelectedValue = "Human";
_objCharacter.Metatype = lstMetatypes.SelectedValue.ToString();
_objCharacter.MetatypeCategory = cboCategory.SelectedValue.ToString();
if (cboMetavariant.SelectedValue.ToString() == "None")
{
_objCharacter.Metavariant = "";
}
else
{
_objCharacter.Metavariant = cboMetavariant.SelectedValue.ToString();
}
if (objXmlMetatype["movement"] != null) // TODO: Replace with Walk/Run
_objCharacter.Movement = objXmlMetatype["movement"].InnerText;
// Load the Qualities file.
XmlDocument objXmlQualityDocument = XmlManager.Instance.Load("qualities.xml");
if (cboMetavariant.SelectedValue.ToString() == "None")
{
// Determine if the Metatype has any bonuses.
if (objXmlMetatype.InnerXml.Contains("bonus"))
objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Metatype, lstMetatypes.SelectedValue.ToString(), objXmlMetatype.SelectSingleNode("bonus"), false, 1, lstMetatypes.SelectedValue.ToString());
// Create the Qualities that come with the Metatype.
foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/positive/quality"))
{
XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQualityItem.InnerText + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(_objCharacter);
string strForceValue = "";
if (objXmlQualityItem.Attributes["select"] != null)
strForceValue = objXmlQualityItem.Attributes["select"].InnerText;
QualitySource objSource = new QualitySource();
objSource = QualitySource.Metatype;
if (objXmlQualityItem.Attributes["removable"] != null)
objSource = QualitySource.MetatypeRemovable;
objQuality.Create(objXmlQuality, _objCharacter, objSource, objNode, objWeapons, objWeaponNodes, strForceValue);
objQuality.ContributeToLimit = false;
_objCharacter.Qualities.Add(objQuality);
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objWeapons)
_objCharacter.Weapons.Add(objWeapon);
}
foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/negative/quality"))
{
XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQualityItem.InnerText + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(_objCharacter);
string strForceValue = "";
示例7: TestMetatype
//.........这里部分代码省略.........
_objCharacter.INT.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["intmin"].InnerText, intForce, 0));
_objCharacter.LOG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["logmin"].InnerText, intForce, 0));
_objCharacter.WIL.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["wilmin"].InnerText, intForce, 0));
_objCharacter.MAG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["magmin"].InnerText, intForce, 0));
_objCharacter.RES.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["resmin"].InnerText, intForce, 0));
_objCharacter.EDG.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["edgmin"].InnerText, intForce, 0));
_objCharacter.ESS.Value = Convert.ToInt32(ExpressionToString(objXmlMetatype["essmax"].InnerText, intForce, 0));
}
// Sprites can never have Physical Attributes or WIL.
if (objXmlMetatype["name"].InnerText.EndsWith("Sprite"))
{
_objCharacter.BOD.AssignLimits("0", "0", "0");
_objCharacter.AGI.AssignLimits("0", "0", "0");
_objCharacter.REA.AssignLimits("0", "0", "0");
_objCharacter.STR.AssignLimits("0", "0", "0");
_objCharacter.WIL.AssignLimits("0", "0", "0");
_objCharacter.INI.MetatypeMinimum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
_objCharacter.INI.MetatypeMaximum = Convert.ToInt32(ExpressionToString(objXmlMetatype["inimax"].InnerText, intForce, 0));
}
_objCharacter.Metatype = objXmlMetatype["name"].InnerText;
_objCharacter.MetatypeCategory = objXmlMetatype["category"].InnerText;
_objCharacter.Metavariant = "";
_objCharacter.MetatypeBP = 400;
if (objXmlMetatype["movement"] != null)
_objCharacter.Movement = objXmlMetatype["movement"].InnerText;
// Load the Qualities file.
XmlDocument objXmlQualityDocument = XmlManager.Instance.Load("qualities.xml");
// Determine if the Metatype has any bonuses.
if (objXmlMetatype.InnerXml.Contains("bonus"))
objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Metatype, objXmlMetatype["name"].InnerText, objXmlMetatype.SelectSingleNode("bonus"), false, 1, objXmlMetatype["name"].InnerText);
// Create the Qualities that come with the Metatype.
foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/positive/quality"))
{
XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQualityItem.InnerText + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(_objCharacter);
string strForceValue = "";
if (objXmlQualityItem.Attributes["select"] != null)
strForceValue = objXmlQualityItem.Attributes["select"].InnerText;
QualitySource objSource = new QualitySource();
objSource = QualitySource.Metatype;
if (objXmlQualityItem.Attributes["removable"] != null)
objSource = QualitySource.MetatypeRemovable;
objQuality.Create(objXmlQuality, _objCharacter, objSource, objNode, objWeapons, objWeaponNodes, strForceValue);
_objCharacter.Qualities.Add(objQuality);
}
foreach (XmlNode objXmlQualityItem in objXmlMetatype.SelectNodes("qualities/negative/quality"))
{
XmlNode objXmlQuality = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQualityItem.InnerText + "\"]");
TreeNode objNode = new TreeNode();
List<Weapon> objWeapons = new List<Weapon>();
List<TreeNode> objWeaponNodes = new List<TreeNode>();
Quality objQuality = new Quality(_objCharacter);
string strForceValue = "";
if (objXmlQualityItem.Attributes["select"] != null)
strForceValue = objXmlQualityItem.Attributes["select"].InnerText;
QualitySource objSource = new QualitySource();
objSource = QualitySource.Metatype;
if (objXmlQualityItem.Attributes["removable"] != null)