Add (un)consider attack events. (Bug #12375)

This commit is contained in:
Alexander van Gessel 2008-10-06 11:15:23 +01:00
parent 076ccb29e9
commit 4c4226cfde
3 changed files with 80 additions and 12 deletions

View file

@ -1,6 +1,9 @@
Version 1.5.5+svn:
* Language and i18n:
* updated translations:
* WML engine:
* Created the "consider attack" and "unconsider attack" events. (bug
#12375)
Version 1.5.5:
* Campaigns:

View file

@ -36,18 +36,6 @@ Xu , Xu , Qxu , Qxu , Ql , Ql
{DUSK}
{FIRST_WATCH}
{SECOND_WATCH}
[story]
[part]
background="attacks/hammer-dwarven-runic.png"
story="scaled"
scale_background=yes
[/part]
[part]
background="attacks/hammer-dwarven-runic.png"
story="unscaled"
scale_background=no
[/part]
[/story]
[music]
name="traveling_minstrels.ogg"
ms_before=12000
@ -236,6 +224,81 @@ Xu , Xu , Qxu , Qxu , Ql , Ql
{FULL_HEAL (x,y=$x1|,$y1)}
[/event]
[label]
x,y=4,6
text="Special Weaponry"
[/label]
[event]
name=moveto
[filter]
side=1
x,y=4,6
[/filter]
[message]
speaker=narrator
image=wesnoth-icon.png
message="You now have access to a special anti-warlord weapon!"
[/message]
[event]
name=consider attack
first_time_only=no
[filter_second]
type=Orcish Warlord
[/filter_second]
[object]
name= _ "Anti-Warlord Weaponry activated!"
[filter]
x,y=$x1,$y1
[/filter]
[effect]
apply_to=new_attack
name="anti-warlord"
description="anti-warlord"
type=arcane
range=ranged
damage=50
number=5
icon=attacks/faerie-fire.png
[/effect]
[/object]
[/event]
[event]
name=unconsider attack
first_time_only=no
[filter_second]
type=Orcish Warlord
[/filter_second]
[object]
name= _ "Anti-Warlord Weaponry deactivated."
[filter]
x,y=$x1,$y1
[/filter]
[effect]
apply_to=remove_attacks
name=anti-warlord
[/effect]
[/object]
[/event]
[event]
name=attack_end
first_time_only=no
[filter_second]
type=Orcish Warlord
[/filter_second]
[object]
name= _ "Anti-Warlord Weaponry deactivated."
[filter]
x,y=$x1,$y1
[/filter]
[effect]
apply_to=remove_attacks
name=anti-warlord
[/effect]
[/object]
[/event]
[/event]
[label]
x,y=17,7
text="Open the hell"

View file

@ -580,6 +580,7 @@ bool mouse_handler::attack_enemy_(unit_map::iterator attacker, unit_map::iterato
std::vector<std::string> items;
std::vector<battle_context> bc_vector;
game_events::fire("consider attack", attacker_loc, defender_loc);
unsigned int i, best = 0;
for (i = 0; i < attacker->second.attacks().size(); i++) {
// skip weapons with attack_weight=0
@ -697,6 +698,7 @@ bool mouse_handler::attack_enemy_(unit_map::iterator attacker, unit_map::iterato
return true;
} else {
game_events::fire("unconsider attack", attacker_loc, defender_loc);
return false;
}
}