mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-08 20:54:16 +00:00
add modification specific to gender or variations
the old code don't work for replace advancement in [male/female] or [variation] tag
This commit is contained in:
parent
83d1bef0bc
commit
e905271c79
@ -165,6 +165,39 @@
|
||||
# link the advancement tag
|
||||
# to enable AMLA support
|
||||
{LINK_TAG "units/$modifications/advancement"}
|
||||
[tag]
|
||||
name="male"
|
||||
{SIMPLE_KEY add_advancement string_list}
|
||||
{SIMPLE_KEY remove_advancement string_list}
|
||||
{SIMPLE_KEY set_advances_to string_list}
|
||||
{SIMPLE_KEY set_cost int}
|
||||
{SIMPLE_KEY set_experience int}
|
||||
# link the advancement tag
|
||||
# to enable AMLA support
|
||||
{LINK_TAG "units/$modifications/advancement"}
|
||||
[/tag]
|
||||
[tag]
|
||||
name="female"
|
||||
{SIMPLE_KEY add_advancement string_list}
|
||||
{SIMPLE_KEY remove_advancement string_list}
|
||||
{SIMPLE_KEY set_advances_to string_list}
|
||||
{SIMPLE_KEY set_cost int}
|
||||
{SIMPLE_KEY set_experience int}
|
||||
# link the advancement tag
|
||||
# to enable AMLA support
|
||||
{LINK_TAG "units/$modifications/advancement"}
|
||||
[/tag]
|
||||
[tag]
|
||||
name="variation"
|
||||
{SIMPLE_KEY add_advancement string_list}
|
||||
{SIMPLE_KEY remove_advancement string_list}
|
||||
{SIMPLE_KEY set_advances_to string_list}
|
||||
{SIMPLE_KEY set_cost int}
|
||||
{SIMPLE_KEY set_experience int}
|
||||
# link the advancement tag
|
||||
# to enable AMLA support
|
||||
{LINK_TAG "units/$modifications/advancement"}
|
||||
[/tag]
|
||||
[/tag]
|
||||
{DATA_TAG "world_conquest_data" 0 1 any}
|
||||
[/tag]
|
||||
|
@ -115,3 +115,97 @@
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [modify_unit_type][female][advancement]
|
||||
##
|
||||
# Actions:
|
||||
# Modify the Elvish Sharpshooter unit type to add add_level amla to female only.
|
||||
# Spawn a Elvish Sharpshooter female unit.
|
||||
# Make advances Elvish Sharpshooter
|
||||
##
|
||||
# Expected end state:
|
||||
# The spawned Elvish Sharpshooter should have level=4.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "add_specific_female_amla_on_female" (
|
||||
[modify_unit_type]
|
||||
type="Elvish Sharpshooter"
|
||||
[female]
|
||||
[advancement]
|
||||
id = add_level
|
||||
[effect]
|
||||
apply_to = level
|
||||
increase=1
|
||||
[/effect]
|
||||
[/advancement]
|
||||
[/female]
|
||||
[/modify_unit_type]
|
||||
[event]
|
||||
name=start
|
||||
[unit]
|
||||
x = 1
|
||||
y = 1
|
||||
type = Elvish Sharpshooter
|
||||
gender=female
|
||||
side = 1
|
||||
id = charlie
|
||||
canrecruit = no
|
||||
[/unit]
|
||||
{ADVANCE_UNIT id=charlie ""}
|
||||
[store_unit]
|
||||
variable=sharpshooter
|
||||
[filter]
|
||||
id = charlie
|
||||
[/filter]
|
||||
[/store_unit]
|
||||
{ASSERT ({VARIABLE_CONDITIONAL sharpshooter.level equals 4})}
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [modify_unit_type][female][advancement]
|
||||
##
|
||||
# Actions:
|
||||
# Modify the Elvish Sharpshooter unit type to add add_level amla to female only.
|
||||
# Spawn a Elvish Sharpshooter male unit.
|
||||
# Make advances Elvish Sharpshooter
|
||||
##
|
||||
# Expected end state:
|
||||
# The spawned Elvish Sharpshooter level=3 because don't have female advancement.
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "add_specific_female_amla_on_male" (
|
||||
[modify_unit_type]
|
||||
type="Elvish Sharpshooter"
|
||||
[female]
|
||||
[advancement]
|
||||
id = add_level
|
||||
[effect]
|
||||
apply_to = level
|
||||
increase=1
|
||||
[/effect]
|
||||
[/advancement]
|
||||
[/female]
|
||||
[/modify_unit_type]
|
||||
[event]
|
||||
name=start
|
||||
[unit]
|
||||
x = 1
|
||||
y = 1
|
||||
type = Elvish Sharpshooter
|
||||
gender= male
|
||||
side = 1
|
||||
id = charlie
|
||||
canrecruit = no
|
||||
[/unit]
|
||||
{ADVANCE_UNIT id=charlie ""}
|
||||
[store_unit]
|
||||
variable=sharpshooter
|
||||
[filter]
|
||||
id = charlie
|
||||
[/filter]
|
||||
[/store_unit]
|
||||
{ASSERT ({VARIABLE_CONDITIONAL sharpshooter.level equals 3})}
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
||||
|
@ -1407,13 +1407,24 @@ void unit_type::apply_scenario_fix(const config& cfg)
|
||||
continue;
|
||||
}
|
||||
gender_types_[gender]->apply_scenario_fix(cfg);
|
||||
std::string gender_str = gender == 0 ? "male" : "female";
|
||||
if(cfg.has_child(gender_str)) {
|
||||
auto gender_cfg = cfg.optional_child(gender_str);
|
||||
if(gender_cfg){
|
||||
gender_types_[gender]->apply_scenario_fix(*gender_cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(get_cfg().has_child("variation")) {
|
||||
// Make sure the variations are created.
|
||||
unit_types.build_unit_type(*this, VARIATIONS);
|
||||
for(auto& v : variations_) {
|
||||
v.second.apply_scenario_fix(cfg);
|
||||
for (auto& cv : cfg.child_range("variation")){
|
||||
for(auto& v : variations_) {
|
||||
if(v.first == cv["variation_id"]){
|
||||
v.second.apply_scenario_fix(cv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,6 +232,8 @@
|
||||
0 no_duplicate_advancements
|
||||
0 add_advancement
|
||||
0 add_or_replace_amla
|
||||
0 add_specific_female_amla_on_female
|
||||
0 add_specific_female_amla_on_male
|
||||
0 harm_unit_survivable_experience_no
|
||||
0 harm_unit_survivable_experience_unset
|
||||
0 harm_unit_survivable_experience_yes
|
||||
|
Loading…
x
Reference in New Issue
Block a user