public void addSpelltoSpellcaster(Spell newSpell, bool preparedSpell) { if (preparedSpell) { spellcaster.preparedSpells.Add(new PreparedSpell(newSpell)); } else { spellcaster.spellBook.Add(newSpell); } }
public LoadedSpell(Spell spell, bool load = false) { this.spellname = spell.spellname; this.spellschoolandsubschool = spell.spellschoolandsubschool; this.spelldescriptor = spell.spelldescriptor; this.spelllevel = spell.spelllevel; this.spellcomponents = spell.spellcomponents; this.spellcastingtime = spell.spellcastingtime; this.spellrange = spell.spellrange; this.spellarea = spell.spellarea; this.spelleffect = spell.spelleffect; this.spelltargets = spell.spelltargets; this.spellduration = spell.spellduration; this.spellsavingthrow = spell.spellsavingthrow; this.spellresistance = spell.spellresistance; this.spelldescription = spell.spelldescription; this.loadspell = load; }
private void addSpellButton_Click(object sender, EventArgs e) { if (this.spellNameBox.Text == String.Empty) { MessageBox.Show("Error: spell name field must not be empty", "No Spell Name Given", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Spell newSpell = new Spell(this.spellNameBox.Text); newSpell.spellschoolandsubschool = this.spellSchoolBox.Text; newSpell.spelldescriptor = this.spellDescriptorBox.Text; newSpell.spelllevel = this.spellLevelTypeBox.Text + " " + this.spellLevelNumberBox.Text; foreach (object item in this.spellComponentsBox.CheckedItems) { newSpell.spellcomponents += item.ToString() + ", "; } if (newSpell.spellcomponents != null) { newSpell.spellcomponents = newSpell.spellcomponents.TrimEnd(' '); newSpell.spellcomponents = newSpell.spellcomponents.TrimEnd(','); } newSpell.spellcastingtime = this.spellCastingTimeBox.Text; newSpell.spellrange = this.spellRangeBox.Text; newSpell.spellarea = this.spellAreaBox.Text; newSpell.spelleffect = this.spellEffectBox.Text; newSpell.spelltargets = this.spellTargetsBox.Text; newSpell.spellduration = this.spellDurationBox.Text; newSpell.spellsavingthrow = this.spellSavingThrowBox.Text; newSpell.spellresistance = this.spellResistanceBox.Text; newSpell.spelldescription = this.spellDescriptionBox.Text; parentForm.addSpelltoSpellcaster(newSpell, false); this.Close(); }