Skip to content

Instantly share code, notes, and snippets.

@justinzane
Created December 7, 2014 01:47
Show Gist options
  • Save justinzane/713d36792d37e3876292 to your computer and use it in GitHub Desktop.
Save justinzane/713d36792d37e3876292 to your computer and use it in GitHub Desktop.
Wesnoth Custom Ability
-----> utils/abilities.cfg
#define ABILITY_ARCANE_ENSLAVEMENT
[dummy]
id=arcane enslavement
name= _ "arcane enslavement"
female_name= _ "arcane enslavement"
#ifver WESNOTH_VERSION >= 1.11.2
description= _ "This unit has the highly special power to enslave anyone who attacks them using magic or magical weapons. The enslavement is permanent for the life of the Master. Should this unit die, it's slaves will become their old selves, which just might be dangerous."
#else
description= _ "Arcane enslavement:
This unit has the highly special power to enslave anyone who attacks them using magic or magical weapons. The enslavement is permanent for the life of the Master. Should this unit die, it's slaves will become their old selves, which just might be dangerous."
#endif
affect_self=yes
# affect_allies=no
# affect_enemies=no
# cumulative=no
[/dummy]
#enddef
-----> utils.abilities_events.cfg
[event]
name=defender hits
first_time_only=no
[filter]
ability=arcane enslavement
[/filter]
# Only works on arcane attacks by defender OR attacks with magical weapons.
[filter_second_attack]
type="arcane"
[or]
special=chaos
[/or]
[or]
special=cleave
[/or]
[or]
special=cone
[/or]
[or]
special=corruption
[/or]
[or]
special=dazzle
[/or]
[or]
special=devastating_blow
[/or]
[or]
special=disintegrate
[/or]
[or]
special=doom
[/or]
[or]
special=drain
[/or]
[or]
special=explosive
[/or]
[or]
special=explosive damage enemy
[/or]
[or]
special=explosive leech
[/or]
[or]
special=explosive slow
[/or]
[or]
special=explosive unprotected
[/or]
[or]
special=extra damage 5 impact
[/or]
[or]
special=greater infect
[/or]
[or]
special=guardian
[/or]
[or]
special=hit and run
[/or]
[or]
special=hose
[/or]
[or]
special=incinerate
[/or]
[or]
special=infect
[/or]
[or]
special=kamikaze sprint
[/or]
[or]
special=knockback
[/or]
[or]
special=leeches
[/or]
[or]
special=mayhem
[/or]
[or]
special=mind raid
[/or]
[or]
special=nosferatu gorge
[/or]
[or]
special=parry
[/or]
[or]
special=pierce
[/or]
[or]
special=plague
[/or]
[or]
special=poison
[/or]
[or]
special=purify
[/or]
[or]
special=raijers saloon
[/or]
[or]
special=shockwave
[/or]
[or]
special=slow
[/or]
[or]
special=soul annihilation
[/or]
[or]
special=soul extraction
[/or]
[or]
special=soul thrash
[/or]
[or]
special=storm
[/or]
[or]
special=storm_demon
[/or]
[or]
special=storm_lilith
[/or]
[or]
special=suck
[/or]
[or]
special=trickery
[/or]
[or]
special=whirlwind
[/or]
[/filter_second_attack]
# Setup a unique id for this master/slave pair.
# id=_"master-" + $unit.id + "slave-" + $second_unit.id
# Store master and slave to make changes
[store_unit]
[filter]
id=$unit.id
[/filter]
variable=master
[/store_unit]
[store_unit]
[filter]
id=$second_unit.id
[/filter]
variable=slave
[/store_unit]
# Add slave id to master so slave can be freed upon master's death.
[set_variable]
name=master.variables.slaves[$master.variables.slaves.length].id
value=$slave.id
[/set_variable]
# Record old side, then change newly enslaved unit's side.
[set_variable]
name=slave.variables.old_side
value=$slave.side
[/set_variable]
[set_variable]
name=slave.side
value=$master.side
[/set_variable]
# Record old loyalty, make sure slave is "loyal" to new side.
[set_variable]
name=slave.variables.old_loyalty
value=$slave.loyalty
[/set_variable]
[set_variable]
name=slave.loyalty
value=true
[/set_variable]
# unstore units back to game
[unstore_unit]
variable=master
[/unstore_unit]
[unstore_unit]
variable=slave
[/unstore_unit]
[/event]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment