gave every ability/special a specific id (some were missing)

new remove_special=<coma-separated list of ids> key to remove attack specials
in [effect]

(Trunk only)
This commit is contained in:
Benoît Timbert 2006-08-04 17:41:56 +00:00
parent 188f759f04
commit 546f9ee53c
3 changed files with 32 additions and 2 deletions

View File

@ -15,6 +15,7 @@ Version 1.3-svn:
* allow_new_game key (default=yes) to prevent [multiplayer] scenarios to
show up in the multiplayer game creation interface (FR #6397)
* new [set_specials] tag to allow custom special in effect tags
* new remove_specials=<id_list> key to allow to remove specials in effect tags
* obsolete set_special= in [effect] tags
Version 1.1.7:

View File

@ -53,7 +53,7 @@ A curer can cure a unit of poison, although that unit will receive no additional
#define ABILITY_REGENERATES
[regenerate]
value=8
id=healing
id=regenerates
name= _ "regenerates"
description= _ "Regenerates:
The unit will heal itself 8 hp per turn. If it is poisoned, it will remove the poison instead of healing."
@ -301,6 +301,7 @@ Adjacent friendly units of lower level will do more damage in battle. When a uni
#define ABILITY_SKIRMISHER
[skirmisher]
id=skirmisher
name= _ "skirmisher"
description= _ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
@ -325,6 +326,7 @@ Any units adjacent to this unit will fight as if it were dusk when it is night,
#define ABILITY_TELEPORT
[teleport]
id=teleport
name= _ "teleport"
description= _ "Teleport:
This unit may teleport between any two friendly villages using one of its moves."
@ -333,6 +335,7 @@ This unit may teleport between any two friendly villages using one of its moves.
#define ABILITY_AMBUSH
[hides]
id=ambush
name= _ "ambush"
name_inactive= _ "ambush"
description= _ "Ambush:
@ -354,6 +357,7 @@ Enemy units cannot see or attack this unit when it is in forest, except for any
#define ABILITY_NIGHTSTALK
[hides]
id=nightstalk
name= _ "nightstalk"
description= _ "Nightstalk:
The unit becomes invisible during night.
@ -375,6 +379,7 @@ Enemy units cannot see or attack this unit at night, except for any turn immedia
#define ABILITY_SUBMERGE
[hides]
id=submerge
name= _ "submerge"
description= _ "Submerge:
This unit can hide in deep water, and remain undetected by its enemies.
@ -423,6 +428,7 @@ This attack deals double damage if there is an enemy of the target on the opposi
#define WEAPON_SPECIAL_PLAGUE_TYPE TYPE
[plague]
id=plague({TYPE})
name= _ "plague"
description= _ "Plague:
When a unit is killed by a Plague attack, that unit is replaced with a unit identical to and on the same side as the unit with the Plague attack. (This doesn't work on Undead or units in villages.)"
@ -431,6 +437,7 @@ When a unit is killed by a Plague attack, that unit is replaced with a unit iden
#enddef
#define WEAPON_SPECIAL_PLAGUE
[plague]
id=plague
name= _ "plague"
description= _ "Plague:
When a unit is killed by a Plague attack, that unit is replaced with a unit identical to and on the same side as the unit with the Plague attack. (This doesn't work on Undead or units in villages.)"
@ -448,6 +455,7 @@ This attack slows the target until it ends a turn. Slow halves the damage caused
#define WEAPON_SPECIAL_STONE
[stones]
id=stones
name= _ "stones"
description= _ "Stone:
This attack turns the target to stone. Units that have been turned to stone may not move or attack."
@ -479,6 +487,7 @@ This attack always has a 70% chance to hit."
#define WEAPON_SPECIAL_SWARM
[attacks]
id=swarm
name= _ "swarm"
description= _ "Swarm:
The number of strikes of this attack decreases when the unit is wounded. The number of strikes is proportional to the % of HP/maximum HP the unit has. For example a unit with 3/4 of its maximum HP will get 3/4 of the number of strikes."
@ -508,6 +517,7 @@ This unit drains health from living units, healing itself for half the amount of
#define WEAPON_SPECIAL_FIRSTSTRIKE
[firststrike]
id=firststrike
name= _ "firststrike"
description= _ "First Strike:
This unit always strikes first with this attack, even if they are defending."

View File

@ -242,6 +242,7 @@ bool attack_type::apply_modification(const config& cfg,std::string* description)
const t_string& set_name = cfg["set_name"];
const std::string& set_type = cfg["set_type"];
const config* set_specials = cfg.child("set_specials");
const std::string& del_specials = cfg["remove_specials"];
const std::string& set_special = cfg["set_special"];
const std::string& increase_damage = cfg["increase_damage"];
const std::string& increase_attacks = cfg["increase_attacks"];
@ -271,7 +272,25 @@ bool attack_type::apply_modification(const config& cfg,std::string* description)
}
for(config::all_children_iterator s = set_specials->ordered_begin(); s != set_specials->ordered_end(); ++s) {
const std::pair<const std::string*,const config*>& value = *s;
new_specials->add_child(*value.first,*value.second); // new_specials==NULL :/
new_specials->add_child(*value.first,*value.second);
}
}
if(del_specials.empty() == false) {
const std::vector<std::string>& dsl = utils::split(del_specials);
config* specials = cfg_.child("specials");
if (specials != NULL) {
config new_specials;
for(config::all_children_iterator s = specials->ordered_begin(); s != specials->ordered_end(); ++s) {
const std::pair<const std::string*,const config*>& vp = *s;
std::vector<std::string>::const_iterator found_id =
std::find(dsl.begin(),dsl.end(),vp.second->get_attribute("id"));
if (found_id == dsl.end()) {
new_specials.add_child(*vp.first,*vp.second);
}
}
cfg_.clear_children("specials");
cfg_.add_child("specials",new_specials);
}
}