-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c7b9fa
commit c8c8018
Showing
1 changed file
with
243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,243 @@ | ||
#textdomain wesnoth-War_of_Legends | ||
|
||
#define PLACE_CHEST POS | ||
[item] | ||
image="items/chest-plain-closed.png" | ||
{POS} | ||
[/item] | ||
#enddef | ||
|
||
#define FILTER_CHEST_OPEN SIDE POS | ||
[filter] | ||
side={SIDE} | ||
[filter_location] | ||
{POS} | ||
[/filter_location] | ||
[/filter] | ||
[sound] | ||
name="open-chest.wav" | ||
[/sound] | ||
[remove_item] | ||
{POS} | ||
[/remove_item] | ||
[item] | ||
image="items/chest-plain-open.png" | ||
{POS} | ||
[/item] | ||
#enddef | ||
|
||
#define POTION_HELP_MESSAGE | ||
[message] | ||
image=icons/potion_green_medium.png~XBRZ(2) | ||
speaker=narrator | ||
caption=_"Note" | ||
message=_"To use a potion, right-click on any unit and select the appropriate option." | ||
[/message] | ||
#enddef | ||
|
||
#define POTION_INFO_healing | ||
_"(Remaining doses: $healing_potion)"#enddef | ||
|
||
#define POTION_INFO_haste | ||
_"(Remaining doses: $haste_potion)"#enddef | ||
|
||
#define POTION_USEDESC_healing | ||
_"Use healing potion"#enddef | ||
|
||
#define POTION_USEDESC_haste | ||
_"Use haste potion"#enddef | ||
|
||
#define POTION_DESC TYPE | ||
{POTION_USEDESC_{TYPE}} + " " + {POTION_INFO_{TYPE}}#enddef | ||
|
||
#define UPDATE_POTION TYPE | ||
[set_menu_item] | ||
id=use_{TYPE}_potion | ||
description={POTION_DESC {TYPE}} | ||
[/set_menu_item] | ||
#enddef | ||
|
||
#define GIVE_POTION TYPE DOSES_EASY DOSES_NORMAL DOSES_HARD | ||
[if] | ||
{VARIABLE_CONDITIONAL got_some_potions boolean_equals yes} | ||
[else] | ||
{VARIABLE got_some_potions yes} | ||
{POTION_HELP_MESSAGE} | ||
[/else] | ||
[/if] | ||
[set_variable] | ||
name={TYPE}_potion_old | ||
to_variable={TYPE}_potion | ||
[/set_variable] | ||
[set_variable] | ||
name={TYPE}_potion | ||
{QUANTITY add {DOSES_EASY} {DOSES_NORMAL} {DOSES_HARD}} | ||
[/set_variable] | ||
{UPDATE_POTION {TYPE}} | ||
#enddef | ||
|
||
#define NOTIFY_POTIONS | ||
[lua] | ||
code=<<wesnoth.dofile "~add-ons/War_of_Legends/lua/scenario/potions.lua">> | ||
[/lua] | ||
[if] | ||
{VARIABLE_CONDITIONAL haste_potion_old numerical_equals 0} | ||
[and] | ||
{VARIABLE_CONDITIONAL healing_potion_old numerical_equals 0} | ||
[/and] | ||
[then] | ||
[message] | ||
image=icons/potion_green_medium.png~XBRZ(2) | ||
speaker=narrator | ||
caption=_"Potions" | ||
message=_"You have found $potion_totals." | ||
[/message] | ||
[/then] | ||
[else] | ||
[message] | ||
image=icons/potion_green_medium.png~XBRZ(2) | ||
speaker=narrator | ||
caption=_"Potions" | ||
message=_"You have found $potion_details, for a total of $potion_totals." | ||
[/message] | ||
[/else] | ||
[/if] | ||
{CLEAR_VARIABLE haste_potion_old,healing_potion_old} | ||
#enddef | ||
|
||
#define HASTE_UNIT FILTERWML | ||
[object] | ||
[filter] | ||
{FILTERWML} | ||
[/filter] | ||
duration=scenario | ||
silent=yes | ||
[effect] | ||
apply_to=movement | ||
increase=4 | ||
[/effect] | ||
[effect] | ||
apply_to=status | ||
add=hasted | ||
[/effect] | ||
[/object] | ||
# Allow them to get the benefit of the potion in this turn | ||
# We do already have the unit stored, but since that's a copy | ||
# (if I recall correctly), we need to store it again to get the | ||
# version with the object applied. | ||
[store_unit] | ||
variable=hasted_unit | ||
[filter] | ||
{FILTERWML} | ||
[/filter] | ||
[/store_unit] | ||
[if] | ||
[variable] | ||
name=hasted_unit.attacks_left | ||
greater_than=0 | ||
[/variable] | ||
[then] | ||
[set_variable] | ||
name=hasted_unit.moves | ||
add=4 | ||
[/set_variable] | ||
[/then] | ||
[/if] | ||
[unstore_unit] | ||
variable=hasted_unit | ||
text=_"hasted!" | ||
red,green,blue=0,255,136 | ||
[/unstore_unit] | ||
{CLEAR_VARIABLE hasted_unit} | ||
[event] | ||
# There may be an engine bug preventing removal of statuses added by objects. | ||
# This ensures haste is really removed | ||
id=force_remove_haste | ||
name=victory | ||
[modify_unit] | ||
[filter] | ||
status=hasted | ||
[/filter] | ||
[status] | ||
hasted=no | ||
[/status] | ||
[/modify_unit] | ||
[/event] | ||
#enddef | ||
|
||
#define SET_POTION_MENUS | ||
{VARIABLE healing_potion 0} | ||
{VARIABLE haste_potion 0} | ||
[set_menu_item] | ||
id=use_healing_potion | ||
description={POTION_DESC healing} | ||
[show_if] | ||
[have_unit] | ||
side=1 | ||
x,y=$x1,$y1 | ||
[not] | ||
[filter_wml] | ||
hitpoints=$this_unit.max_hitpoints | ||
[/filter_wml] | ||
[/not] | ||
[/have_unit] | ||
[variable] | ||
name=healing_potion | ||
greater_than=0 | ||
[/variable] | ||
[/show_if] | ||
[command] | ||
[sound] | ||
name=potion.ogg | ||
[/sound] | ||
[delay] | ||
time=200 | ||
accelerate=yes | ||
[/delay] | ||
[heal_unit] | ||
[filter] | ||
side=1 | ||
x,y=$x1,$y1 | ||
[/filter] | ||
animate=yes | ||
amount=full | ||
restore_statuses=yes | ||
[/heal_unit] | ||
{VARIABLE_OP healing_potion sub 1} | ||
{UPDATE_POTION healing} | ||
[/command] | ||
[/set_menu_item] | ||
[set_menu_item] | ||
id=use_haste_potion | ||
description={POTION_DESC haste} | ||
[show_if] | ||
[have_unit] | ||
side=1 | ||
x,y=$x1,$y1 | ||
[not] | ||
[filter_wml] | ||
[status] | ||
hasted=yes | ||
[/status] | ||
[/filter_wml] | ||
[/not] | ||
[/have_unit] | ||
[variable] | ||
name=haste_potion | ||
greater_than=0 | ||
[/variable] | ||
[/show_if] | ||
[command] | ||
[sound] | ||
name=potion.ogg | ||
[/sound] | ||
[delay] | ||
time=200 | ||
accelerate=yes | ||
[/delay] | ||
{HASTE_UNIT x,y=$x1,$y1} | ||
{VARIABLE_OP haste_potion sub 1} | ||
{UPDATE_POTION haste} | ||
[/command] | ||
[/set_menu_item] | ||
#enddef |