/// <summary> /// Initializes the fields of the Armor object in accordance to the /// Armor_Values struct passed it. Any unspecified values will default /// to a pre-specified value. /// </summary> /// <param name="values">Custom values to assign to the Armor object's fields.</param> private void initialize_armor_values(Armor_Values values) { //money_value_p = (values.MoneyValue != null) ? values.MoneyValue : _DEFAULT_MONEY_VALUE; ac_p = (values.AC != null) ? values.AC : _DEFAULT_AC; max_dex_bonus_p = values.MaxDexterityBonus != null ? values.MaxDexterityBonus : _DEFAULT_MAX_DEX_BONUS; ac_check_penalty_p = values.ACCheckPenalty != null ? values.ACCheckPenalty : _DEFAULT_AC_CHECK_PENALTY; arcane_spell_failure_chance_p = values.ArcaneSpellFailureChance != null ? values.ArcaneSpellFailureChance : _DEFAULT_ARCANE_SPELL_FAILURE_CHANCE; max_speed_p = values.MaxMovementSpeed != null ? values.MaxMovementSpeed : _DEFAULT_MAX_MOVESPEED; //weight_p = values.Weight != null ? values.Weight : _DEFAULT_WEIGHT; hit_points_p = values.HitPoints != null ? values.HitPoints : _DEFAULT_HIT_POINTS; current_hp_p = hit_points_p; is_masterwork_p = values.IsMasterwork != null ? values.IsMasterwork : _DEFAULT_IS_MASTERWORK; rounds_to_don_p = values.RoundsToDon != null ? values.RoundsToDon : _DEFAULT_ROUNDS_TO_DON; rounds_to_hastily_don_p = values.RoundsToHastilyDon != null ? values.RoundsToHastilyDon : _DEFAULT_ROUNDS_TO_HASTILY_DON; rounds_to_remove_p = values.RoundsToRemove != null ? values.RoundsToRemove : _DEFAULT_ROUNDS_TO_REMOVE; armor_category_p = values.ArmorCategory != null ? values.ArmorCategory : Enum_Armor_Categories.Light_Armor; is_shield_p = values.IsShield != null ? values.IsShield : false; is_armor_p = values.IsArmor != null ? values.IsArmor : true; //is_cursed_p = values.IsCursed != null ? values.IsCursed : false; is_broken_p = values.IsBroken != null ? values.IsBroken : false; }
/// <summary> /// Customize this Armor with the given Armor_Values struct values. Any /// null values in the struct will not change this Armor's associated value. /// </summary> /// <param name="values">The Armor values to use for customizing this piece of armor.</param> public void Customize(Armor_Values values) { //money_value_p = (values.MoneyValue != null) ? values.MoneyValue : money_value_p; ac_p = (values.AC != null) ? values.AC : ac_p; max_dex_bonus_p = values.MaxDexterityBonus != null ? values.MaxDexterityBonus : max_dex_bonus_p; ac_check_penalty_p = values.ACCheckPenalty != null ? values.ACCheckPenalty : ac_check_penalty_p; arcane_spell_failure_chance_p = values.ArcaneSpellFailureChance != null ? values.ArcaneSpellFailureChance : arcane_spell_failure_chance_p; max_speed_p = values.MaxMovementSpeed != null ? values.MaxMovementSpeed : max_speed_p; //weight_p = values.Weight != null ? values.Weight : weight_p; hit_points_p = values.HitPoints != null ? values.HitPoints : hit_points_p; if(current_hp_p >= hit_points_p){ current_hp_p = hit_points_p; } else{ current_hp_p = (int)((double)current_hp_p / hit_points_p); } if (current_hp_p * 2 <= hit_points_p) { Break(); } is_masterwork_p = values.IsMasterwork != null ? values.IsMasterwork : is_masterwork_p; rounds_to_don_p = values.RoundsToDon != null ? values.RoundsToDon : rounds_to_don_p; rounds_to_hastily_don_p = values.RoundsToHastilyDon != null ? values.RoundsToHastilyDon : rounds_to_hastily_don_p; rounds_to_remove_p = values.RoundsToRemove != null ? values.RoundsToRemove : rounds_to_remove_p; armor_category_p = values.ArmorCategory != null ? values.ArmorCategory : armor_category_p; //is_cursed_p = values.IsCursed != null ? values.IsCursed : is_cursed_p; is_broken_p = values.IsBroken != null ? values.IsBroken : is_broken_p; is_armor_p = values.IsArmor != null ? values.IsArmor : is_armor_p; is_shield_p = values.IsShield != null ? values.IsShield : is_shield_p; }