use old method highest and lowest("value").first and limit to [leadership]
in hope what est validated
This commit is contained in:
parent
fcd0c02c8d
commit
f6c9561149
3 changed files with 9 additions and 33 deletions
|
@ -221,13 +221,13 @@ battle_context_unit_stats::battle_context_unit_stats(nonempty_unit_const_ptr up,
|
|||
if(drains) {
|
||||
unit_ability_list drain_specials = weapon->get_specials_and_abilities("drains");
|
||||
// Compute the drain percent (with 50% as the base for backward compatibility)
|
||||
unit_abilities::effect drain_percent_effects(drain_specials, 50, backstab_pos, weapon, true);
|
||||
unit_abilities::effect drain_percent_effects(drain_specials, 50, backstab_pos, weapon);
|
||||
drain_percent = drain_percent_effects.get_composite_value();
|
||||
}
|
||||
|
||||
// Add heal_on_hit (the drain constant)
|
||||
unit_ability_list heal_on_hit_specials = weapon->get_specials_and_abilities("heal_on_hit");
|
||||
unit_abilities::effect heal_on_hit_effects(heal_on_hit_specials, 0, backstab_pos, weapon, true);
|
||||
unit_abilities::effect heal_on_hit_effects(heal_on_hit_specials, 0, backstab_pos, weapon);
|
||||
drain_constant += heal_on_hit_effects.get_composite_value();
|
||||
|
||||
drains = drain_constant || drain_percent;
|
||||
|
@ -344,13 +344,13 @@ battle_context_unit_stats::battle_context_unit_stats(const unit_type* u_type,
|
|||
unit_ability_list drain_specials = weapon->get_specials("drains");
|
||||
|
||||
// Compute the drain percent (with 50% as the base for backward compatibility)
|
||||
unit_abilities::effect drain_percent_effects(drain_specials, 50, backstab_pos, weapon, true);
|
||||
unit_abilities::effect drain_percent_effects(drain_specials, 50, backstab_pos, weapon);
|
||||
drain_percent = drain_percent_effects.get_composite_value();
|
||||
}
|
||||
|
||||
// Add heal_on_hit (the drain constant)
|
||||
unit_ability_list heal_on_hit_specials = weapon->get_specials("heal_on_hit");
|
||||
unit_abilities::effect heal_on_hit_effects(heal_on_hit_specials, 0, backstab_pos, weapon, true);
|
||||
unit_abilities::effect heal_on_hit_effects(heal_on_hit_specials, 0, backstab_pos, weapon);
|
||||
drain_constant += heal_on_hit_effects.get_composite_value();
|
||||
|
||||
drains = drain_constant || drain_percent;
|
||||
|
|
|
@ -193,7 +193,7 @@ namespace {
|
|||
|
||||
// Regeneration?
|
||||
unit_ability_list regen_list = patient.get_abilities("regenerate");
|
||||
unit_abilities::effect regen_effect(regen_list, 0, false, nullptr, true);
|
||||
unit_abilities::effect regen_effect(regen_list, 0, false);
|
||||
update_healing(healing, harming, regen_effect.get_composite_value());
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ namespace {
|
|||
}
|
||||
|
||||
// Now we can get the aggregate healing amount.
|
||||
unit_abilities::effect heal_effect(heal_list, 0, false, nullptr, true);
|
||||
unit_abilities::effect heal_effect(heal_list, 0, false);
|
||||
if ( update_healing(healing, harming, heal_effect.get_composite_value()) )
|
||||
{
|
||||
// Collect the healers involved.
|
||||
|
|
|
@ -1747,7 +1747,7 @@ effect::effect(const unit_ability_list& list, int def, bool backstab, const_atta
|
|||
composite_value_(0)
|
||||
{
|
||||
|
||||
int value_set = def;
|
||||
int value_set = is_cumulable ? std::max(list.highest("value").first, 0) + std::min(list.lowest("value").first, 0) : def;
|
||||
std::map<std::string,individual_effect> values_add;
|
||||
std::map<std::string,individual_effect> values_mul;
|
||||
std::map<std::string,individual_effect> values_div;
|
||||
|
@ -1768,7 +1768,7 @@ effect::effect(const unit_ability_list& list, int def, bool backstab, const_atta
|
|||
if (!filter_base_matches(cfg, def))
|
||||
continue;
|
||||
|
||||
if(!is_cumulable || !cfg["cumulative"].to_bool()){
|
||||
if(!is_cumulable){
|
||||
if (const config::attribute_value *v = cfg.get("value")) {
|
||||
int value = get_single_ability_value(*v, def, ability, list.loc(), att, [&](const wfl::formula& formula, wfl::map_formula_callable& callable) {
|
||||
callable.add("base_value", wfl::variant(def));
|
||||
|
@ -1790,30 +1790,6 @@ effect::effect(const unit_ability_list& list, int def, bool backstab, const_atta
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (const config::attribute_value *v = cfg.get("value")) {
|
||||
int value = get_single_ability_value(*v, def, ability, list.loc(), att, [&](const wfl::formula& formula, wfl::map_formula_callable& callable) {
|
||||
callable.add("base_value", wfl::variant(def));
|
||||
return formula.evaluate(callable).as_int();
|
||||
});
|
||||
std::map<std::string,individual_effect>::iterator value_effect = values_add.find(effect_id);
|
||||
if(value>=0){
|
||||
if(value_effect == values_add.end() || (value > value_effect->second.value && value_effect->second.value>=0)) {
|
||||
values_add[effect_id].set(ADD, value, ability.ability_cfg, ability.teacher_loc);
|
||||
}
|
||||
else if(value_effect == values_add.end() || (value > value_effect->second.value && value_effect->second.value<0)) {
|
||||
values_add[effect_id].set(ADD, (value+value_effect->second.value), ability.ability_cfg, ability.teacher_loc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(value_effect == values_add.end() || (value < value_effect->second.value && value_effect->second.value<=0)) {
|
||||
values_add[effect_id].set(ADD, value, ability.ability_cfg, ability.teacher_loc);
|
||||
}
|
||||
else if(value_effect == values_add.end() || (value < value_effect->second.value && value_effect->second.value>0)) {
|
||||
values_add[effect_id].set(ADD, (value+value_effect->second.value), ability.ability_cfg, ability.teacher_loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (const config::attribute_value *v = cfg.get("add")) {
|
||||
|
@ -1864,7 +1840,7 @@ effect::effect(const unit_ability_list& list, int def, bool backstab, const_atta
|
|||
}
|
||||
}
|
||||
|
||||
if(set_effect_max.type != NOT_USED) {
|
||||
if(!is_cumulable && set_effect_max.type != NOT_USED) {
|
||||
value_set = std::max(set_effect_max.value, 0) + std::min(set_effect_min.value, 0);
|
||||
if(set_effect_max.value > def) {
|
||||
effect_list_.push_back(set_effect_max);
|
||||
|
|
Loading…
Add table
Reference in a new issue