Add ~DARKEN() counterpart to ~BRIGHTEN(),
tod-dark.png counterpart to tod-bright.png and darkens-aura.png counterpart to brightens-aura.png. Implement min_value for [illuminates]
This commit is contained in:
parent
f99491c144
commit
1af182ef39
14 changed files with 84 additions and 1 deletions
|
@ -29,6 +29,8 @@ Version 1.9.0-svn:
|
|||
* Deprecated [set_variable]'s random key, use rand instead
|
||||
* Renamed [unit][status] healable to unhealable so it can default to 'no'
|
||||
* Added 'side X turn refresh' and 'side X turn Y refresh' events
|
||||
* Add ~DARKEN() counterpart to ~BRIGHTEN()
|
||||
* Implement min_value for [illuminates]
|
||||
* Miscellaneous and bug fixes:
|
||||
* Defaulted log level to warning again
|
||||
* New option to auto-set delay shroud update on game start
|
||||
|
|
BIN
data/core/images/halo/darkens-aura.png
Normal file
BIN
data/core/images/halo/darkens-aura.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
|
@ -98,6 +98,7 @@
|
|||
|
||||
observer_image="misc/eye.png"
|
||||
tod_bright_image="misc/tod-bright.png"
|
||||
tod_dark_image="misc/tod-dark.png"
|
||||
|
||||
level_image="misc/icon-advance.png"
|
||||
|
||||
|
|
|
@ -152,6 +152,27 @@ Xu , Xu , Qxu , Qxu , Ql , Ql
|
|||
x,y=19,11
|
||||
type="Dark Adept"
|
||||
generate_name=yes
|
||||
halo=halo/darkens-aura.png
|
||||
[modifications]
|
||||
[object]
|
||||
silent=yes
|
||||
[effect]
|
||||
apply_to=new_ability
|
||||
[abilities]
|
||||
[illuminates]
|
||||
id=illumination
|
||||
value=-25
|
||||
min_value=-25
|
||||
cumulative=no
|
||||
name= "darkens"
|
||||
female_name= "female^darkens"
|
||||
description= "darkens and stuff"
|
||||
affect_self=yes
|
||||
[/illuminates]
|
||||
[/abilities]
|
||||
[/effect]
|
||||
[/object]
|
||||
[/modifications]
|
||||
[/unit]
|
||||
[/side]
|
||||
|
||||
|
|
BIN
images/misc/tod-dark.png
Normal file
BIN
images/misc/tod-dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.9 KiB |
|
@ -84,6 +84,7 @@ namespace game_config
|
|||
|
||||
std::string observer_image = "misc/eye.png";
|
||||
std::string tod_bright_image = "misc/tod-bright.png";
|
||||
std::string tod_dark_image = "misc/tod-dark.png";
|
||||
std::string unchecked_menu_image = "buttons/checkbox.png";
|
||||
std::string checked_menu_image = "buttons/checkbox-pressed.png";
|
||||
std::string wml_menu_image = "buttons/WML-custom.png";
|
||||
|
@ -197,6 +198,7 @@ namespace game_config
|
|||
|
||||
observer_image = v["observer_image"];
|
||||
tod_bright_image = v["tod_bright_image"];
|
||||
tod_dark_image = v["tod_dark_image"];
|
||||
|
||||
level_image = v["level_image"];
|
||||
ellipsis_image = v["ellipsis_image"];
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace game_config
|
|||
enemy_ball_image, ally_ball_image, energy_image,
|
||||
flag_image, flag_icon_image,
|
||||
terrain_mask_image, grid_image, unreachable_image, linger_image,
|
||||
observer_image, tod_bright_image,
|
||||
observer_image, tod_bright_image, tod_dark_image,
|
||||
checked_menu_image, unchecked_menu_image, wml_menu_image, level_image,
|
||||
ellipsis_image, default_victory_music, default_defeat_music;
|
||||
|
||||
|
|
|
@ -388,6 +388,7 @@ report generate_report(TYPE type,
|
|||
|
||||
std::string tod_image = tod.image;
|
||||
if (tod.bonus_modified > 0) tod_image += "~BRIGHTEN()";
|
||||
else if (tod.bonus_modified < 0) tod_image += "~DARKEN()";
|
||||
if (preferences::flip_time()) tod_image += "~FL(horiz)";
|
||||
|
||||
return report("",tod_image,tooltip.str());
|
||||
|
|
|
@ -719,6 +719,10 @@ surface locator::load_image_sub_file() const
|
|||
else if (function == "BRIGHTEN") {
|
||||
functor_queue.push_back(new brighten_function());
|
||||
}
|
||||
// Add a dark overlay.
|
||||
else if (function == "DARKEN") {
|
||||
functor_queue.push_back(new darken_function());
|
||||
}
|
||||
else {
|
||||
ERR_DP << "unknown image function in path: " << function << '\n';
|
||||
}
|
||||
|
|
|
@ -126,4 +126,13 @@ surface brighten_function::operator()(const surface &src) const
|
|||
return ret;
|
||||
}
|
||||
|
||||
surface darken_function::operator()(const surface &src) const
|
||||
{
|
||||
surface ret = make_neutral_surface(src);
|
||||
surface tod_dark(image::get_image(game_config:: tod_dark_image));
|
||||
if (tod_dark)
|
||||
blit_surface(tod_dark, NULL, ret, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
} /* end namespace image */
|
||||
|
|
|
@ -196,6 +196,14 @@ struct brighten_function : function_base
|
|||
virtual surface operator()(const surface &src) const;
|
||||
};
|
||||
|
||||
/**
|
||||
* Overlay with ToD darkening (DARKEN).
|
||||
*/
|
||||
struct darken_function : function_base
|
||||
{
|
||||
virtual surface operator()(const surface &src) const;
|
||||
};
|
||||
|
||||
} /* end namespace image */
|
||||
|
||||
#endif /* !defined(IMAGE_FUNCTION_HPP_INCLUDED) */
|
||||
|
|
|
@ -277,6 +277,8 @@ time_of_day tod_manager::time_of_day_at(const unit_map& units,const map_location
|
|||
int mod = illum_effect.get_composite_value();
|
||||
if(mod + tod.lawful_bonus > illum.highest("max_value").first) {
|
||||
mod = illum.highest("max_value").first - tod.lawful_bonus;
|
||||
} else if(mod + tod.lawful_bonus < illum.lowest("min_value").first) {
|
||||
mod = illum.lowest("min_value").first - tod.lawful_bonus;
|
||||
}
|
||||
lighten = std::max<int>(mod, lighten);
|
||||
darken = std::min<int>(mod, darken);
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
bool empty() const;
|
||||
|
||||
std::pair<int,map_location> highest(const std::string& key, int def=0) const;
|
||||
std::pair<int,map_location> lowest(const std::string& key, int def=0) const;
|
||||
|
||||
std::vector<std::pair<const config *, map_location> > cfgs;
|
||||
};
|
||||
|
|
|
@ -374,6 +374,38 @@ std::pair<int,map_location> unit_ability_list::highest(const std::string& key, i
|
|||
return std::make_pair(flat + stack, best_loc);
|
||||
}
|
||||
|
||||
std::pair<int,map_location> unit_ability_list::lowest(const std::string& key, int def) const
|
||||
{
|
||||
if (cfgs.empty()) {
|
||||
return std::make_pair(def, map_location());
|
||||
}
|
||||
// The returned location is the best non-cumulative one, if any,
|
||||
// the best absolute cumulative one otherwise.
|
||||
map_location best_loc;
|
||||
bool only_cumulative = true;
|
||||
int abs_max = 0;
|
||||
int flat = 0;
|
||||
int stack = 0;
|
||||
typedef std::pair<const config *, map_location> pt;
|
||||
foreach (pt const &p, cfgs)
|
||||
{
|
||||
int value = lexical_cast_default<int>((*p.first)[key], def);
|
||||
if (utils::string_bool((*p.first)["cumulative"])) {
|
||||
stack += value;
|
||||
if (value < 0) value = -value;
|
||||
if (only_cumulative && value <= abs_max) {
|
||||
abs_max = value;
|
||||
best_loc = p.second;
|
||||
}
|
||||
} else if (only_cumulative || value < flat) {
|
||||
only_cumulative = false;
|
||||
flat = value;
|
||||
best_loc = p.second;
|
||||
}
|
||||
}
|
||||
return std::make_pair(flat + stack, best_loc);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* [special]
|
||||
|
|
Loading…
Add table
Reference in a new issue