ability bits

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
battlestar
Posts: 690
Joined: January 1st, 2007, 7:12 am

ability bits

Post by battlestar »

Just random bit of ability code

tested code:

Mind over body:
This unit converts its battle experiences into health each turn (2 hp per exp).

Code: Select all

#define ABILITIES_MIND_OVER_BODY
    # Canned definition of the Alluring ability to be included in an
    # [abilities] clause.  Note: this is deliberately unbalanced WML,
    # in order to close the abilities clause then insert the event
    # then reopen the abilities clause.
    [dummy]
        id=BS_mind_over_body
        name= _ "Mind over body"
        female_name= _ "female^mind over body"
        description=_ "Mind over body:
This unit converts its battle experiences into health each turn (2 hp per exp)."
    [/dummy] # a hack to please wmlxgettext (using a bug in wmlxgettext!): dummy tag start: [abilities]
[/abilities]
[event]
    id=BS_ability_mind_over_body
    name=turn refresh
    first_time_only=no
	[store_unit]
		[filter]
			ability=BS_mind_over_body
			side=$side_number
		[/filter]
		variable=temp_unit
	[/store_unit]
	{FOREACH temp_unit i}
		[heal_unit]
			[filter]
				id=$temp_unit[$i].id
			[/filter]
			amount=$($temp_unit[$i].experience * 2)
			animate=yes
			restore_statuses=no
		[/heal_unit]
		[modify_unit]
			[filter]
				id=$temp_unit[$i].id
			[/filter]
			experience=0
		[/modify_unit]
	{NEXT i}
	{CLEAR_VARIABLE temp_unit}
[/event]
[+abilities] # a hack to please wmlxgettext (using a bug in wmlxgettext!): dummy tag end: [/abilities]
#enddef

Spiritual residue:
Upon death, this unit's spirit will occupying its death location for 2 turns. It will not attack or move, nor can it be attacked.

Code: Select all

#define ABILITIES_SPIRITUAL_RESIDUE
    # Canned definition of the Alluring ability to be included in an
    # [abilities] clause.  Note: this is deliberately unbalanced WML,
    # in order to close the abilities clause then insert the event
    # then reopen the abilities clause.
    [dummy]
        id=BS_spiritual_residue
        name= _ "spiritual residue"
        female_name= _ "female^spiritual residue"
        description=_ "Spiritual residue:
Upon death, this unit's spirit will occupying its death location for 2 turns. It will not attack or move, nor can it be attacked."
    [/dummy] # a hack to please wmlxgettext (using a bug in wmlxgettext!): dummy tag start: [abilities]
[/abilities]
[event]
    id=BS_ability_spiritual_residue
    name=die
    first_time_only=no
	[filter]
		ability=BS_spiritual_residue
	[/filter]
	{VARIABLE unit.hitpoints 1}
	[animate_unit]
		[filter]
			id=$unit.id
		[/filter]
		flag=recruited
	[/animate_unit]
	[unstore_unit]
		variable=unit
		find_vacant=no
		check_passability=no
	[/unstore_unit]
	[petrify]
		id=$unit.id
	[/petrify]
	[object]
		[filter]
			id=$unit.id
		[/filter]
		[effect]
			apply_to=image_mod
			add=O(60%)
		[/effect]
		silent=yes
	[/object]
	
	[event]
		name="side $side_number turn $($turn_number + 2)"
		delayed_variable_substitution=no
		first_time_only=yes
		[unpetrify]
			id=$unit.id
		[/unpetrify]
		[kill]
			id=$unit.id
			animate=yes
		[/kill]
	[/event]
[/event]
[+abilities] # a hack to please wmlxgettext (using a bug in wmlxgettext!): dummy tag end: [/abilities]
#enddef
Preemptive strike:
This unit will attack any enemy unit moving adjacent to it.

Code: Select all

#define ABILITIES_PREEMPTIVE_STRIKE
    # Canned definition of the Alluring ability to be included in an
    # [abilities] clause.  Note: this is deliberately unbalanced WML,
    # in order to close the abilities clause then insert the event
    # then reopen the abilities clause.
    [dummy]
        id=BS_preemptive_strike
        name= _ "preemptive strike"
        female_name= _ "female^preemptive strike"
        description=_ "Preemptive strike:
This unit will attack any enemy unit moving adjacent to it."
    [/dummy] # a hack to please wmlxgettext (using a bug in wmlxgettext!): dummy tag start: [abilities]
[/abilities]
[event]
    id=BS_preemptive_strike
    name=moveto
    first_time_only=no
	[filter] # victim moves
		[filter_adjacent]
			ability=BS_preemptive_strike
		[/filter_adjacent]
	[/filter]
	[store_unit] # stores adjacent interceptors, store if adjacent to victim, has intercept ability, not victim's (active) side
		[filter]
			ability=BS_preemptive_strike
			[not]
				side=$side_number
			[/not]
			[filter_adjacent]
				id=$unit.id
			[/filter_adjacent]
		[/filter]
		variable=temp_unit
	[/store_unit]
	{FOREACH temp_unit i}
	# for each interceptor, attack victim once.
		[harm_unit]
			[filter]
				id=$unit.id
			[/filter]
			[filter_second]
				id=$temp_unit[$i].id
			[/filter_second]
			amount=$temp_unit[$i].attack[0].damage
			alignment=$temp_unit[$i].alignment
			damage_type=$temp_unit[$i].attack[0].type
			kill=yes
			fire_event=yes
			animate=yes
			experience=yes
		[/harm_unit]
	{NEXT i}
	{CLEAR_VARIABLE temp_unit}
[/event]
[+abilities] # a hack to please wmlxgettext (using a bug in wmlxgettext!): dummy tag end: [/abilities]
#enddef
LUA: Llama Under Apprenticeship
Hell faction: completed
Post Reply