本文整理汇总了C#中Chummer.CritterPower类的典型用法代码示例。如果您正苦于以下问题:C# CritterPower类的具体用法?C# CritterPower怎么用?C# CritterPower使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CritterPower类属于Chummer命名空间,在下文中一共展示了CritterPower类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: mnuSpecialConvertToFreeSprite_Click
private void mnuSpecialConvertToFreeSprite_Click(object sender, EventArgs e)
{
XmlDocument objXmlDocument = XmlManager.Instance.Load("critterpowers.xml");
XmlNode objXmlPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"Denial\"]");
TreeNode objNode = new TreeNode();
CritterPower objPower = new CritterPower(_objCharacter);
objPower.Create(objXmlPower, _objCharacter, objNode);
objPower.CountTowardsLimit = false;
objNode.ContextMenuStrip = cmsCritterPowers;
if (objPower.InternalId == Guid.Empty.ToString())
return;
_objCharacter.CritterPowers.Add(objPower);
treCritterPowers.Nodes[0].Nodes.Add(objNode);
treCritterPowers.Nodes[0].Expand();
_objCharacter.MetatypeCategory = "Free Sprite";
mnuSpecialConvertToFreeSprite.Visible = false;
treCritterPowers.SortCustom();
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:26,代码来源:frmCreate.cs
示例3: mnuSpecialCyberzombie_Click
private void mnuSpecialCyberzombie_Click(object sender, EventArgs e)
{
bool blnEssence = true;
bool blnCyberware = false;
string strMessage = LanguageManager.Instance.GetString("Message_CyberzombieRequirements");
// Make sure the character has an Essence lower than 0.
if (_objCharacter.Essence >= 0)
{
strMessage += "\n\t" + LanguageManager.Instance.GetString("Message_CyberzombieRequirementsEssence");
blnEssence = false;
}
// Make sure the character has an Invoked Memory Stimulator.
foreach (Cyberware objCyberware in _objCharacter.Cyberware)
{
if (objCyberware.Name == "Invoked Memory Stimulator")
blnCyberware = true;
}
if (!blnCyberware)
strMessage += "\n\t" + LanguageManager.Instance.GetString("Message_CyberzombieRequirementsStimulator");
if (!blnEssence || !blnCyberware)
{
MessageBox.Show(strMessage, LanguageManager.Instance.GetString("MessageTitle_CyberzombieRequirements"), MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (MessageBox.Show(LanguageManager.Instance.GetString("Message_CyberzombieConfirm"), LanguageManager.Instance.GetString("MessageTitle_CyberzombieConfirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return;
// Get the player to roll Dice to make a WIL Test and record the result.
frmDiceHits frmWILHits = new frmDiceHits();
frmWILHits.Text = LanguageManager.Instance.GetString("String_CyberzombieWILText");
frmWILHits.Description = LanguageManager.Instance.GetString("String_CyberzombieWILDescription");
int intDice = _objCharacter.WIL.TotalValue;
int intThreshold = 3 + (Convert.ToInt32(_objCharacter.EssencePenalty - Convert.ToInt32(_objCharacter.EssenceMaximum)));
frmWILHits.Dice = intDice;
frmWILHits.ShowDialog(this);
if (frmWILHits.DialogResult != DialogResult.OK)
return;
int intWILResult = frmWILHits.Result;
// The character gains 10 + ((Threshold - Hits) * 10)BP worth of Negative Qualities.
int intResult = 10;
if (intWILResult < intThreshold)
{
intResult = (intThreshold - intWILResult) * 10;
}
_objImprovementManager.CreateImprovement("", Improvement.ImprovementSource.Cyberzombie, "Cyberzombie Qualities", Improvement.ImprovementType.FreeNegativeQualities, "", intResult * -1);
// Convert the character.
// Characters lose access to Resonance.
_objCharacter.RESEnabled = false;
// Gain MAG that is permanently set to 1.
_objCharacter.MAGEnabled = true;
_objCharacter.MAG.MetatypeMinimum = 1;
_objCharacter.MAG.MetatypeMaximum = 1;
_objCharacter.MAG.Value = 1;
// Add the Cyberzombie Lifestyle if it is not already taken.
bool blnHasLifestyle = false;
foreach (Lifestyle objLifestyle in _objCharacter.Lifestyles)
{
if (objLifestyle.Name == "Cyberzombie Lifestyle Addition")
blnHasLifestyle = true;
}
if (!blnHasLifestyle)
{
XmlDocument objXmlLifestyleDocument = XmlManager.Instance.Load("lifestyles.xml");
XmlNode objXmlLifestyle = objXmlLifestyleDocument.SelectSingleNode("/chummer/lifestyles/lifestyle[name = \"Cyberzombie Lifestyle Addition\"]");
TreeNode objLifestyleNode = new TreeNode();
Lifestyle objLifestyle = new Lifestyle(_objCharacter);
objLifestyle.Create(objXmlLifestyle, objLifestyleNode);
_objCharacter.Lifestyles.Add(objLifestyle);
treLifestyles.Nodes[0].Nodes.Add(objLifestyleNode);
treLifestyles.Nodes[0].Expand();
}
// Change the MetatypeCategory to Cyberzombie.
_objCharacter.MetatypeCategory = "Cyberzombie";
// Gain access to Critter Powers.
_objCharacter.CritterEnabled = true;
// Gain the Dual Natured Critter Power if it does not yet exist.
bool blnHasPower = false;
foreach (CritterPower objPower in _objCharacter.CritterPowers)
{
if (objPower.Name == "Dual Natured")
blnHasPower = true;
}
if (!blnHasPower)
{
//.........这里部分代码省略.........
开发者ID:cormanater,项目名称:chummer5a,代码行数:101,代码来源:frmCreate.cs
示例4: Load
//.........这里部分代码省略.........
}
// Metamagics/Echoes.
objXmlNodeList = objXmlDocument.SelectNodes("/character/metamagics/metamagic");
foreach (XmlNode objXmlMetamagic in objXmlNodeList)
{
Metamagic objMetamagic = new Metamagic(this);
objMetamagic.Load(objXmlMetamagic);
_lstMetamagics.Add(objMetamagic);
}
// Arts
objXmlNodeList = objXmlDocument.SelectNodes("/character/arts/art");
foreach (XmlNode objXmlArt in objXmlNodeList)
{
Art objArt = new Art(this);
objArt.Load(objXmlArt);
_lstArts.Add(objArt);
}
// Enhancements
objXmlNodeList = objXmlDocument.SelectNodes("/character/enhancements/enhancement");
foreach (XmlNode objXmlEnhancement in objXmlNodeList)
{
Enhancement objEnhancement = new Enhancement(this);
objEnhancement.Load(objXmlEnhancement);
_lstEnhancements.Add(objEnhancement);
}
// Critter Powers.
objXmlNodeList = objXmlDocument.SelectNodes("/character/critterpowers/critterpower");
foreach (XmlNode objXmlPower in objXmlNodeList)
{
CritterPower objPower = new CritterPower(this);
objPower.Load(objXmlPower);
_lstCritterPowers.Add(objPower);
}
// Initiation Grades.
objXmlNodeList = objXmlDocument.SelectNodes("/character/initiationgrades/initiationgrade");
foreach (XmlNode objXmlGrade in objXmlNodeList)
{
InitiationGrade objGrade = new InitiationGrade(this);
objGrade.Load(objXmlGrade);
_lstInitiationGrades.Add(objGrade);
}
// Expense Log Entries.
XmlNodeList objXmlExpenseList = objXmlDocument.SelectNodes("/character/expenses/expense");
foreach (XmlNode objXmlExpense in objXmlExpenseList)
{
ExpenseLogEntry objExpenseLogEntry = new ExpenseLogEntry();
objExpenseLogEntry.Load(objXmlExpense);
_lstExpenseLog.Add(objExpenseLogEntry);
}
// Locations.
XmlNodeList objXmlLocationList = objXmlDocument.SelectNodes("/character/locations/location");
foreach (XmlNode objXmlLocation in objXmlLocationList)
{
_lstLocations.Add(objXmlLocation.InnerText);
}
// Armor Bundles.
XmlNodeList objXmlBundleList = objXmlDocument.SelectNodes("/character/armorbundles/armorbundle");
foreach (XmlNode objXmlBundle in objXmlBundleList)
开发者ID:ercflemng,项目名称:chummer5a,代码行数:67,代码来源:clsCharacter.cs
示例5: ProcessBonus
//.........这里部分代码省略.........
lstValue.Add(new KeyValuePair<string, string>(strQuality,strForcedValue));
}
frmPickPower.LimitToList(lstValue);
// Check to see if there is only one possible selection because of _strLimitSelection.
if (_strForcedValue != "")
_strLimitSelection = _strForcedValue;
Log.Info( "_strForcedValue = " + _strForcedValue);
Log.Info( "_strLimitSelection = " + _strLimitSelection);
if (_strLimitSelection != "")
{
frmPickPower.SinglePower(_strLimitSelection);
frmPickPower.Opacity = 0;
}
frmPickPower.ShowDialog();
// Make sure the dialogue window was not canceled.
if (frmPickPower.DialogResult == DialogResult.Cancel)
{
Rollback();
_strForcedValue = "";
_strLimitSelection = "";
return false;
}
_strSelectedValue = frmPickPower.SelectedPower;
// Record the improvement.
XmlDocument objXmlDocument = XmlManager.Instance.Load("critterpowers.xml");
XmlNode objXmlPowerNode = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + _strSelectedValue + "\"]");
TreeNode objPowerNode = new TreeNode();
CritterPower objPower = new CritterPower(_objCharacter);
objPower.Create(objXmlPowerNode, _objCharacter, objPowerNode, 0, strForcedValue);
_objCharacter.CritterPowers.Add(objPower);
}
if (bonusNode.LocalName == "publicawareness")
{
CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.PublicAwareness, strUnique, ValueToInt(bonusNode.InnerText,1));
}
if (bonusNode.LocalName == "dealerconnection")
{
Log.Info("dealerconnection");
frmSelectItem frmPickItem = new frmSelectItem();
List<ListItem> lstItems = new List<ListItem>();
XmlNodeList objXmlList = bonusNode.SelectNodes("category");
foreach (XmlNode objNode in objXmlList)
{
ListItem objItem = new ListItem();
objItem.Value = objNode.InnerText;
objItem.Name = objNode.InnerText;
lstItems.Add(objItem);
}
frmPickItem.GeneralItems = lstItems;
frmPickItem.AllowAutoSelect = false;
frmPickItem.ShowDialog();
// Make sure the dialogue window was not canceled.
if (frmPickItem.DialogResult == DialogResult.Cancel)
{
Rollback();
_strForcedValue = "";
_strLimitSelection = "";
开发者ID:Rockzo,项目名称:chummer5a,代码行数:67,代码来源:clsImprovement.cs
示例6: cmdAddQuality_Click
//.........这里部分代码省略.........
if (blnAddQuality)
{
TreeNode objAddQualityNode = new TreeNode();
List<Weapon> objAddWeapons = new List<Weapon>();
List<TreeNode> objAddWeaponNodes = new List<TreeNode>();
Quality objAddQuality = new Quality(_objCharacter);
objAddQuality.Create(objXmlSelectedQuality, _objCharacter, QualitySource.Selected, objAddQualityNode, objAddWeapons, objAddWeaponNodes, strForceValue);
objNode.Nodes.Add(objAddQualityNode);
objNode.Expand();
_objCharacter.Qualities.Add(objAddQuality);
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objAddWeapons)
_objCharacter.Weapons.Add(objWeapon);
// Create the Weapon Node if one exists.
foreach (TreeNode objWeaponNode in objAddWeaponNodes)
{
objWeaponNode.ContextMenuStrip = cmsWeapon;
treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
treWeapons.Nodes[0].Expand();
}
}
}
}
// Add any Critter Powers that are gained through the Quality (Infected).
if (objXmlQuality.SelectNodes("powers/power").Count > 0)
{
objXmlDocument = XmlManager.Instance.Load("critterpowers.xml");
foreach (XmlNode objXmlPower in objXmlQuality.SelectNodes("powers/power"))
{
XmlNode objXmlCritterPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + objXmlPower.InnerText + "\"]");
TreeNode objPowerNode = new TreeNode();
CritterPower objPower = new CritterPower(_objCharacter);
string strForcedValue = "";
int intRating = 0;
if (objXmlPower.Attributes["rating"] != null)
intRating = Convert.ToInt32(objXmlPower.Attributes["rating"].InnerText);
if (objXmlPower.Attributes["select"] != null)
strForcedValue = objXmlPower.Attributes["select"].InnerText;
objPower.Create(objXmlCritterPower, _objCharacter, objPowerNode, intRating, strForcedValue);
_objCharacter.CritterPowers.Add(objPower);
if (objPower.Category != "Weakness")
{
treCritterPowers.Nodes[0].Nodes.Add(objPowerNode);
treCritterPowers.Nodes[0].Expand();
}
else
{
treCritterPowers.Nodes[1].Nodes.Add(objPowerNode);
treCritterPowers.Nodes[1].Expand();
}
}
}
}
else
{
// Remove the Improvements created by the Create method.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Quality, objQuality.InternalId);
}
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:66,代码来源:frmCareer.cs
示例7: cmdAddCritterPower_Click
private void cmdAddCritterPower_Click(object sender, EventArgs e)
{
// Make sure the Critter is allowed to have Optional Powers.
XmlDocument objXmlDocument = XmlManager.Instance.Load("critters.xml");
XmlNode objXmlCritter = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]");
if (objXmlCritter == null)
{
objXmlDocument = XmlManager.Instance.Load("metatypes.xml");
objXmlCritter = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]");
}
frmSelectCritterPower frmPickCritterPower = new frmSelectCritterPower(_objCharacter);
frmPickCritterPower.ShowDialog(this);
if (frmPickCritterPower.DialogResult == DialogResult.Cancel)
return;
objXmlDocument = XmlManager.Instance.Load("critterpowers.xml");
XmlNode objXmlPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + frmPickCritterPower.SelectedPower + "\"]");
TreeNode objNode = new TreeNode();
CritterPower objPower = new CritterPower(_objCharacter);
objPower.Create(objXmlPower, _objCharacter, objNode, frmPickCritterPower.SelectedRating);
objPower.PowerPoints = frmPickCritterPower.PowerPoints;
objNode.ContextMenuStrip = cmsCritterPowers;
if (objPower.InternalId == Guid.Empty.ToString())
return;
_objCharacter.CritterPowers.Add(objPower);
if (objPower.Category != "Weakness")
{
treCritterPowers.Nodes[0].Nodes.Add(objNode);
treCritterPowers.Nodes[0].Expand();
}
else
{
treCritterPowers.Nodes[1].Nodes.Add(objNode);
treCritterPowers.Nodes[1].Expand();
}
// Determine if the Critter should have access to the Possession menu item.
bool blnAllowPossession = false;
foreach (CritterPower objCritterPower in _objCharacter.CritterPowers)
{
if (objCritterPower.Name == "Inhabitation" || objCritterPower.Name == "Possession")
{
blnAllowPossession = true;
break;
}
}
mnuSpecialPossess.Visible = blnAllowPossession;
_objFunctions.SortTree(treCritterPowers);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
if (frmPickCritterPower.AddAgain)
cmdAddCritterPower_Click(sender, e);
}
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:62,代码来源:frmCareer.cs
示例8: Load
//.........这里部分代码省略.........
OperatingSystem objOperatingSystem = new OperatingSystem(this);
objOperatingSystem.Load(objXmlGear);
_lstGear.Add(objOperatingSystem);
break;
default:
Gear objGear = new Gear(this);
objGear.Load(objXmlGear);
_lstGear.Add(objGear);
break;
}
}
// Vehicles.
objXmlNodeList = objXmlDocument.SelectNodes("/character/vehicles/vehicle");
foreach (XmlNode objXmlVehicle in objXmlNodeList)
{
Vehicle objVehicle = new Vehicle(this);
objVehicle.Load(objXmlVehicle);
_lstVehicles.Add(objVehicle);
}
// Metamagics/Echoes.
objXmlNodeList = objXmlDocument.SelectNodes("/character/metamagics/metamagic");
foreach (XmlNode objXmlMetamagic in objXmlNodeList)
{
Metamagic objMetamagic = new Metamagic(this);
objMetamagic.Load(objXmlMetamagic);
_lstMetamagics.Add(objMetamagic);
}
// Critter Powers.
objXmlNodeList = objXmlDocument.SelectNodes("/character/critterpowers/critterpower");
foreach (XmlNode objXmlPower in objXmlNodeList)
{
CritterPower objPower = new CritterPower(this);
objPower.Load(objXmlPower);
_lstCritterPowers.Add(objPower);
}
// Initiation Grades.
objXmlNodeList = objXmlDocument.SelectNodes("/character/initiationgrades/initiationgrade");
foreach (XmlNode objXmlGrade in objXmlNodeList)
{
InitiationGrade objGrade = new InitiationGrade(this);
objGrade.Load(objXmlGrade);
_lstInitiationGrades.Add(objGrade);
}
// Expense Log Entries.
XmlNodeList objXmlExpenseList = objXmlDocument.SelectNodes("/character/expenses/expense");
foreach (XmlNode objXmlExpense in objXmlExpenseList)
{
ExpenseLogEntry objExpenseLogEntry = new ExpenseLogEntry();
objExpenseLogEntry.Load(objXmlExpense);
_lstExpenseLog.Add(objExpenseLogEntry);
}
// Locations.
XmlNodeList objXmlLocationList = objXmlDocument.SelectNodes("/character/locations/location");
foreach (XmlNode objXmlLocation in objXmlLocationList)
{
_lstLocations.Add(objXmlLocation.InnerText);
}
// Armor Bundles.
XmlNodeList objXmlBundleList = objXmlDocument.SelectNodes("/character/armorbundles/armorbundle");
foreach (XmlNode objXmlBundle in objXmlBundleList)
{
_lstArmorBundles.Add(objXmlBundle.InnerText);
}
// Weapon Locations.
XmlNodeList objXmlWeaponLocationList = objXmlDocument.SelectNodes("/character/weaponlocations/weaponlocation");
foreach (XmlNode objXmlLocation in objXmlWeaponLocationList)
{
_lstWeaponLocations.Add(objXmlLocation.InnerText);
}
// Improvement Groups.
XmlNodeList objXmlGroupList = objXmlDocument.SelectNodes("/character/improvementgroups/improvementgroup");
foreach (XmlNode objXmlGroup in objXmlGroupList)
{
_lstImprovementGroups.Add(objXmlGroup.InnerText);
}
// Calendar.
XmlNodeList objXmlWeekList = objXmlDocument.SelectNodes("/character/calendar/week");
foreach (XmlNode objXmlWeek in objXmlWeekList)
{
CalendarWeek objWeek = new CalendarWeek();
objWeek.Load(objXmlWeek);
_lstCalendar.Add(objWeek);
}
// If the character had old Qualities that were converted, immediately save the file so they are in the new format.
if (blnHasOldQualities)
Save();
return true;
}
开发者ID:Nebual,项目名称:chummer,代码行数:101,代码来源:clsCharacter.cs
示例9: mnuSpecialPossessInanimate_Click
//.........这里部分代码省略.........
if (objMerge.AGI.Value < 1)
objMerge.AGI.Value = 1;
objMerge.REA.MetatypeMinimum += intREA;
if (objMerge.REA.MetatypeMinimum < 1)
objMerge.REA.MetatypeMinimum = 1;
objMerge.REA.MetatypeMaximum += intREA;
if (objMerge.REA.MetatypeMaximum < 1)
objMerge.REA.MetatypeMaximum = 1;
objMerge.REA.Value = intSetREA;
if (objMerge.REA.Value < 1)
objMerge.REA.Value = 1;
objMerge.STR.MetatypeMinimum += intSTR;
if (objMerge.STR.MetatypeMinimum < 1)
objMerge.STR.MetatypeMinimum = 1;
objMerge.STR.MetatypeMaximum += intSTR;
if (objMerge.STR.MetatypeMaximum < 1)
objMerge.STR.MetatypeMaximum = 1;
objMerge.STR.Value = intSetSTR;
if (objMerge.STR.Value < 1)
objMerge.STR.Value = 1;
// Update the Movement if the Vessel has one.
if (objSelected["movement"] != null)
objMerge.Movement = objSelected["movement"].InnerText;
// Add any additional Critter Powers the Vessel grants.
if (objSelected["powers"] != null)
{
XmlDocument objXmlPowerDoc = XmlManager.Instance.Load("critterpowers.xml");
foreach (XmlNode objXmlPower in objSelected.SelectNodes("powers/power"))
{
XmlNode objXmlCritterPower = objXmlPowerDoc.SelectSingleNode("/chummer/powers/power[name = \"" + objXmlPower.InnerText + "\"]");
CritterPower objPower = new CritterPower(objMerge);
string strSelect = "";
int intRating = 0;
if (objXmlPower.Attributes["select"] != null)
strSelect = objXmlPower.Attributes["select"].InnerText;
if (objXmlPower.Attributes["rating"] != null)
intRating = Convert.ToInt32(objXmlPower.Attributes["rating"].InnerText);
TreeNode objDummy = new TreeNode();
objPower.Create(objXmlCritterPower, objMerge, objDummy, intRating, strSelect);
objMerge.CritterPowers.Add(objPower);
}
}
// Give the Critter the Immunity to Normal Weapons Power if they don't already have it.
bool blnHasImmunity = false;
foreach (CritterPower objCritterPower in objMerge.CritterPowers)
{
if (objCritterPower.Name == "Immunity" && objCritterPower.Extra == "Normal Weapons")
{
blnHasImmunity = true;
break;
}
}
if (!blnHasImmunity)
{
XmlDocument objPowerDoc = new XmlDocument();
objPowerDoc = XmlManager.Instance.Load("critterpowers.xml");
XmlNode objPower = objPowerDoc.SelectSingleNode("/chummer/powers/power[name = \"Immunity\"]");
CritterPower objCritterPower = new CritterPower(objMerge);
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:67,代码来源:frmCareer.cs
示例10: mnuSpecialCyberzombie_Click
private void mnuSpecialCyberzombie_Click(object sender, EventArgs e)
{
bool blnEssence = true;
bool blnCyberware = false;
string strMessage = LanguageManager.Instance.GetString("Message_CyberzombieRequirements");
// Make sure the character has an Essence lower than 0.
if (_objCharacter.Essence >= 0)
{
strMessage += "\n\t" + LanguageManager.Instance.GetString("Message_CyberzombieRequirementsEssence");
blnEssence = false;
}
// Make sure the character has an Invoked Memory Stimulator.
foreach (Cyberware objCyberware in _objCharacter.Cyberware)
{
if (objCyberware.Name == "Invoked Memory Stimulator")
blnCyberware = true;
}
if (!blnCyberware)
strMessage += "\n\t" + LanguageManager.Instance.GetString("Message_CyberzombieRequirementsStimulator");
if (!blnEssence || !blnCyberware)
{
MessageBox.Show(strMessage, LanguageManager.Instance.GetString("MessageTitle_CyberzombieRequirements"), MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (MessageBox.Show(LanguageManager.Instance.GetString("Message_CyberzombieConfirm"), LanguageManager.Instance.GetString("MessageTitle_CyberzombieConfirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return;
// Convert the character.
// Characters lose access to Resonance.
_objCharacter.RESEnabled = false;
// Gain MAG that is permanently set to 1.
_objCharacter.MAGEnabled = true;
_objCharacter.MAG.MetatypeMinimum = 1;
_objCharacter.MAG.MetatypeMaximum = 1;
_objCharacter.MAG.Value = 1;
// Add the Cyberzombie Lifestyle if it is not already taken.
bool blnHasLifestyle = false;
foreach (Lifestyle objLifestyle in _objCharacter.Lifestyles)
{
if (objLifestyle.Name == "Cyberzombie Lifestyle Addition")
blnHasLifestyle = true;
}
if (!blnHasLifestyle)
{
XmlDocument objXmlLifestyleDocument = XmlManager.Instance.Load("lifestyles.xml");
XmlNode objXmlLifestyle = objXmlLifestyleDocument.SelectSingleNode("/chummer/lifestyles/lifestyle[name = \"Cyberzombie Lifestyle Addition\"]");
TreeNode objLifestyleNode = new TreeNode();
Lifestyle objLifestyle = new Lifestyle(_objCharacter);
objLifestyle.Create(objXmlLifestyle, objLifestyleNode);
_objCharacter.Lifestyles.Add(objLifestyle);
treLifestyles.Nodes[0].Nodes.Add(objLifestyleNode);
treLifestyles.Nodes[0].Expand();
}
// Change the MetatypeCategory to Cyberzombie.
_objCharacter.MetatypeCategory = "Cyberzombie";
// Gain access to Critter Powers.
_objCharacter.CritterEnabled = true;
// Gain the Dual Natured Critter Power if it does not yet exist.
bool blnHasPower = false;
foreach (CritterPower objPower in _objCharacter.CritterPowers)
{
if (objPower.Name == "Dual Natured")
blnHasPower = true;
}
if (!blnHasPower)
{
XmlDocument objXmlPowerDocument = XmlManager.Instance.Load("critterpowers.xml");
XmlNode objXmlPowerNode = objXmlPowerDocument.SelectSingleNode("/chummer/powers/power[name = \"Dual Natured\"]");
TreeNode objNode = new TreeNode();
CritterPower objCritterPower = new CritterPower(_objCharacter);
objCritterPower.Create(objXmlPowerNode, _objCharacter, objNode);
_objCharacter.CritterPowers.Add(objCritterPower);
treCritterPowers.Nodes[0].Nodes.Add(objNode);
treCritterPowers.Nodes[0].Expand();
}
// Gain the Immunity (Normal Weapons) Critter Power if it does not yet exist.
blnHasPower = false;
foreach (CritterPower objPower in _objCharacter.CritterPowers)
{
if (objPower.Name == "Immunity" && objPower.Extra == "Normal Weapons")
blnHasPower = true;
}
if (!blnHasPower)
{
XmlDocument objXmlPowerDocument = XmlManager.Instance.Load("critterpowers.xml");
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs
示例11: CreateCritter
//.........这里部分代码省略.........
// 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 = "";
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);
// Add any created Weapons to the character.
foreach (Weapon objWeapon in objWeapons)
objCharacter.Weapons.Add(objWeapon);
}
// Add any Critter Powers the Metatype/Critter should have.
XmlNode objXmlCritter = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + objCharacter.Metatype + "\"]");
objXmlDocument = XmlManager.Instance.Load("critterpowers.xml");
foreach (XmlNode objXmlPower in objXmlCritter.SelectNodes("powers/power"))
{
XmlNode objXmlCritterPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + objXmlPower.InnerText + "\"]");
TreeNode objNode = new TreeNode();
CritterPower objPower = new CritterPower(objCharacter);
string strForcedValue = "";
int intRating = 0;
if (objXmlPower.Attributes["rating"] != null)
intRating = Convert.ToInt32(objXmlPower.Attributes["rating"].InnerText);
if (objXmlPower.Attributes["select"] != null)
strForcedValue = objXmlPower.Attributes["select"].InnerText;
objPower.Create(objXmlCritterPower, objCharacter, objNode, intRating, strForcedValue);
objCharacter.CritterPowers.Add(objPower);
}
// Set the Skill Ratings for the Critter.
foreach (XmlNode objXmlSkill in objXmlCritter.SelectNodes("skills/skill"))
{
if (objXmlSkill.InnerText.Contains("Exotic"))
{
Skill objExotic = new Skill(objCharacter);
objExotic.ExoticSkill = true;
objExotic.Attribute = "AGI";
if (objXmlSkill.Attributes["spec"] != null)
{
SkillSpecialization objSpec = new SkillSpecialization(objXmlSkill.Attributes["spec"].InnerText);
objExotic.Specializations.Add(objSpec);
}
if (Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0)) > 6)
objExotic.RatingMaximum = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0));
objExotic.Rating = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(nudForce.Value), 0));
objExotic.Name = objXmlSkill.InnerText;
objCharacter.Skills.Add(objExotic);
开发者ID:kingcortez905,项目名称:chummer5,代码行数:67,代码来源:SpiritControl.cs
示例12: MetatypeSelected
//.........这里部分代码省略.........
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);
}
}
// Run through the character's Attributes one more time and make sure their value matches their minimum value.
if (_strXmlFile == "metatypes.xml")
{
_objCharacter.BOD.Value = _objCharacter.BOD.TotalMinimum;
_objCharacter.AGI.Value = _objCharacter.AGI.TotalMinimum;
_objCharacter.REA.Value = _objCharacter.REA.TotalMinimum;
_objCharacter.STR.Value = _objCharacter.STR.TotalMinimum;
_objCharacter.CHA.Value = _objCharacter.CHA.TotalMinimum;
_objCharacter.INT.Value = _objCharacter.INT.TotalMinimum;
_objCharacter.LOG.Value = _objCharacter.LOG.TotalMinimum;
_objCharacter.WIL.Value = _objCharacter.WIL.TotalMinimum;
}
// Add any Critter Powers the Metatype/Critter should have.
XmlNode objXmlCritter = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]");
objXmlDocument = XmlManager.Instance.Load("critterpowers.xml");
foreach (XmlNode objXmlPower in objXmlCritter.SelectNodes("powers/power"))
{
XmlNode objXmlCritterPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + objXmlPower.InnerText + "\"]");
TreeNode objNode = new TreeNode();
CritterPower objPower = new CritterPower(_objCharacter);
string strForcedValue = "";
int intRating = 0;
if (objXmlPower.Attributes["rating"] != null)
intRating = Convert.ToInt32(objXmlPower.Attributes["rating"].InnerText);
if (objXmlPower.Attributes["select"] != null)
strForcedValue = objXmlPower.Attributes["select"].InnerText;
objPower.Create(objXmlCritterPower, _objCharacter, objNode, intRating, strForcedValue);
objPower.CountTowardsLimit = false;
_objCharacter.CritterPowers.Add(objPower);
}
// Add any Critter Powers the Metavariant should have.
if (cboMetavariant.SelectedValue.ToString() != "None")
{
foreach (XmlNode objXmlPower in objXmlMetavariant.SelectNodes("powers/power"))
{
XmlNode objXmlCritterPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + objXmlPower.InnerText + "\"]");
TreeNode objNode = new TreeNode();
CritterPower objPower = new CritterPower(_objCharacter);
string strForcedValue = "";
int intRating = 0;
if (objXmlPower.Attributes["rating"] != null)
intRating = Convert.ToInt32(objXmlPower.Attributes["rating"].InnerText);
if (objXmlPower.Attributes["select"] != null)
strForcedValue = objXmlPower.Attributes["select"].InnerText;
objPower.Create(objXmlCritterPower, _objCharacter, objNode, intRating, strForcedValue);
开发者ID:Nitsuj83,项目名称:chummer5a,代码行数:67,代码来源:frmKarmaMetatype.cs
示例13: TestMetatype
//.........这里部分代码省略.........
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);
}
// Run through the character's Attributes one more time and make sure their value matches their minimum value.
if (strFile == "metatypes.xml")
{
_objCharacter.BOD.Value = _objCharacter.BOD.TotalMinimum;
_objCharacter.AGI.Value = _objCharacter.AGI.TotalMinimum;
_objCharacter.REA.Value = _objCharacter.REA.TotalMinimum;
_objCharacter.STR.Value = _objCharacter.STR.TotalMinimum;
_objCharacter.CHA.Value = _objCharacter.CHA.TotalMinimum;
_objCharacter.INT.Value = _objCharacter.INT.TotalMinimum;
_objCharacter.LOG.Value = _objCharacter.LOG.TotalMinimum;
_objCharacter.WIL.Value = _objCharacter.WIL.TotalMinimum;
}
// Add any Critter Powers the Metatype/Critter should have.
XmlNode objXmlCritter = objXmlDocument.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + _objCharacter.Metatype + "\"]");
objXmlDocument = XmlManager.Instance.Load("critterpowers.xml");
foreach (XmlNode objXmlPower in objXmlCritter.SelectNodes("powers/power"))
{
XmlNode objXmlCritterPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + objXmlPower.InnerText + "\"]");
TreeNode objNode = new TreeNode();
CritterPower objPower = new CritterPower(_objCharacter);
string strForcedValue = "";
int intRating = 0;
if (objXmlPower.Attributes["rating"] != null)
intRating = Convert.ToInt32(objXmlPower.Attributes["rating"].InnerText);
if (objXmlPower.Attributes["select"] != null)
strForcedValue = objXmlPower.Attributes["select"].InnerText;
objPower.Create(objXmlCritterPower, _objCharacter, objNode, intRating, strForcedValue);
_objCharacter.CritterPowers.Add(objPower);
}
// Set the Skill Ratings for the Critter.
foreach (XmlNode objXmlSkill in objXmlCritter.SelectNodes("skills/skill"))
{
if (objXmlSkill.InnerText.Contains("Exotic"))
{
Skill objExotic = new Skill(_objCharacter);
objExotic.ExoticSkill = true;
objExotic.Attribute = "AGI";
if (objXmlSkill.Attributes["spec"] != null)
objExotic.Specialization = objXmlSkill.Attributes["spec"].InnerText;
if (Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(intForce), 0)) > 6)
objExotic.RatingMaximum = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(intForce), 0));
objExotic.Rating = Convert.ToInt32(ExpressionToString(objXmlSkill.Attributes["rating"].InnerText, Convert.ToInt32(intForce), 0));
objExotic.Name = objXmlSkill.InnerText;
_objCharacter.Skills.Add(objExotic);
}
else
{
开发者ID:hollis21,项目名称:Chummer,
|
请发表评论