//============================================================================================================ //============================================================================================================ #region Event Methods private void buttonAddAbility_Click(object sender, EventArgs e) { AbilityForm af = new AbilityForm(character); var result = af.ShowDialog(); if (result == DialogResult.OK) { character.addAbility(af.ability); af.ability.PropertyChanged += Ability_PropertyChanged; refreshListBoxes(); } }
private void commandOK_Click(object sender, EventArgs e) { //Get selected abilities var abilities = getSelectedAbilities(); //TODO Cloaking optons aren't compatible with one another, armor is compatible with fly but its price can be changed by it, etc. //Make sure the chosen abilities are compatible. if (!checkAbilitiesCompatible(abilities)) { return; } //Make sure the chosen abilities are valid. //TODO Not sure if I'll be doing validation on abilities. //foreach (SpecialRule rule in rules) if (!rule.specialRuleIsValid(ability, rules)) return; //TODO I elected not to do armor, the only common ability with parameters. If I decide to do it again, I'll bring this back. //After confirming all selected abilities are compatible, cycle through those with parameters and have the user provide them. //foreach (Ability ability in abilities) //{ // if (ability.Variables.Count == 0) continue; // AbilityParameterForm pform = new AbilityParameterForm(ability); // pform.ShowDialog(); //} //TODO Need to add the abilities to the character foreach (Ability ability in abilities) { character.addAbility(ability); } this.DialogResult = DialogResult.OK; this.Dispose(); }