URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       zwclose7
  HTML https://zwclose7.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Battle for Wesnoth
       *****************************************************
       #Post#: 251--------------------------------------------------
       Weapon special: curse (with example unit)
       By: zwclose7 Date: March 4, 2017, 10:51 am
       ---------------------------------------------------------
       Description: This attack reduces an enemy's HP by half on its
       next turn.
  HTML https://www.youtube.com/watch?v=qxqdd31PXIc
       Code
       [code]#define WEAPON_SPECIAL_CURSE
       [dummy]
       id=curse
       name="curse"
       description="This attack reduces an enemy's HP by half on its
       next turn."
       [/dummy]
       
       [/specials]
       [/attack]
       
       [event]
       name=attacker hits
       first_time_only=no
       
       [filter_attack]
       special=curse
       [/filter_attack]
       
       [filter_second]
       [not]
       [filter_wml]
       [status]
       cursed=yes
       [/status]
       [/filter_wml]
       [/not]
       [/filter_second]
       
       {VARIABLE second_unit.status.cursed yes}
       
       [unstore_unit]
       variable=second_unit
       text="cursed"
       {COLOR_HARM}
       [/unstore_unit]
       
       [unit_overlay]
       x=$x2
       y=$y2
       image=curse.png
       [/unit_overlay]
       [/event]
       
       [event]
       name=defender hits
       first_time_only=no
       
       [filter_second_attack]
       special=curse
       [/filter_second_attack]
       
       [filter]
       [not]
       [filter_wml]
       [status]
       cursed=yes
       [/status]
       [/filter_wml]
       [/not]
       [/filter]
       
       {VARIABLE unit.status.cursed yes}
       
       [unstore_unit]
       variable=unit
       text="cursed"
       {COLOR_HARM}
       [/unstore_unit]
       
       [unit_overlay]
       x=$x1
       y=$y1
       image=curse.png
       [/unit_overlay]
       [/event]
       
       [event]
       name=side turn
       first_time_only=no
       
       [store_unit]
       [filter]
       side=$side_number
       
       [filter_wml]
       [status]
       cursed=yes
       [/status]
       [/filter_wml]
       [/filter]
       
       variable=cursed_units
       [/store_unit]
       
       {FOREACH cursed_units i}
       {VARIABLE_OP cursed_units[$i].hitpoints divide 2}
       {CLEAR_VARIABLE cursed_units[$i].status.cursed}
       
       [scroll_to_unit]
       x=$cursed_units[$i].x
       y=$cursed_units[$i].y
       [/scroll_to_unit]
       
       [unstore_unit]
       variable=cursed_units[$i]
       text="curse"
       {COLOR_HARM}
       [/unstore_unit]
       
       [remove_unit_overlay]
       x=$cursed_units[$i].x
       y=$cursed_units[$i].y
       image=curse.png
       [/remove_unit_overlay]
       
       [sound]
       name=wail-sml.wav
       [/sound]
       
       [delay]
       time=300
       [/delay]
       {NEXT i}
       
       {CLEAR_VARIABLE cursed_units}
       [/event]
       
       [+attack]
       [+specials]
       #enddef
       #define SPECIAL_NOTES_CURSE
       " This unit is able to curse its enemies, reducing their HP by
       half on their next turn."#enddef
       [/code]
       Example unit
       [code][unit_type]
       [base_unit]
       id=Saurian Oracle
       [/base_unit]
       
       id=Saurian Shaman
       name="Saurian Shaman"
       level=3
       experience=150
       hitpoints=48
       cost=54
       usage=mixed fighter
       description="Saurian Shamans are the leaders of the Saurian
       race. They can curse the enemies to drain their health. This can
       quickly kill the even strongest
       enemy."+{SPECIAL_NOTES}+{SPECIAL_NOTES_LEADERSHIP}+{SPECIAL_NOTE
       S_MAGICAL}+{SPECIAL_NOTES_HEALS}+{SPECIAL_NOTES_CURSE}
       
       #Saurian Shaman have higher resistance to fire and cold damage
       due to their magical powers
       
       [resistance]
       fire=100
       cold=100
       [/resistance]
       
       [abilities]
       {ABILITY_LEADERSHIP_LEVEL_3}
       [/abilities]
       
       [attack]
       damage=8
       number=3
       [/attack]
       
       [attack]
       damage=10
       number=5
       
       [specials]
       {WEAPON_SPECIAL_CURSE}
       [/specials]
       [/attack]
       [/unit_type][/code]
       *****************************************************