/// <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> /// Creates a piece of armor that's a customized version of another piece of /// armor. Any unspecified values in customization_values will default to /// the other armor's related value. /// </summary> /// <param name="other">Piece of armor used as a base to customize from.</param> /// <param name="customization_values">Armor_Values passed in to alter values of the original ("other") piece of armor.</param> public Armor(Armor other, Armor_Values customization_values) : this(other) { Customize(customization_values); }
/// <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; }
/// <summary> /// Creates an armor piece with the given name, description, and Armor_Value /// parameters. Any unestablished Armor_Value values will default to a /// specified value. /// </summary> /// <param name="name">Name to associate with the armor.</param> /// <param name="description">Short description of the armor.</param> /// <param name="armor_values">A struct holding many values associated with armor and shields in Pathfinder.</param> public Armor(string name, string description, int money_value, bool is_cursed, int weight, Armor_Values armor_values) : base(name, 1, description, money_value, is_cursed, weight) { initialize_armor_values(armor_values); armor_modification_list_p = new List<Enum_Armor_Modifications>(); shield_modification_list_p = new List<Enum_Shield_Modifications>(); }