本文整理汇总了C#中Chummer.ComplexForm类的典型用法代码示例。如果您正苦于以下问题:C# ComplexForm类的具体用法?C# ComplexForm怎么用?C# ComplexForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComplexForm类属于Chummer命名空间,在下文中一共展示了ComplexForm类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: Load
//.........这里部分代码省略.........
// Sort the Powers in alphabetical order.
foreach (XmlNode objXmlPower in objXmlNodeList)
{
ListItem objGroup = new ListItem();
objGroup.Value = objXmlPower["extra"].InnerText;
objGroup.Name = objXmlPower["name"].InnerText;
lstPowerOrder.Add(objGroup);
}
objSort = new SortListItem();
lstPowerOrder.Sort(objSort.Compare);
foreach (ListItem objItem in lstPowerOrder)
{
Power objPower = new Power(this);
XmlNode objNode = objXmlDocument.SelectSingleNode("/character/powers/power[name = " + CleanXPath(objItem.Name) + " and extra = " + CleanXPath(objItem.Value) + "]");
objPower.Load(objNode);
_lstPowers.Add(objPower);
}
// Spirits/Sprites.
objXmlNodeList = objXmlDocument.SelectNodes("/character/spirits/spirit");
foreach (XmlNode objXmlSpirit in objXmlNodeList)
{
Spirit objSpirit = new Spirit(this);
objSpirit.Load(objXmlSpirit);
_lstSpirits.Add(objSpirit);
}
// Compex Forms/Technomancer Programs.
objXmlNodeList = objXmlDocument.SelectNodes("/character/complexforms/complexform");
foreach (XmlNode objXmlProgram in objXmlNodeList)
{
ComplexForm objProgram = new ComplexForm(this);
objProgram.Load(objXmlProgram);
_lstComplexForms.Add(objProgram);
}
// Martial Arts.
objXmlNodeList = objXmlDocument.SelectNodes("/character/martialarts/martialart");
foreach (XmlNode objXmlArt in objXmlNodeList)
{
MartialArt objMartialArt = new MartialArt(this);
objMartialArt.Load(objXmlArt);
_lstMartialArts.Add(objMartialArt);
}
// Martial Art Maneuvers.
objXmlNodeList = objXmlDocument.SelectNodes("/character/martialartmaneuvers/martialartmaneuver");
foreach (XmlNode objXmlManeuver in objXmlNodeList)
{
MartialArtManeuver objManeuver = new MartialArtManeuver(this);
objManeuver.Load(objXmlManeuver);
_lstMartialArtManeuvers.Add(objManeuver);
}
// Limit Modifiers.
objXmlNodeList = objXmlDocument.SelectNodes("/character/limitmodifiers/limitmodifier");
foreach (XmlNode objXmlLimit in objXmlNodeList)
{
LimitModifier obLimitModifier = new LimitModifier(this);
obLimitModifier.Load(objXmlLimit);
_lstLimitModifiers.Add(obLimitModifier);
}
// Lifestyles.
示例3: AddPACKSKit
//.........这里部分代码省略.........
objPower.Bonus = objXmlPowerNode["bonus"];
if (objXmlPower["name"].Attributes["select"] != null)
_objImprovementManager.ForcedValue = objXmlPower["name"].Attributes["select"].InnerText;
_objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Power, objPower.InternalId, objPower.Bonus, false, Convert.ToInt32(objPower.Rating), objPower.DisplayNameShort);
objPowerControl.Extra = _objImprovementManager.SelectedValue;
}
objPowerControl.Top = i * objPowerControl.Height;
panPowers.Controls.Add(objPowerControl);
// Set the Rating of the Power if applicable.
if (objXmlPower["rating"] != null)
objPowerControl.PowerLevel = Convert.ToInt32(objXmlPower["rating"].InnerText);
}
}
// 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)
{
示例4: 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);
}
示例5: CreateCritter
//.........这里部分代码省略.........
SkillSpecialization objSpec = new SkillSpecialization(objXmlSkill.Attributes["spec"].InnerText);
objKnowledge.Specializations.Add(objSpec);
}
objKnowledge.SkillCategory = objXmlSkill.Attributes["category"].InnerText;
if (Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText) > 6)
objKnowledge.RatingMaximum = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText);
objKnowledge.Rating = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText);
objCharacter.Skills.Add(objKnowledge);
}
// If this is a Critter with a Force (which dictates their Skill Rating/Maximum Skill Rating), set their Skill Rating Maximums.
if (intForce > 0)
{
int intMaxRating = intForce;
// Determine the highest Skill Rating the Critter has.
foreach (Skill objSkill in objCharacter.Skills)
{
if (objSkill.RatingMaximum > intMaxRating)
intMaxRating = objSkill.RatingMaximum;
}
// Now that we know the upper limit, set all of the Skill Rating Maximums to match.
foreach (Skill objSkill in objCharacter.Skills)
objSkill.RatingMaximum = intMaxRating;
foreach (SkillGroup objGroup in objCharacter.SkillGroups)
objGroup.RatingMaximum = intMaxRating;
// Set the MaxSkillRating for the character so it can be used later when they add new Knowledge Skills or Exotic Skills.
objCharacter.MaxSkillRating = intMaxRating;
}
// Add any Complex Forms the Critter comes with (typically Sprites)
XmlDocument objXmlProgramDocument = XmlManager.Instance.Load("complexforms.xml");
foreach (XmlNode objXmlComplexForm in objXmlCritter.SelectNodes("complexforms/complexform"))
{
string strForceValue = "";
if (objXmlComplexForm.Attributes["select"] != null)
strForceValue = objXmlComplexForm.Attributes["select"].InnerText;
XmlNode objXmlProgram = objXmlProgramDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + objXmlComplexForm.InnerText + "\"]");
TreeNode objNode = new TreeNode();
ComplexForm objProgram = new ComplexForm(objCharacter);
objProgram.Create(objXmlProgram, objCharacter, objNode, strForceValue);
objCharacter.ComplexForms.Add(objProgram);
}
// Add any Gear the Critter comes with (typically Programs for A.I.s)
XmlDocument objXmlGearDocument = XmlManager.Instance.Load("gear.xml");
foreach (XmlNode objXmlGear in objXmlCritter.SelectNodes("gears/gear"))
{
int intRating = 0;
if (objXmlGear.Attributes["rating"] != null)
intRating = Convert.ToInt32(ExpressionToString(objXmlGear.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0));
string strForceValue = "";
if (objXmlGear.Attributes["select"] != null)
strForceValue = objXmlGear.Attributes["select"].InnerText;
XmlNode objXmlGearItem = objXmlGearDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + objXmlGear.InnerText + "\"]");
TreeNode objNode = new TreeNode();
Gear objGear = new Gear(objCharacter);
List<Weapon> lstWeapons = new List<Weapon>();
List<TreeNode> lstWeaponNodes = new List<TreeNode>();
objGear.Create(objXmlGearItem, objCharacter, objNode, intRating, lstWeapons, lstWeaponNodes, strForceValue);
objGear.Cost = "0";
objGear.Cost3 = "0";
objGear.Cost6 = "0";
objGear.Cost10 = "0";
objCharacter.Gear.Add(objGear);
示例6: MetatypeSelected
//.........这里部分代码省略.........
objKnowledge.KnowledgeSkill = true;
if (objXmlSkill.Attributes["spec"] != null)
{
SkillSpecialization objSpec = new SkillSpecialization(objXmlSkill.Attributes["spec"].InnerText);
objKnowledge.Specializations.Add(objSpec);
}
objKnowledge.SkillCategory = objXmlSkill.Attributes["category"].InnerText;
if (Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText) > 6)
objKnowledge.RatingMaximum = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText);
objKnowledge.Rating = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText);
_objCharacter.Skills.Add(objKnowledge);
}
// If this is a Critter with a Force (which dictates their Skill Rating/Maximum Skill Rating), set their Skill Rating Maximums.
if (intForce > 0)
{
int intMaxRating = intForce;
// Determine the highest Skill Rating the Critter has.
foreach (Skill objSkill in _objCharacter.Skills)
{
if (objSkill.RatingMaximum > intMaxRating)
intMaxRating = objSkill.RatingMaximum;
}
// Now that we know the upper limit, set all of the Skill Rating Maximums to match.
foreach (Skill objSkill in _objCharacter.Skills)
objSkill.RatingMaximum = intMaxRating;
foreach (SkillGroup objGroup in _objCharacter.SkillGroups)
objGroup.RatingMaximum = intMaxRating;
// Set the MaxSkillRating for the character so it can be used later when they add new Knowledge Skills or Exotic Skills.
_objCharacter.MaxSkillRating = intMaxRating;
}
// Add any Complex Forms the Critter comes with (typically Sprites)
XmlDocument objXmlProgramDocument = XmlManager.Instance.Load("complexforms.xml");
foreach (XmlNode objXmlComplexForm in objXmlCritter.SelectNodes("complexforms/complexform"))
{
string strForceValue = "";
if (objXmlComplexForm.Attributes["select"] != null)
strForceValue = objXmlComplexForm.Attributes["select"].InnerText;
XmlNode objXmlProgram = objXmlProgramDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + objXmlComplexForm.InnerText + "\"]");
TreeNode objNode = new TreeNode();
ComplexForm objProgram = new ComplexForm(_objCharacter);
objProgram.Create(objXmlProgram, _objCharacter, objNode, strForceValue);
_objCharacter.ComplexForms.Add(objProgram);
}
// Add any Gear the Critter comes with (typically Programs for A.I.s)
XmlDocument objXmlGearDocument = XmlManager.Instance.Load("gear.xml");
foreach (XmlNode objXmlGear in objXmlCritter.SelectNodes("gears/gear"))
{
int intRating = 0;
if (objXmlGear.Attributes["rating"] != null)
intRating = Convert.ToInt32(ExpressionToString(objXmlGear.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0));
string strForceValue = "";
if (objXmlGear.Attributes["select"] != null)
strForceValue = objXmlGear.Attributes["select"].InnerText;
XmlNode objXmlGearItem = objXmlGearDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + objXmlGear.InnerText + "\"]");
TreeNode objNode = new TreeNode();
Gear objGear = new Gear(_objCharacter);
List<Weapon> lstWeapons = new List<Weapon>();
List<TreeNode> lstWeaponNodes = new List<TreeNode>();
objGear.Create(objXmlGearItem, _objCharacter, objNode, intRating, lstWeapons, lstWeaponNodes, strForceValue);
objGear.Cost = "0";
objGear.Cost3 = "0";
objGear.Cost6 = "0";
objGear.Cost10 = "0";
_objCharacter.Gear.Add(objGear);
}
// If this is a Mutant Critter, count up the number of Skill points they start with.
if (_objCharacter.MetatypeCategory == "Mutant Critters")
{
foreach (Skill objSkill in _objCharacter.Skills)
_objCharacter.MutantCritterBaseSkills += objSkill.Rating;
}
if (cboMetavariant.Text != "None")
{
int x = 0;
int.TryParse(lblMetavariantBP.Text, out x);
//_objCharacter.BuildKarma = _objCharacter.BuildKarma - x;
}
else
{
int x = 0;
int.TryParse(lblBP.Text, out x);
//_objCharacter.BuildKarma = _objCharacter.BuildKarma - x;
}
this.DialogResult = DialogResult.OK;
this.Close();
}
else
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_Metatype_SelectMetatype"), LanguageManager.Instance.GetString("MessageTitle_Metatype_SelectMetatype"), MessageBoxButtons.OK, MessageBoxIcon.Information);
}
_objCharacter.Movement = (_objCharacter.AGI.TotalValue * 2).ToString() + "/" + (_objCharacter.AGI.TotalValue * 4).ToString();
}
示例7: MetatypeSelected
//.........这里部分代码省略.........
SkillSpecialization objSpec = new SkillSpecialization(objXmlSkill.Attributes["spec"].InnerText);
objKnowledge.Specializations.Add(objSpec);
}
objKnowledge.SkillCategory = objXmlSkill.Attributes["category"].InnerText;
if (Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText) > 6)
objKnowledge.RatingMaximum = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText);
objKnowledge.Rating = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText);
_objCharacter.Skills.Add(objKnowledge);
}
// If this is a Critter with a Force (which dictates their Skill Rating/Maximum Skill Rating), set their Skill Rating Maximums.
if (intForce > 0)
{
int intMaxRating = intForce;
// Determine the highest Skill Rating the Critter has.
foreach (Skill objSkill in _objCharacter.Skills)
{
if (objSkill.RatingMaximum > intMaxRating)
intMaxRating = objSkill.RatingMaximum;
}
// Now that we know the upper limit, set all of the Skill Rating Maximums to match.
foreach (Skill objSkill in _objCharacter.Skills)
objSkill.RatingMaximum = intMaxRating;
foreach (SkillGroup objGroup in _objCharacter.SkillGroups)
objGroup.RatingMaximum = intMaxRating;
// Set the MaxSkillRating for the character so it can be used later when they add new Knowledge Skills or Exotic Skills.
_objCharacter.MaxSkillRating = intMaxRating;
}
// Add any Complex Forms the Critter comes with (typically Sprites)
XmlDocument objXmlProgramDocument = XmlManager.Instance.Load("complexforms.xml");
foreach (XmlNode objXmlComplexForm in objXmlCritter.SelectNodes("complexforms/complexform"))
{
string strForceValue = "";
if (objXmlComplexForm.Attributes["select"] != null)
strForceValue = objXmlComplexForm.Attributes["select"].InnerText;
XmlNode objXmlProgram = objXmlProgramDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + objXmlComplexForm.InnerText + "\"]");
TreeNode objNode = new TreeNode();
ComplexForm objProgram = new ComplexForm(_objCharacter);
objProgram.Create(objXmlProgram, _objCharacter, objNode, strForceValue);
_objCharacter.ComplexForms.Add(objProgram);
}
// Add any Gear the Critter comes with (typically Programs for A.I.s)
XmlDocument objXmlGearDocument = XmlManager.Instance.Load("gear.xml");
foreach (XmlNode objXmlGear in objXmlCritter.SelectNodes("gears/gear"))
{
int intRating = 0;
if (objXmlGear.Attributes["rating"] != null)
intRating = Convert.ToInt32(ExpressionToString(objXmlGear.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0));
string strForceValue = "";
if (objXmlGear.Attributes["select"] != null)
strForceValue = objXmlGear.Attributes["select"].InnerText;
XmlNode objXmlGearItem = objXmlGearDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + objXmlGear.InnerText + "\"]");
TreeNode objNode = new TreeNode();
Gear objGear = new Gear(_objCharacter);
List<Weapon> lstWeapons = new List<Weapon>();
List<TreeNode> lstWeaponNodes = new List<TreeNode>();
objGear.Create(objXmlGearItem, _objCharacter, objNode, intRating, lstWeapons, lstWeaponNodes, strForceValue);
objGear.Cost = "0";
objGear.Cost3 = "0";
objGear.Cost6 = "0";
objGear.Cost10 = "0";
_objCharacter.Gear.Add(objGear);
示例8: TestMetatype
//.........这里部分代码省略.........
{
objSkill.RatingMaximum = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(intForce), 0));
objSkill.Rating = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(intForce), 0));
break;
}
}
}
// Set the Knowledge Skill Ratings for the Critter.
foreach (XmlNode objXmlSkill in objXmlCritter.SelectNodes("skills/knowledge"))
{
Skill objKnowledge = new Skill(_objCharacter);
objKnowledge.Name = objXmlSkill.InnerText;
objKnowledge.KnowledgeSkill = true;
if (objXmlSkill.Attributes["spec"] != null)
{
SkillSpecialization objSpec = new SkillSpecialization(objXmlSkill.Attributes["spec"].InnerText);
objKnowledge.Specializations.Add(objSpec);
}
objKnowledge.SkillCategory = objXmlSkill.Attributes["category"].InnerText;
if (Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText) > 6)
objKnowledge.RatingMaximum = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText);
objKnowledge.Rating = Convert.ToInt32(objXmlSkill.Attributes["rating"].InnerText);
_objCharacter.Skills.Add(objKnowledge);
}
// If this is a Critter with a Force (which dictates their Skill Rating/Maximum Skill Rating), set their Skill Rating Maximums.
if (intForce > 0)
{
int intMaxRating = intForce;
// Determine the highest Skill Rating the Critter has.
foreach (Skill objSkill in _objCharacter.Skills)
{
if (objSkill.RatingMaximum > intMaxRating)
intMaxRating = objSkill.RatingMaximum;
}
// Now that we know the upper limit, set all of the Skill Rating Maximums to match.
foreach (Skill objSkill in _objCharacter.Skills)
objSkill.RatingMaximum = intMaxRating;
foreach (SkillGroup objGroup in _objCharacter.SkillGroups)
objGroup.RatingMaximum = intMaxRating;
// Set the MaxSkillRating for the character so it can be used later when they add new Knowledge Skills or Exotic Skills.
_objCharacter.MaxSkillRating = intMaxRating;
}
// Add any Complex Forms the Critter comes with (typically Sprites)
XmlDocument objXmlProgramDocument = XmlManager.Instance.Load("complexforms.xml");
foreach (XmlNode objXmlComplexForm in objXmlCritter.SelectNodes("complexforms/complexform"))
{
int intRating = 0;
if (objXmlComplexForm.Attributes["rating"] != null)
intRating = Convert.ToInt32(ExpressionToString(objXmlComplexForm.Attributes["rating"].InnerText, Convert.ToInt32(intForce), 0));
string strForceValue = "";
if (objXmlComplexForm.Attributes["select"] != null)
strForceValue = objXmlComplexForm.Attributes["select"].InnerText;
XmlNode objXmlProgram = objXmlProgramDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + objXmlComplexForm.InnerText + "\"]");
TreeNode objNode = new TreeNode();
ComplexForm objProgram = new ComplexForm(_objCharacter);
objProgram.Create(objXmlProgram, _objCharacter, objNode, strForceValue);
_objCharacter.ComplexForms.Add(objProgram);
}
// Add any Gear the Critter comes with (typically Programs for A.I.s)
XmlDocument objXmlGearDocument = XmlManager.Instance.Load("gear.xml");
foreach (XmlNode objXmlGear in objXmlCritter.SelectNodes("gears/gear"))
{
int intRating = 0;
if (objXmlGear.Attributes["rating"] != null)
intRating = Convert.ToInt32(ExpressionToString(objXmlGear.Attributes["rating"].InnerText, Convert.ToInt32(intForce), 0));
string strForceValue = "";
if (objXmlGear.Attributes["select"] != null)
strForceValue = objXmlGear.Attributes["select"].InnerText;
XmlNode objXmlGearItem = objXmlGearDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + objXmlGear.InnerText + "\"]");
TreeNode objNode = new TreeNode();
Gear objGear = new Gear(_objCharacter);
List<Weapon> lstWeapons = new List<Weapon>();
List<TreeNode> lstWeaponNodes = new List<TreeNode>();
objGear.Create(objXmlGearItem, _objCharacter, objNode, intRating, lstWeapons, lstWeaponNodes, strForceValue);
objGear.Cost = "0";
objGear.Cost3 = "0";
objGear.Cost6 = "0";
objGear.Cost10 = "0";
_objCharacter.Gear.Add(objGear);
}
// If this is a Mutant Critter, count up the number of Skill points they start with.
if (_objCharacter.MetatypeCategory == "Mutant Critters")
{
foreach (Skill objSkill in _objCharacter.Skills)
_objCharacter.MutantCritterBaseSkills += objSkill.Rating;
}
}
catch
{
txtOutput.Text += _objCharacter.Metatype + " general failure\n";
}
}
}