private void list_spells_SelectedIndexChanged(object sender, EventArgs e) { spell = MageSpellList.spell_list[cb_spell_order.SelectedIndex][list_spells.SelectedIndex]; System.Globalization.TextInfo cap = new System.Globalization.CultureInfo("en-US", false).TextInfo; lbl_spell_name.Text = spell.name; lbl_spell_duration.Text = String.Format("Duration: {0}", spell.duration); lbl_spell_cost.Text = String.Format("Cost: {0}", spell.cost.ToString()); lbl_spell_covert.Text = (spell.vulgar == true) ? "Vulgar" : "Covert"; lbl_spell_action.Text = (spell.extended == true) ? "Extended" : "Instant"; lbl_spell_dp.Text = String.Format("Dicepool:\n{0} + {1} + {2}\nTotal: {3}", cap.ToTitleCase(spell.attribute), cap.ToTitleCase(spell.skill), Enum.GetName(typeof(Arcana), cb_spell_order.SelectedIndex), (int)character.GetValue(spell.attribute) + character.skill_list[spell.skill.ToLower()].rank + character.mage.arcana[cb_spell_order.SelectedIndex]); lbl_spell_description.Text = spell.desc; }
public SpellListing(MageSpell spell, int x, int y, int dicepool = 0) { this.spell = spell; this.x = x; this.y = y; System.Globalization.TextInfo cap = new System.Globalization.CultureInfo("en-US", false).TextInfo; lbl_name = new Label(); lbl_name.SetBounds(this.x, this.y, width, height); lbl_name.Text = spell.name; lbl_dicepool = new Label(); lbl_dicepool.SetBounds(this.x, this.y+16, width, height); lbl_dicepool.Text = String.Format("{0}+{1}+{2}: {3}", cap.ToTitleCase(spell.attribute), cap.ToTitleCase(spell.skill), Enum.GetName(typeof(Arcana), (int)spell.arcana), dicepool); lbl_description = new Label(); lbl_description.SetBounds(this.x, this.y+32, desc_width, desc_height); lbl_description.Text = spell.desc; }
public static void init() { spell_list = new List<MageSpell>[Enum.GetValues(typeof(Arcana)).Length]; for (int i = 0; i < spell_list.Length - 1; i++) { spell_list[i] = new List<MageSpell>(); XmlDocument file = new XmlDocument(); file.Load("Spells.xml"); foreach (XmlNode node in file.SelectNodes(String.Format("spells/{0}/spell", Enum.GetName(typeof(Arcana), i).ToLower()))) { XmlElement spell_element = (XmlElement)node; MageSpell spell = new MageSpell(); spell.name = spell_element.GetElementsByTagName("name")[0].InnerText; spell.attribute = spell_element.GetElementsByTagName("attribute")[0].InnerText; spell.skill = spell_element.GetElementsByTagName("skill")[0].InnerText; spell.cost = Convert.ToInt32(spell_element.GetElementsByTagName("cost")[0].InnerText); spell.rank = Convert.ToInt32(spell_element.GetElementsByTagName("rank")[0].InnerText); spell.duration = spell_element.GetElementsByTagName("duration")[0].InnerText; spell.vulgar = spell_element.GetElementsByTagName("vulgar").Count > 0; spell.extended = spell_element.GetElementsByTagName("extended").Count > 0; spell.arcana = (Arcana)i; if (spell_element.GetElementsByTagName("description").Count > 0) { spell.desc = spell_element.GetElementsByTagName("description")[0].InnerText; } if (spell_element.GetElementsByTagName("practice").Count > 0) { spell.practice = spell_element.GetElementsByTagName("practice")[0].InnerText; } if (spell_element.GetElementsByTagName("resist").Count > 0) { spell.resist = spell_element.GetElementsByTagName("resist")[0].InnerText; } spell_list[i].Add(spell); } } }