本文整理汇总了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();
}
示例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);
}
}
示例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();
}
示例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":
示例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
{
示例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();
}
示例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);
}
示例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);
}
示例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();
//.........这里部分代码省略.........
示例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);
}
}
示例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);
}
示例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;
}