<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://te4.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ghostbuster</id>
		<title>Tales of Maj'Eyal - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://te4.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ghostbuster"/>
		<link rel="alternate" type="text/html" href="https://te4.org/wiki/Special:Contributions/Ghostbuster"/>
		<updated>2026-04-08T06:50:01Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>https://te4.org/w/index.php?title=Resource&amp;diff=14854</id>
		<title>Resource</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Resource&amp;diff=14854"/>
				<updated>2018-06-30T07:27:26Z</updated>
		
		<summary type="html">&lt;p&gt;Ghostbuster: Fixed paradox description that refered to the no longer existing &amp;quot;paradox mastery&amp;quot; talent.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&amp;lt;!-- Version of ToME when this page was written --&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;border: 1px solid gray; font-size: large;&amp;quot;&lt;br /&gt;
|ToME Version: || 1.4.3&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;!-- Please update if you update the page! --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Resources''' are power pools used for various [[talents]] in Tales of Maj'Eyal.  There are several different kinds of resources, and some of them have unique behaviors. Several resources are affected by [[Fatigue]]. Each resource has a unique bar on the interface displaying the current level of the resource. &lt;br /&gt;
&lt;br /&gt;
==Air==&lt;br /&gt;
Only appears when you can't breathe for some reason. Being underwater, in a wall, or buried in sand will generally prevent you from breathing. You take an increasingly large amount of damage each turn after reaching 0 Air. Some items allow you to breathe underwater, or remove the need to breathe at all.  Some underwater areas will have bubbles that can restore air until they are depleted.&lt;br /&gt;
&lt;br /&gt;
Most races have 100 air, with [[yeek]] characters having 200.  Two artifacts, [[Coral Spray]] and [[Vargh Redemption]] will raise the cap by 50 air. &lt;br /&gt;
* The first turn you are underwater your air will drop by 5 and will then decrease by 2 each subsequent turn.&lt;br /&gt;
* The first turn you are in a wall your air will drop by 20 and will then decrease by 17 each subsequent turn.&lt;br /&gt;
* The first turn you are buried in sand your air will drop by 10 and will then decrease by 7 each subsequent turn.&lt;br /&gt;
* When you can breathe again normally you regain 3 air per turn.&lt;br /&gt;
* Underwater bubbles will restore 20 per turn (minus the loss of 2 from being underwater, for a total gain of 18).&lt;br /&gt;
* When your air runs out you begin taking damage. The first turn it is 20% of your max life and it increases by 5% each turn (so 25% on the second turn, 30% on the third). This is quickly fatal.&lt;br /&gt;
&lt;br /&gt;
==Equilibrium==&lt;br /&gt;
Equilibrium is the [[resource]] used by the Wild Gift class of talents, and represents how far the character is out of balance with Nature.  It is sometimes abbreviated &amp;quot;EQ&amp;quot;. [[Fatigue]] does not impact equilibrium at all. &lt;br /&gt;
&lt;br /&gt;
Equilibrium starts at 0, and is raised by talent use; a high Equilibrium increases the chance of failure. If Equilibrium exceeds [[Willpower]], an attempt to use a Wild Gift talent has a (sqrt(Equilibrium - Willpower) / 60) chance to fizzle, causing the loss of a turn. This can be seen in the resource bar as &amp;quot;% failure&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
Equilibrium does not naturally reduce itself over time, but it can be restored by:&lt;br /&gt;
* Walking on the wilderness map&lt;br /&gt;
* Standing in the area of effect of a Font of Life&lt;br /&gt;
* Using the {{t|Meditation}} talent passively or actively&lt;br /&gt;
* Successfully killing an enemy with the {{t|Swallow}} talent&lt;br /&gt;
* Being hit while {{t|Resolve}} is active but {{t|Antimagic Shield}} is not&lt;br /&gt;
* Coming under a life regeneration effect while under the influence of {{t|Ancestral Life}}&lt;br /&gt;
* Being hit while wearing various [[egos|equipment with on-hit EQ regeneration]]&lt;br /&gt;
&lt;br /&gt;
Note that if a player/creature has an [[Equilibrium]] bar, using [[Vim]]-based talents will increase it by a noticeable amount.&lt;br /&gt;
&lt;br /&gt;
==Feedback==&lt;br /&gt;
Feedback represents using pain as a means of psionic grounding and it can be used to power feedback abilities. Characters that have the feedback resource will gain feedback in proportion to any damage received. The base conversion rate depends on character level: it starts at 50% at level 1, and decays to 20% at level 50. Feedback is used by the [[Solipsist]]'s {{c|Feedback}} and {{c|Discharge}} talent trees. It decays at the rate of 10% or 1 per turn (whichever is greater). Feedback is affected by [[fatigue]].&lt;br /&gt;
&lt;br /&gt;
==Hate==&lt;br /&gt;
Hate is the [[resource]] used by the Afflicted classes: [[Cursed]] and [[Doomed]].  Hate does not regenerate, and even decays over time.  It is mainly recovered while fighting or use of the {{t|Feed}} talent.  Hate is affected by [[fatigue]].&lt;br /&gt;
&lt;br /&gt;
You can have up to 100 points of hate. Afflicted suffer from reduced healing while not at maximum hate -- by 50% at zero hate.  Your hate slowly decays (more quickly when the level is higher), down to a minimum of half your hate at the end of the most recent combat.  The strengths of many abilities also depend on your level of hate.&lt;br /&gt;
&lt;br /&gt;
Here are some ways Hate is regained:&lt;br /&gt;
&lt;br /&gt;
* '''Kill something''': 8 points, more for higher [[rank]] -- 24 points for a boss&lt;br /&gt;
* '''Take a big hit''' (over 15% of your maximum life): 2 points + 2 points per 5% life lost above 15%&lt;br /&gt;
* '''Take a hit while at low health''' (under 25% of maximum life): 4 points&lt;br /&gt;
* '''Do massive damage''' (over 33% in one hit)&lt;br /&gt;
&lt;br /&gt;
The Doomed {{c|Dark Sustenance}} tree has the talent {{t|Feed}}, which can be used to replenish hate.  Various Cursed talents also give Hate bonuses.&lt;br /&gt;
&lt;br /&gt;
==Life==&lt;br /&gt;
{{:Life}}&lt;br /&gt;
&lt;br /&gt;
==Mana==&lt;br /&gt;
Used by most of the magical spell talents.  It works much like Spell Points or Mana in most other RPGs.  Only Mage classes can regenerate Mana naturally. Certain class talents and gear can grant passive Mana regen, and having a Manasurge rune inscribed will grant some passive regen while resting. Your maximum increases with level (+4 per level), gear, and [[Willpower]] (+5 per point). Mana is doubly affected by [[fatigue]], making fatigue a primary concern for mana-using characters. &lt;br /&gt;
&lt;br /&gt;
==Souls==&lt;br /&gt;
Used by [[Necromancer]]s, and represents the number of souls caught within the necrotic aura.  Each soul can become an undead minion.  The pool is replenished by killing living beings within the necrotic aura.&lt;br /&gt;
&lt;br /&gt;
==Negative energy==&lt;br /&gt;
Negative energy is the power source for predominantly-[[Anorithil]] talents.  [[Necromancer]]s can also get access to the tree by becoming a [[Lich]]. Liches will regenerate negative energy over time, whereas Anorithil and Adventurers lose negative energy over time.&lt;br /&gt;
&lt;br /&gt;
It can be replenished by an Anorithil using:&lt;br /&gt;
* {{t|Twilight}} talent&lt;br /&gt;
* {{t|Twilight Surge}} talent&lt;br /&gt;
&lt;br /&gt;
Maximum negative energy is increased by 3 whenever a character gains a level. Negative energy is affected by [[fatigue]].&lt;br /&gt;
&lt;br /&gt;
==Positive energy==&lt;br /&gt;
Positive energy is a resource used by both of the [[Celestial (Metaclass)|Celestial]] classes (the [[Sun Paladin]]s and [[Anorithil]]). Many early talents will actually replenish it rather than drain it, shown as negative numbers in costs.  It decreases over time if not used.&lt;br /&gt;
&lt;br /&gt;
Maximum positive energy is increased by 3 whenever a character gains a level. Positive energy is affected by [[fatigue]].&lt;br /&gt;
&lt;br /&gt;
==Paradox==&lt;br /&gt;
Paradox is the resource used by the {{c|Chronomancy}} talents. It is somewhat like [[Equilibrium]] -- it starts at 0, and increases as talents are used. High paradox causes failures, anomalies, and backfires, but also increases the power of some talents. The damage (and sometimes duration, etc) of most Chronomancy talents is multiplied by a &amp;quot;paradox modifier&amp;quot; determined by the following formula: sqrt(0.5 + Paradox / 600). [[Fatigue]] has a unique effect on paradox, increasing the failure rate but not the cost of feedback-using talents.&lt;br /&gt;
&lt;br /&gt;
The cost of active paradox talents increases the higher your paradox already is; it is multiplied by 1 + (Paradox / 300).&lt;br /&gt;
&lt;br /&gt;
Paradox failures simply cause you to lose a turn like equilibrium failures. However, unlike equilibrium failures, your paradox still increases by the cost of the talent that failed.&lt;br /&gt;
&lt;br /&gt;
If an anomaly occurs, not only do you lose the turn and talent, but a random Anomaly talent is used. Your paradox is also reduced by twice the cost of the talent that failed. Anomaly chance is rolled before failure chance.&lt;br /&gt;
&lt;br /&gt;
If a backfire occurs, the talent targets the caster.&lt;br /&gt;
&lt;br /&gt;
To calculate paradox failure, anomaly, and backfire chance, a modified paradox is calculated by the following formula: (Paradox - [[Willpower]] * 2). Some items, such as the Shard of Crystallized Time, add directly to the Willpower stat used in this calculation, as does Temporal Form.&lt;br /&gt;
&lt;br /&gt;
Then calculate the fatigue modifier: (100 + 2 * [[Fatigue]]) / 100.&lt;br /&gt;
&lt;br /&gt;
Failures can only occur if modified paradox is over 200; if so, the chance is ceil(fatigue_modifier * (modified_paradox / 200)^2).&lt;br /&gt;
&lt;br /&gt;
Anomalies can only occur if modified paradox is over 300; if so, the chance is ceil(fatigue_modifier * (modified_paradox / 300)^3).&lt;br /&gt;
&lt;br /&gt;
Backfires can only occur if modified paradox is over 400; if so, the chance is ceil(fatigue_modifier * (modified_paradox / 400)^4).&lt;br /&gt;
&lt;br /&gt;
==Psi==&lt;br /&gt;
Psi is the resource used by Psionic classes, such as [[Solipsist]] and [[Mindslayer]]. It slowly regenerates over time, can be restored by talents and some equipment. Players can increase psi pool by raising willpower (+1 per point invested in willpower except for the [[Solipsist]] class). Psi is doubly affected by [[fatigue]].&lt;br /&gt;
&lt;br /&gt;
==Stamina==&lt;br /&gt;
Stamina is the resource used by most physical talents.  It is regenerated at a rate of 0.3 per turn if there are no other modifiers.  Resting will accelerate the rate at which stamina is recovered. Stamina capacity is increased by raising willpower (+2.5 max stamina per point) and when gaining a level (+3 max stamina per level). Stamina is affected by [[fatigue]].&lt;br /&gt;
&lt;br /&gt;
==Vim==&lt;br /&gt;
Vim is the resource used by the [[Defiler]] metaclass.  Vim does not regenerate but is instead regained in several ways, all involving combat.  [[Fatigue]] plays no role in determining vim costs.  The vim pool grows by 4 points every level and is not influenced by any stats.&lt;br /&gt;
&lt;br /&gt;
Ways of regaining vim:&lt;br /&gt;
&lt;br /&gt;
* '''Kill bounty:''' Each kill returns one point of vim per 20 [[Willpower]].&lt;br /&gt;
* '''Kill refunds:''' If you kill something directly with a vim-using talent, the talents cost in vim is restored. This ''only'' works with straight damage -- infecting someone with a disease won't return any vim this way, even if your victim dies from it three rounds later.  Though if you kill something with a Bone Nova, for example, you will get its cost refunded.&lt;br /&gt;
* '''Special Talents:''' Some talents can also restore your vim, such as {{t|Drain}} and {{t|Leech}}.&lt;br /&gt;
&lt;br /&gt;
==Steam==&lt;br /&gt;
Steam is the resource used by the [[Tinker]] metaclass. It was introduced as part of the [[Embers of Rage]] DLC. [[Fatigue]] plays no role in determining steam costs.&lt;br /&gt;
&lt;br /&gt;
Steam is generated by steam generator injectors, which generate a constant amount of steam per turn. Steam is consumed by steam-powered weapons when used in melee or ranged fire, by steam-using talents, and by steam-using sustains. Unlike some other resources, steam-using sustains drain a fixed amount of steam ''per turn''. &lt;br /&gt;
[[Category:Game Mechanics]] [[Category:Resources]]&lt;/div&gt;</summary>
		<author><name>Ghostbuster</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Hooks&amp;diff=14634</id>
		<title>Hooks</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Hooks&amp;diff=14634"/>
				<updated>2018-02-05T23:07:46Z</updated>
		
		<summary type="html">&lt;p&gt;Ghostbuster: Cosmetic changes. Also added hook Combat:attackTargetWith:attackerBonuses&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development]][[Category:Addons]]&lt;br /&gt;
For addons, hooks are a way of causing certain code to be triggered by events happening in the game.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
They are all used the same way, with &amp;quot;ToME:load&amp;quot; being replaced with the actual hook name:&lt;br /&gt;
&lt;br /&gt;
 class:bindHook(&amp;quot;ToME:load&amp;quot;, function(self, data)&lt;br /&gt;
 your code&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
If the hook function has any arguments, they are accessed through the data variable like data.argumentname .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a list of hooks currently available for addon creators and what they do.&lt;br /&gt;
&lt;br /&gt;
'''ToME:load'''&lt;br /&gt;
Triggers when ToME loads up.  Used to load an addons files into the game.  Must be included in every addon or the addon will not work!&lt;br /&gt;
There are a few important functions you'll want to trigger to make the magic happen.&lt;br /&gt;
&lt;br /&gt;
* ''Birther:loadDefinition'' will load a new race or class&lt;br /&gt;
* ''ActorTalents:loadDefinition'' will load new talents for your new race, class, or monster to use&lt;br /&gt;
* ''DamageType:loadDefinition'' will load new damage types for your talents to use&lt;br /&gt;
* ''ActorTemporaryEffects:loadDefinition'' will load new temporary effect, bad or good, to be used by talents and damage types&lt;br /&gt;
* ''WorldAchievements:loadDefinition'' loads new achievement.  Not commonly used in addons&lt;br /&gt;
* ''PlayerLore:loadDefinition'' adds new lore to be collected by the player.  Not commonly used in addons&lt;br /&gt;
* ''PartyIngredients:loadDefinition'' loads new ingredients to be collected by the player for reciptes.  Not commonly used in addons.&lt;br /&gt;
&lt;br /&gt;
So for example if we want a new class called &amp;quot;Pilgrim&amp;quot; with it's own unique talents, but no new damage types or effects, we could load it like so.&lt;br /&gt;
&lt;br /&gt;
 class:bindHook(&amp;quot;ToME:load&amp;quot;, function(self, data)&lt;br /&gt;
 ActorTalents:loadDefinition(&amp;quot;/data-classpack/talents/techniques/techniques-pilgrim.lua&amp;quot;)&lt;br /&gt;
 Birther:loadDefinition(&amp;quot;/data-classpack/birth/pilgrim.lua&amp;quot;)&lt;br /&gt;
 end)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Engine Hooks:==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Chat:Talkbox:command'''&lt;br /&gt;
&lt;br /&gt;
/dialogs/Talkbox.lua/okclick&lt;br /&gt;
&lt;br /&gt;
data = { command=command, params=params, talkbox=self}&lt;br /&gt;
&lt;br /&gt;
Allows the addition of new chat commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Entity:loadList'''&lt;br /&gt;
&lt;br /&gt;
/Entity.lua/loadList&lt;br /&gt;
&lt;br /&gt;
data = { file=file, no_default=no_default, res=res, mod=mod, loaded=loaded}&lt;br /&gt;
&lt;br /&gt;
Useful for adding new entries into a list file, without overwriting it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''MapGeneratorStatic:subgenRegister'''&lt;br /&gt;
&lt;br /&gt;
/generator/map/Static.lua/generate&lt;br /&gt;
&lt;br /&gt;
data = { mapfile=self.data.map, list=self.subgen}&lt;br /&gt;
&lt;br /&gt;
Something for adding in new things to map generation?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Module Hooks:==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:actBase:Effects'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/actBase&lt;br /&gt;
&lt;br /&gt;
data = { }&lt;br /&gt;
&lt;br /&gt;
Triggers when the actor does anything. Useful for anything with a constant effect. self is the actor doing the action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:move'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/move&lt;br /&gt;
&lt;br /&gt;
data = { moved=moved, force=force, ox=ox, oy=oy}&lt;br /&gt;
&lt;br /&gt;
Triggers when an actor moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:takeHit'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/onTakeHit&lt;br /&gt;
&lt;br /&gt;
data = { value=value, src=src}&lt;br /&gt;
&lt;br /&gt;
Triggers when an actor is hit by something. It's useful mostly for talents and effects that alter or avoid damage being recieved on a particular actor. self in this case is the thing being hit. data.value &lt;br /&gt;
contains the amount of damage taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:preUseTalent'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/preUseTalent&lt;br /&gt;
&lt;br /&gt;
data = { t=ab, silent=silent, fale=fake}&lt;br /&gt;
&lt;br /&gt;
Triggers whenever an actor tries to use a talent, but before the talent is run. Useful for new resources or failure effects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:postUseTalent'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/postUseTalent&lt;br /&gt;
&lt;br /&gt;
data = { t=ab, ret=ret, trigger=trigger}&lt;br /&gt;
&lt;br /&gt;
Triggers after an actor successfully uses a talent. Useful for new resources types. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:getTalentFullDescription:ressources'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/getTalentFullDescription&lt;br /&gt;
&lt;br /&gt;
data = {str=d, t=t, addlevel=addlevel, config=config, fake_mastery=fake_mastery}&lt;br /&gt;
&lt;br /&gt;
This is where you add code to make your new resource display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:getTalentFullDescription'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/getTalentFullDescription&lt;br /&gt;
&lt;br /&gt;
data = { str=d, t=t, addlevel=addlevel, config=config, fake_mastery=fake_mastery}&lt;br /&gt;
&lt;br /&gt;
Let's you add something else just above the talent description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''ToME:run'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Game.lua/run&lt;br /&gt;
&lt;br /&gt;
data = { }&lt;br /&gt;
&lt;br /&gt;
See ToME run. Run ToME run! Inserts code before the module starts running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Game:alterGameMenu'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Game.lua/setupCommands&lt;br /&gt;
&lt;br /&gt;
data = { menu=l, unregister=function() self:unregisterDialog(menu) end}&lt;br /&gt;
&lt;br /&gt;
Allows editing of the escape menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat:archeryAcquire'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Archery.lua/archeryAcquireTargets&lt;br /&gt;
&lt;br /&gt;
data = { tg=tg, params=params, weapon=weapon, ammo=a}&lt;br /&gt;
&lt;br /&gt;
Similar to Combat:attackTarget but with ranged weapons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat:archeryHit'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Archery.lua/archery_projectile&lt;br /&gt;
&lt;br /&gt;
data = { hitted=hitted, target=target, weapon=weapon, ammo=ammo, damtype=damtype, mult=mult, dam=dam}&lt;br /&gt;
&lt;br /&gt;
Triggers when a projectile hits an actor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat:attackTarget'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Combat.lua/attackTarget&lt;br /&gt;
&lt;br /&gt;
data = { target=target, damtype=damtype, mult=mult, noenergy=noenergy}&lt;br /&gt;
&lt;br /&gt;
Triggers when the actor starts to attack but before anything actually happens to weapons are taken into account. Useful for effects that prevent attacking. self is the actor trying to attack, data.target is his &lt;br /&gt;
target, data.damtype is the damage type being applied. &lt;br /&gt;
&lt;br /&gt;
Return false to continue the attack without modifying it.&lt;br /&gt;
&lt;br /&gt;
Return true to take into account changes made in the hook. &lt;br /&gt;
You can change data.mult and data.damtype to modify damage characteristics.&lt;br /&gt;
&lt;br /&gt;
To cancel the attack set data.stop to true and data.hit to false and return true.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat:attackTargetWith'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Combat.lua/attackTargetWith&lt;br /&gt;
&lt;br /&gt;
data = { hitted=hitted, crit=crit, target=target, weapon=weapon, damtype=damtype, mult=mult, dam=dam}&lt;br /&gt;
&lt;br /&gt;
Triggers when the actor makes an attack after the weapon and whether it hits or not has been taken into account. Useful for just about any effect or skill that triggers on attack. self is the actor attacking, &lt;br /&gt;
data.target is the target being hit, data.hitted is whether or not the attack hit the target, and data.dam, data.damtype, and data.weapon should be self-evident.&lt;br /&gt;
&lt;br /&gt;
'''Combat:attackTargetWith:attackerBonuses'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Combat.lua/attackTargetWith&lt;br /&gt;
&lt;br /&gt;
data = { target=target, weapon=weapon, damtype=damtype, mult=mult, dam=dam, apr=apr, atk=atk, def=def, armor=armor}&lt;br /&gt;
&lt;br /&gt;
Triggers when processing an actor attack before the damage computation. &lt;br /&gt;
Useful to take into account bonuses of the attacker and/or the target. &lt;br /&gt;
data.target is the target being hit, other parameters should be self-evident.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''ToME:PlayerDumpJSON'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/PlayerDumpJSON.lua/dumpToJSON&lt;br /&gt;
&lt;br /&gt;
data = { title=title, js=js, tags=tags}&lt;br /&gt;
&lt;br /&gt;
I'm guessing its for appending something to the character data before it is sent to the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object:descCombat'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Object.lua/getTextualDesc&lt;br /&gt;
&lt;br /&gt;
data = { compare_with=compare_with, compare_fields=compare_fields, compare_table_fields=compare_table_fields, desc=desc, combat=combat}&lt;br /&gt;
&lt;br /&gt;
Useful for editing the combat stats in an objects tooltips.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object:descWielder'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Object.lua/getTextualDesc&lt;br /&gt;
&lt;br /&gt;
data = { compare_with=compare_with, compare_fields=compare_fields, compare_table_fields=compare_table_fields, desc=desc, w=w}&lt;br /&gt;
&lt;br /&gt;
Useful for editing the weilder stats in an objects tooltips.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object:descMisc'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Object.lua/getTextualDesc&lt;br /&gt;
&lt;br /&gt;
data = { compare_with=compare_with, compare_fields=compare_fields, compare_table_fields=compare_table_fields, desc=desc, object=self}&lt;br /&gt;
&lt;br /&gt;
Should you want to add anything right at the bottom of an items tooltip, this hook is for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object:descPowerSource'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Object.lua/getDesc&lt;br /&gt;
&lt;br /&gt;
data = { desc=desc, object=self}&lt;br /&gt;
&lt;br /&gt;
Want to add in new power sources? Use this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UISet:Minimalist:saveSettings'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/uiset/Minimalist.lua/saveSettings&lt;br /&gt;
&lt;br /&gt;
data = { lines=lines}&lt;br /&gt;
&lt;br /&gt;
Not sure, could be for adding framework for dealing with new settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UISet:Minimalist:Resources'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/uiset/Minimalist.lua/displayResources&lt;br /&gt;
&lt;br /&gt;
data = { a=a, player=player, x=x, y=y, bx=bx, by=by, orient=orient, scale=scale}&lt;br /&gt;
&lt;br /&gt;
Use for adding new resource bars.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UISet:Minimalist:Toolbar'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/uiset/Minimalist.lua/displayToolbar&lt;br /&gt;
&lt;br /&gt;
data = { x=x, y=y, bx=bx, by=by, orient=orient, scale=scale, tb_bg=tb_bg}&lt;br /&gt;
&lt;br /&gt;
Something for hooking code into the display of the toolbar. For what end, I have no idea.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DebugMain:use'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/debug/DebugMain.lua/use&lt;br /&gt;
&lt;br /&gt;
data = { act=act}&lt;br /&gt;
&lt;br /&gt;
Use to code new debug commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DebugMain:generate'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/debug/DebugMain.lua/generateList&lt;br /&gt;
&lt;br /&gt;
data = { menu=list}&lt;br /&gt;
&lt;br /&gt;
Use to add new commands to the debug menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DonationDialog:features'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/Donation.lua/init&lt;br /&gt;
&lt;br /&gt;
data = { list=donation_features}&lt;br /&gt;
&lt;br /&gt;
Use to add new features to the list of donator features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''GameOptions:HUDs'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/GameOptions.lua/generateList&lt;br /&gt;
&lt;br /&gt;
data = { huds=huds}&lt;br /&gt;
&lt;br /&gt;
Allows the addition of new HUD types to the HUD menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''PlayerLevelup:addTalentType'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/LevelupDialog.lua/learnType&lt;br /&gt;
&lt;br /&gt;
data = { actor=self.actor, tt=tt}&lt;br /&gt;
&lt;br /&gt;
Triggers when a player spends a category point in a category.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''PlayerLevelup:subTalentType'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/LevelupDialog.lua/learnType&lt;br /&gt;
&lt;br /&gt;
data = { actor=self.actor, tt=tt}&lt;br /&gt;
&lt;br /&gt;
Triggers when a player changes their mind and unspends a category point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''EquipInvenDialog:makeUI'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/ShowEquipInven.lua/init&lt;br /&gt;
&lt;br /&gt;
self:triggerHook{&amp;quot;EquipInvenDialog:makeUI&amp;quot;, uis=uis}&lt;br /&gt;
&lt;br /&gt;
Triggers during inventory screen creation. I guess it lets you edit it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UseItemMenu:use'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/UseItemDialog.lua/use&lt;br /&gt;
&lt;br /&gt;
data = { actor=self.actor, object=self.object, inven=self.inven, item=self.item, act=act, onuse=self.onuse}&lt;br /&gt;
&lt;br /&gt;
Use to add code for new menu items.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UseItemMenu:generate'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/UseItemDialog.lua/generateList&lt;br /&gt;
&lt;br /&gt;
data = { actor=self.actor, object=self.object, inven=self.inven, item=self.item, menu=list}&lt;br /&gt;
&lt;br /&gt;
Use to add new menu items to the item action menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''ToME:load'''&lt;br /&gt;
&lt;br /&gt;
/mod/load.lua&lt;br /&gt;
&lt;br /&gt;
data = { }&lt;br /&gt;
&lt;br /&gt;
This is where you load up new files for your addon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quest:escort:reward'''&lt;br /&gt;
&lt;br /&gt;
/data/chats/escort-quest.lua/reward_types&lt;br /&gt;
&lt;br /&gt;
data = { reward_types=reward_types}&lt;br /&gt;
&lt;br /&gt;
Allows editing of the escort rewards.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DamageProjector:base'''&lt;br /&gt;
&lt;br /&gt;
/data/damage_types.lua/setDefaultProjector&lt;br /&gt;
&lt;br /&gt;
data = { src=src, x=x, y=y, type=type, dam=dam}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DamageProjector:final'''&lt;br /&gt;
&lt;br /&gt;
/data/damage_types.lua/setDefaultProjector&lt;br /&gt;
&lt;br /&gt;
data = { src=src, x=x, y=y, type=type, dam=dam}&lt;br /&gt;
&lt;br /&gt;
These are similar, but trigger slightly differently. Both trigger when the damage projector is used to put damage on something, such as a spell or other effect. The first one triggers before any other skills &lt;br /&gt;
effects, or calculations are taken into consideration. The other one takes place after this is all done and right before the damage is actually applied. In both cases, data.src is the actor doing the damage, &lt;br /&gt;
data.x and data.y are the locations of the target, data.type is the damage type and data.dam is the actual amount of damage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quest:escort:assign'''&lt;br /&gt;
&lt;br /&gt;
/data/quests/escort-duty.lua/on_grant&lt;br /&gt;
&lt;br /&gt;
data = { possible_types=possible_types}&lt;br /&gt;
&lt;br /&gt;
This is where you add in (or remove) escortee types.&lt;/div&gt;</summary>
		<author><name>Ghostbuster</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Hooks&amp;diff=14633</id>
		<title>Hooks</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Hooks&amp;diff=14633"/>
				<updated>2018-02-05T23:03:46Z</updated>
		
		<summary type="html">&lt;p&gt;Ghostbuster: Changed the description of hook Combat:attackTarget that was clearly incorrect according to the code.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development]][[Category:Addons]]&lt;br /&gt;
For addons, hooks are a way of causing certain code to be triggered by events happening in the game.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
They are all used the same way, with &amp;quot;ToME:load&amp;quot; being replaced with the actual hook name:&lt;br /&gt;
&lt;br /&gt;
 class:bindHook(&amp;quot;ToME:load&amp;quot;, function(self, data)&lt;br /&gt;
 your code&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
If the hook function has any arguments, they are accessed through the data variable like data.argumentname .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a list of hooks currently available for addon creators and what they do.&lt;br /&gt;
&lt;br /&gt;
'''ToME:load'''&lt;br /&gt;
Triggers when ToME loads up.  Used to load an addons files into the game.  Must be included in every addon or the addon will not work!&lt;br /&gt;
There are a few important functions you'll want to trigger to make the magic happen.&lt;br /&gt;
&lt;br /&gt;
* ''Birther:loadDefinition'' will load a new race or class&lt;br /&gt;
* ''ActorTalents:loadDefinition'' will load new talents for your new race, class, or monster to use&lt;br /&gt;
* ''DamageType:loadDefinition'' will load new damage types for your talents to use&lt;br /&gt;
* ''ActorTemporaryEffects:loadDefinition'' will load new temporary effect, bad or good, to be used by talents and damage types&lt;br /&gt;
* ''WorldAchievements:loadDefinition'' loads new achievement.  Not commonly used in addons&lt;br /&gt;
* ''PlayerLore:loadDefinition'' adds new lore to be collected by the player.  Not commonly used in addons&lt;br /&gt;
* ''PartyIngredients:loadDefinition'' loads new ingredients to be collected by the player for reciptes.  Not commonly used in addons.&lt;br /&gt;
&lt;br /&gt;
So for example if we want a new class called &amp;quot;Pilgrim&amp;quot; with it's own unique talents, but no new damage types or effects, we could load it like so.&lt;br /&gt;
&lt;br /&gt;
 class:bindHook(&amp;quot;ToME:load&amp;quot;, function(self, data)&lt;br /&gt;
 ActorTalents:loadDefinition(&amp;quot;/data-classpack/talents/techniques/techniques-pilgrim.lua&amp;quot;)&lt;br /&gt;
 Birther:loadDefinition(&amp;quot;/data-classpack/birth/pilgrim.lua&amp;quot;)&lt;br /&gt;
 end)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Engine Hooks:==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Chat:Talkbox:command'''&lt;br /&gt;
&lt;br /&gt;
/dialogs/Talkbox.lua/okclick&lt;br /&gt;
&lt;br /&gt;
data = { command=command, params=params, talkbox=self}&lt;br /&gt;
&lt;br /&gt;
Allows the addition of new chat commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Entity:loadList'''&lt;br /&gt;
&lt;br /&gt;
/Entity.lua/loadList&lt;br /&gt;
&lt;br /&gt;
data = { file=file, no_default=no_default, res=res, mod=mod, loaded=loaded}&lt;br /&gt;
&lt;br /&gt;
Useful for adding new entries into a list file, without overwriting it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''MapGeneratorStatic:subgenRegister'''&lt;br /&gt;
&lt;br /&gt;
/generator/map/Static.lua/generate&lt;br /&gt;
&lt;br /&gt;
data = { mapfile=self.data.map, list=self.subgen}&lt;br /&gt;
&lt;br /&gt;
Something for adding in new things to map generation?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Module Hooks:==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:actBase:Effects'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/actBase&lt;br /&gt;
&lt;br /&gt;
data = { }&lt;br /&gt;
&lt;br /&gt;
Triggers when the actor does anything. Useful for anything with a constant effect. self is the actor doing the action.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:move'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/move&lt;br /&gt;
&lt;br /&gt;
data = { moved=moved, force=force, ox=ox, oy=oy}&lt;br /&gt;
&lt;br /&gt;
Triggers when an actor moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:takeHit'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/onTakeHit&lt;br /&gt;
&lt;br /&gt;
data = { value=value, src=src}&lt;br /&gt;
&lt;br /&gt;
Triggers when an actor is hit by something. It's useful mostly for talents and effects that alter or avoid damage being recieved on a particular actor. self in this case is the thing being hit. data.value &lt;br /&gt;
contains the amount of damage taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:preUseTalent'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/preUseTalent&lt;br /&gt;
&lt;br /&gt;
data = { t=ab, silent=silent, fale=fake}&lt;br /&gt;
&lt;br /&gt;
Triggers whenever an actor tries to use a talent, but before the talent is run. Useful for new resources or failure effects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:postUseTalent'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/postUseTalent&lt;br /&gt;
&lt;br /&gt;
data = { t=ab, ret=ret, trigger=trigger}&lt;br /&gt;
&lt;br /&gt;
Triggers after an actor successfully uses a talent. Useful for new resources types. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:getTalentFullDescription:ressources'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/getTalentFullDescription&lt;br /&gt;
&lt;br /&gt;
data = {str=d, t=t, addlevel=addlevel, config=config, fake_mastery=fake_mastery}&lt;br /&gt;
&lt;br /&gt;
This is where you add code to make your new resource display.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor:getTalentFullDescription'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Actor.lua/getTalentFullDescription&lt;br /&gt;
&lt;br /&gt;
data = { str=d, t=t, addlevel=addlevel, config=config, fake_mastery=fake_mastery}&lt;br /&gt;
&lt;br /&gt;
Let's you add something else just above the talent description.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''ToME:run'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Game.lua/run&lt;br /&gt;
&lt;br /&gt;
data = { }&lt;br /&gt;
&lt;br /&gt;
See ToME run. Run ToME run! Inserts code before the module starts running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Game:alterGameMenu'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Game.lua/setupCommands&lt;br /&gt;
&lt;br /&gt;
data = { menu=l, unregister=function() self:unregisterDialog(menu) end}&lt;br /&gt;
&lt;br /&gt;
Allows editing of the escape menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat:archeryAcquire'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Archery.lua/archeryAcquireTargets&lt;br /&gt;
&lt;br /&gt;
data = { tg=tg, params=params, weapon=weapon, ammo=a}&lt;br /&gt;
&lt;br /&gt;
Similar to Combat:attackTarget but with ranged weapons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat:archeryHit'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Archery.lua/archery_projectile&lt;br /&gt;
&lt;br /&gt;
data = { hitted=hitted, target=target, weapon=weapon, ammo=ammo, damtype=damtype, mult=mult, dam=dam}&lt;br /&gt;
&lt;br /&gt;
Triggers when a projectile hits an actor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat:attackTarget'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Combat.lua/attackTarget&lt;br /&gt;
&lt;br /&gt;
data = { target=target, damtype=damtype, mult=mult, noenergy=noenergy}&lt;br /&gt;
&lt;br /&gt;
Triggers when the actor starts to attack but before anything actually happens to weapons are taken into account. Useful for effects that prevent attacking. self is the actor trying to attack, data.target is his &lt;br /&gt;
target, data.damtype is the damage type being applied. &lt;br /&gt;
Return false to continue the attack without modifying it.&lt;br /&gt;
Return true to take into account changes made in the hook. &lt;br /&gt;
You can change data.mult and data.damtype to modify damage characteristics.&lt;br /&gt;
To cancel the attack set data.stop to true and data.hit to false and return true.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat:attackTargetWith'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Combat.lua/attackTargetWith&lt;br /&gt;
&lt;br /&gt;
data = { hitted=hitted, crit=crit, target=target, weapon=weapon, damtype=damtype, mult=mult, dam=dam}&lt;br /&gt;
&lt;br /&gt;
Triggers when the actor makes an attack after the weapon and whether it hits or not has been taken into account. Useful for just about any effect or skill that triggers on attack. self is the actor attacking, &lt;br /&gt;
data.target is the target being hit, data.hitted is whether or not the attack hit the target, and data.dam, data.damtype, and data.weapon should be self-evident.&lt;br /&gt;
&lt;br /&gt;
'''Combat:attackTargetWith:attackerBonuses'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/Combat.lua/attackTargetWith&lt;br /&gt;
&lt;br /&gt;
data = { target=target, weapon=weapon, damtype=damtype, mult=mult, dam=dam, apr=apr, atk=atk, def=def, armor=armor}&lt;br /&gt;
&lt;br /&gt;
Triggers when processing an actor attack before the damage computation. &lt;br /&gt;
Useful to take into account bonuses of the attacker and/or the target. &lt;br /&gt;
data.target is the target being hit, other parameters should be self-evident.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''ToME:PlayerDumpJSON'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/interface/PlayerDumpJSON.lua/dumpToJSON&lt;br /&gt;
&lt;br /&gt;
data = { title=title, js=js, tags=tags}&lt;br /&gt;
&lt;br /&gt;
I'm guessing its for appending something to the character data before it is sent to the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object:descCombat'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Object.lua/getTextualDesc&lt;br /&gt;
&lt;br /&gt;
data = { compare_with=compare_with, compare_fields=compare_fields, compare_table_fields=compare_table_fields, desc=desc, combat=combat}&lt;br /&gt;
&lt;br /&gt;
Useful for editing the combat stats in an objects tooltips.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object:descWielder'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Object.lua/getTextualDesc&lt;br /&gt;
&lt;br /&gt;
data = { compare_with=compare_with, compare_fields=compare_fields, compare_table_fields=compare_table_fields, desc=desc, w=w}&lt;br /&gt;
&lt;br /&gt;
Useful for editing the weilder stats in an objects tooltips.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object:descMisc'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Object.lua/getTextualDesc&lt;br /&gt;
&lt;br /&gt;
data = { compare_with=compare_with, compare_fields=compare_fields, compare_table_fields=compare_table_fields, desc=desc, object=self}&lt;br /&gt;
&lt;br /&gt;
Should you want to add anything right at the bottom of an items tooltip, this hook is for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Object:descPowerSource'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/Object.lua/getDesc&lt;br /&gt;
&lt;br /&gt;
data = { desc=desc, object=self}&lt;br /&gt;
&lt;br /&gt;
Want to add in new power sources? Use this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UISet:Minimalist:saveSettings'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/uiset/Minimalist.lua/saveSettings&lt;br /&gt;
&lt;br /&gt;
data = { lines=lines}&lt;br /&gt;
&lt;br /&gt;
Not sure, could be for adding framework for dealing with new settings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UISet:Minimalist:Resources'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/uiset/Minimalist.lua/displayResources&lt;br /&gt;
&lt;br /&gt;
data = { a=a, player=player, x=x, y=y, bx=bx, by=by, orient=orient, scale=scale}&lt;br /&gt;
&lt;br /&gt;
Use for adding new resource bars.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UISet:Minimalist:Toolbar'''&lt;br /&gt;
&lt;br /&gt;
/mod/class/uiset/Minimalist.lua/displayToolbar&lt;br /&gt;
&lt;br /&gt;
data = { x=x, y=y, bx=bx, by=by, orient=orient, scale=scale, tb_bg=tb_bg}&lt;br /&gt;
&lt;br /&gt;
Something for hooking code into the display of the toolbar. For what end, I have no idea.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DebugMain:use'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/debug/DebugMain.lua/use&lt;br /&gt;
&lt;br /&gt;
data = { act=act}&lt;br /&gt;
&lt;br /&gt;
Use to code new debug commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DebugMain:generate'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/debug/DebugMain.lua/generateList&lt;br /&gt;
&lt;br /&gt;
data = { menu=list}&lt;br /&gt;
&lt;br /&gt;
Use to add new commands to the debug menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DonationDialog:features'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/Donation.lua/init&lt;br /&gt;
&lt;br /&gt;
data = { list=donation_features}&lt;br /&gt;
&lt;br /&gt;
Use to add new features to the list of donator features.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''GameOptions:HUDs'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/GameOptions.lua/generateList&lt;br /&gt;
&lt;br /&gt;
data = { huds=huds}&lt;br /&gt;
&lt;br /&gt;
Allows the addition of new HUD types to the HUD menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''PlayerLevelup:addTalentType'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/LevelupDialog.lua/learnType&lt;br /&gt;
&lt;br /&gt;
data = { actor=self.actor, tt=tt}&lt;br /&gt;
&lt;br /&gt;
Triggers when a player spends a category point in a category.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''PlayerLevelup:subTalentType'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/LevelupDialog.lua/learnType&lt;br /&gt;
&lt;br /&gt;
data = { actor=self.actor, tt=tt}&lt;br /&gt;
&lt;br /&gt;
Triggers when a player changes their mind and unspends a category point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''EquipInvenDialog:makeUI'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/ShowEquipInven.lua/init&lt;br /&gt;
&lt;br /&gt;
self:triggerHook{&amp;quot;EquipInvenDialog:makeUI&amp;quot;, uis=uis}&lt;br /&gt;
&lt;br /&gt;
Triggers during inventory screen creation. I guess it lets you edit it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UseItemMenu:use'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/UseItemDialog.lua/use&lt;br /&gt;
&lt;br /&gt;
data = { actor=self.actor, object=self.object, inven=self.inven, item=self.item, act=act, onuse=self.onuse}&lt;br /&gt;
&lt;br /&gt;
Use to add code for new menu items.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''UseItemMenu:generate'''&lt;br /&gt;
&lt;br /&gt;
/mod/dialogs/UseItemDialog.lua/generateList&lt;br /&gt;
&lt;br /&gt;
data = { actor=self.actor, object=self.object, inven=self.inven, item=self.item, menu=list}&lt;br /&gt;
&lt;br /&gt;
Use to add new menu items to the item action menu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''ToME:load'''&lt;br /&gt;
&lt;br /&gt;
/mod/load.lua&lt;br /&gt;
&lt;br /&gt;
data = { }&lt;br /&gt;
&lt;br /&gt;
This is where you load up new files for your addon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quest:escort:reward'''&lt;br /&gt;
&lt;br /&gt;
/data/chats/escort-quest.lua/reward_types&lt;br /&gt;
&lt;br /&gt;
data = { reward_types=reward_types}&lt;br /&gt;
&lt;br /&gt;
Allows editing of the escort rewards.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DamageProjector:base'''&lt;br /&gt;
&lt;br /&gt;
/data/damage_types.lua/setDefaultProjector&lt;br /&gt;
&lt;br /&gt;
data = { src=src, x=x, y=y, type=type, dam=dam}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DamageProjector:final'''&lt;br /&gt;
&lt;br /&gt;
/data/damage_types.lua/setDefaultProjector&lt;br /&gt;
&lt;br /&gt;
data = { src=src, x=x, y=y, type=type, dam=dam}&lt;br /&gt;
&lt;br /&gt;
These are similar, but trigger slightly differently. Both trigger when the damage projector is used to put damage on something, such as a spell or other effect. The first one triggers before any other skills &lt;br /&gt;
effects, or calculations are taken into consideration. The other one takes place after this is all done and right before the damage is actually applied. In both cases, data.src is the actor doing the damage, &lt;br /&gt;
data.x and data.y are the locations of the target, data.type is the damage type and data.dam is the actual amount of damage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quest:escort:assign'''&lt;br /&gt;
&lt;br /&gt;
/data/quests/escort-duty.lua/on_grant&lt;br /&gt;
&lt;br /&gt;
data = { possible_types=possible_types}&lt;br /&gt;
&lt;br /&gt;
This is where you add in (or remove) escortee types.&lt;/div&gt;</summary>
		<author><name>Ghostbuster</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=14632</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=14632"/>
				<updated>2018-02-05T18:48:34Z</updated>
		
		<summary type="html">&lt;p&gt;Ghostbuster: Fixed an error in callBack OnArcheryHit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development]][[Category:Addons]]&lt;br /&gt;
&amp;lt;big&amp;gt;Callbacks allow you to execute a batch of code at certain points of the game. Such as when you're healed, when you're taking damage, or when you've moved.&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Callbacks can be used in Talents, Timed Effects, or Items. &lt;br /&gt;
Callbacks only happen if;&lt;br /&gt;
&lt;br /&gt;
An Actor has the Talent learnt, if its an Active or Passive.&lt;br /&gt;
&lt;br /&gt;
An Actor has the Talent sustained, if its a Sustain.&lt;br /&gt;
&lt;br /&gt;
An Actor has the Timed Effect on them.&lt;br /&gt;
&lt;br /&gt;
An Actor has the item equipped.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent, timed effect, or item like you would any function.&lt;br /&gt;
&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after your first two arguments.&lt;br /&gt;
&lt;br /&gt;
Talent callbacks use (self, t)&lt;br /&gt;
&lt;br /&gt;
Timed Effect callbacks use (self, eff)&lt;br /&gt;
&lt;br /&gt;
Item callbacks use (self, who)&lt;br /&gt;
&lt;br /&gt;
In the case of Item callbacks, 'self' refers to the item itself, while 'who' refers to the actor wearing said item.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Provided below is a simple example of a Talent callback.&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
 &lt;br /&gt;
However, converting this into an Item callback is slightly more tricky. First you must change 't' to 'who' (which is the actor wearing the item). You would than need to change all references to 'self' in the code to 'who' to achive the same effect, as 'self' now refers to the item this callback is attached to.&lt;br /&gt;
&lt;br /&gt;
                      callbackOnMeleeAttack = function(self, who, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               who:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, target, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
target(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(summon, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;summon(our summon)&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who we killed)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(dam, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;(dam, damage dealt. src, who hit us?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who failed to hit us?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This callback expects you to return a table. For our example's case, our table will be called 'data'.&lt;br /&gt;
&lt;br /&gt;
You may return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
If stopped is a numerical value, the damage dealt will be set to this value before stopping.&lt;br /&gt;
&lt;br /&gt;
stopped has a higher priority than dam, and dam will not directly impact stopped.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ghostbuster</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Resource&amp;diff=9904</id>
		<title>Resource</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Resource&amp;diff=9904"/>
				<updated>2015-12-10T17:02:57Z</updated>
		
		<summary type="html">&lt;p&gt;Ghostbuster: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Game Mechanics]] [[Category:Resources]]&lt;br /&gt;
&lt;br /&gt;
{{Spoilers}}&lt;br /&gt;
&lt;br /&gt;
Resources are power pools used for various [[talents]] in ToME 4.  There are several different kinds of resources, and some of them have unique behaviors. Several resources are affected by [[Fatigue]].&lt;br /&gt;
&lt;br /&gt;
==Air==&lt;br /&gt;
Only appears when you can't breathe for some reason. Being underwater, in a wall, or buried in sand will generally prevent you from breathing. You take an increasingly large amount of damage each turn after reaching 0 Air. Some items allow you to breathe underwater, or remove the need to breathe at all.  Some underwater areas will have bubbles that can restore air until they are depleted.&lt;br /&gt;
&lt;br /&gt;
Most characters have 100 air, with [[yeek]] characters having 200.  Two artifacts, [[Coral Spray]] and [[Vargh Redemption]] will raise the cap by 50 air. &lt;br /&gt;
* The first turn you are underwater your air will drop by 5 and will then decrease by 2 each subsequent turn.&lt;br /&gt;
* The first turn you are in a wall your air will drop by 20 and will then decrease by 17 each subsequent turn.&lt;br /&gt;
* The first turn you are buried in sand your air will drop by 10 and will then decrease by 7 each subsequent turn.&lt;br /&gt;
* When you can breathe again normally you regain 3 air per turn.&lt;br /&gt;
* Underwater bubbles will restore 20 per turn (minus the loss of 2 from being underwater, for a total gain of 18).&lt;br /&gt;
* When your air runs out you begin taking damage. The first turn it is 20% of your max life and it increases by 5% each turn (so 25% on the second turn, 30% on the third). This is quickly fatal.&lt;br /&gt;
&lt;br /&gt;
==Equilibrium==&lt;br /&gt;
Equilibrium is the [[resources|resource]] used by the [[Wild-gift (category type)|Wild Gift]] talents, and represents how far the character is out of balance with Nature.  It is sometimes abbreviated &amp;quot;EQ&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Equilibrium starts at 0, and is raised by talent use; a high Equilibrium increases the chance of failure. If Equilibrium exceeds [[Willpower]], an attempt to use a Wild Gift talent has a (sqrt(Equilibrium - Willpower) / 60) chance to fizzle, causing the loss of a turn.&lt;br /&gt;
&lt;br /&gt;
Equilibrium does not naturally reduce itself over time, but it can be restored by:&lt;br /&gt;
* Walking on the wilderness map&lt;br /&gt;
* Standing in the area of effect of a Font of Life&lt;br /&gt;
* [[Meditation (talent)|Meditating]]&lt;br /&gt;
* [[Swallow (talent)|Swallowing]] enemies&lt;br /&gt;
* Being hit while [[Resolve (talent)|Resolve]] is active but [[Antimagic shield (talent)|Antimagic Shield]] is not&lt;br /&gt;
* Coming under a life regeneration effect while under the influence of [[Ancestral life (talent)|Ancestral Life]]&lt;br /&gt;
* Being hit while wearing various [[egos|equipment with on-hit EQ regeneration]]&lt;br /&gt;
&lt;br /&gt;
Note that if a player/creature has an [[Equilibrium]] bar, using [[Vim|Vim-based]] talents will increase it by a noticeable amount.&lt;br /&gt;
&lt;br /&gt;
==Feedback==&lt;br /&gt;
Feedback represents using pain as a means of psionic grounding and it can be used to power feedback abilities. Characters that have the feedback resource will gain feedback in proportion to any damage received. The base conversion rate depends on character level: it starts at 50% at level 1, and decays to 20% at level 50. Feedback is used by the [[Solipsist]]'s [[Feedback (category)|Feedback]] and [[Discharge (category)|Discharge]] talent trees. It decays at the rate of 10% or 1 per turn (whichever is greater).&lt;br /&gt;
&lt;br /&gt;
==Hate==&lt;br /&gt;
Hate is the [[resources|resource]] used by the Afflicted classes, the [[Cursed]] and the [[Doomed]].  Hate does not regenerate, and even decays over time.  It is mainly recovered while fighting.  Hate is affected by [[fatigue]].&lt;br /&gt;
&lt;br /&gt;
You can have up to 100 points of hate. Afflicted suffer from reduced healing while not at maximum hate -- by 50% at zero hate.  Your Hate slowly decays (more quickly when the level is higher), down to a minimum of half your Hate at the end of the most recent combat.  The strengths of many abilities also depend on your level of Hate.&lt;br /&gt;
&lt;br /&gt;
Here are some ways Hate is regained:&lt;br /&gt;
&lt;br /&gt;
* '''Kill something''': 8 points, more for higher [[rank]] -- 24 points for a boss&lt;br /&gt;
* '''Take a big hit''' (over 15% of your maximum life): 2 points + 2 points per 5% life lost above 15%&lt;br /&gt;
* '''Take a hit while at low health''' (under 25% of maximum life): 4 points&lt;br /&gt;
* '''Do massive damage''' (over 33% in one hit)&lt;br /&gt;
&lt;br /&gt;
The Doomed [[Dark sustenance (category)|Dark Sustenance]] tree has the talent [[Feed (talent)|Feed]], which can be used to replenish hate.  Various Cursed talents also give Hate bonuses.&lt;br /&gt;
&lt;br /&gt;
==Life==&lt;br /&gt;
{{:Life}}&lt;br /&gt;
&lt;br /&gt;
==Mana==&lt;br /&gt;
Used by most of the magical spell talents.  It works much like Spell Points or Mana in most other RPGs.  Only Mage classes can regenerate Mana naturally. Certain class talents and gear can grant passive Mana regen, and having a Manasurge rune inscribed will grant some passive regen while resting. Your maximum increases with level (+4 per level), gear, and [[Willpower]] (+5 per point).&lt;br /&gt;
&lt;br /&gt;
==Necrotic==&lt;br /&gt;
Used by [[Necromancer|Necromancers]], and represents the number of souls caught within the necrotic aura.  Each soul can become an undead minion.  The pool is replenished by killing living beings within the necrotic aura.&lt;br /&gt;
&lt;br /&gt;
==Negative energy==&lt;br /&gt;
Negative energy is the power source for predominantly-[[Anorithil]] talents.  [[Necromancer]]s can also get access to the tree by becoming a [[Lich]].&lt;br /&gt;
&lt;br /&gt;
It can be replenished by Anorithil using:&lt;br /&gt;
* [[Twilight (talent)|Twilight]]: 15 positive, 6 cooldown, recover (20 + 0.4 * talent * cunning) negative energy&lt;br /&gt;
* [[Twilight surge (talent)|Twilight Surge]]: recover 20 negative and 10 positive energy&lt;br /&gt;
among other ways.&lt;br /&gt;
&lt;br /&gt;
Liches will regenerate negative energy over time, whereas Anorithil and Adventurers lose negative energy over time.&lt;br /&gt;
&lt;br /&gt;
Maximum negative energy is increased by 3 whenever a character gains a level.&lt;br /&gt;
&lt;br /&gt;
==Paradox==&lt;br /&gt;
Paradox is the resource used by the Chronomancy talents. It is somewhat like [[Equilibrium]] -- it starts at 0, and increases as talents are used. High paradox causes failures, anomalies, and backfires, but also increases the power of some talents. The damage (and sometimes duration, etc) of most Chronomancy talents is multiplied by a &amp;quot;paradox modifier&amp;quot; determined by the following formula: sqrt(0.5 + Paradox / 600).&lt;br /&gt;
&lt;br /&gt;
The cost of active paradox talents increases the higher your paradox already is; it is multiplied by 1 + (Paradox / 300).&lt;br /&gt;
&lt;br /&gt;
Paradox failures simply cause you to lose a turn like equilibrium failures. However, unlike equilibrium failures, your paradox still increases by the cost of the talent that failed.&lt;br /&gt;
&lt;br /&gt;
If an anomaly occurs, not only do you lose the turn and talent, but a random Anomaly talent is used. Your paradox is also reduced by twice the cost of the talent that failed. Anomaly chance is rolled before failure chance.&lt;br /&gt;
&lt;br /&gt;
If a backfire occurs, the talent targets the caster.&lt;br /&gt;
&lt;br /&gt;
To calculate paradox failure, anomaly, and backfire chance, first calculate modified paradox by the following formula: (Paradox - [[Willpower]] * Willpower_modifier). Some items, such as the Shard of Crystallized Time, add directly to the Willpower stat used in this calculation, as does Temporal Form. Willpower_modifier is 1 + ([[Paradox mastery (talent)|Paradox Mastery]] talent level / 10).&lt;br /&gt;
&lt;br /&gt;
Then calculate the fatigue modifier: (100 + 2 * [[Fatigue]]) / 100.&lt;br /&gt;
&lt;br /&gt;
Failures can only occur if modified paradox is over 200; if so, the chance is ceil(fatigue_modifier * (modified_paradox / 200)^2).&lt;br /&gt;
&lt;br /&gt;
Anomalies can only occur if modified paradox is over 300; if so, the chance is ceil(fatigue_modifier * (modified_paradox / 300)^3).&lt;br /&gt;
&lt;br /&gt;
Backfires can only occur if modified paradox is over 400; if so, the chance is ceil(fatigue_modifier * (modified_paradox / 400)^4).&lt;br /&gt;
&lt;br /&gt;
==Positive energy==&lt;br /&gt;
Positive energy is a resource used by both of the [[Celestial (Metaclass)|Celestial]] classes (the [[Sun Paladin|Sun Paladins]] and [[Anorithil]]). Many early talents will actually replenish it rather than drain it, shown as negative numbers in costs.  It decreases over time if not used.&lt;br /&gt;
&lt;br /&gt;
The size of the positive energy pool (max positive energy) is increased by 3 whenever a character gains a level.&lt;br /&gt;
&lt;br /&gt;
==Psi==&lt;br /&gt;
Psi is the resource used by Psionic classes, such as [[Solipsist]] and [[Mindslayer]]. It slowly regenerates over time, can be restored by talents and some equipment. Mind damage type reduces psi (if left) instead of health. Players can increase psi pool by raising willpower (+1 per point invested in willpower except for the [[Solipsist]] class).&lt;br /&gt;
&lt;br /&gt;
==Stamina==&lt;br /&gt;
Stamina is the resource used by most physical talents.  It is regenerated at a rate of 0.3 per turn if there are no other modifiers.  Resting will accelerate the rate at which stamina is recovered. Stamina capacity is increased by raising willpower (+2.5 max stamina per point) and when gaining a level (+3 max stamina per level).&lt;br /&gt;
&lt;br /&gt;
==Vim==&lt;br /&gt;
Vim is the resource used by the [[Defiler]] metaclass.  Vim does not regenerate but is instead regained in several ways, all involving combat.  [[Fatigue]] plays no role in determining vim costs.  The vim pool grows by 4 points every level and is not influenced by any stats.&lt;br /&gt;
&lt;br /&gt;
Ways of regaining vim:&lt;br /&gt;
&lt;br /&gt;
* '''Kill bounty:''' Each kill returns one point of vim per 20 [[Willpower]].&lt;br /&gt;
* '''Kill refunds:''' If you kill something directly with a vim-using talent, the talents cost in vim is restored. This ''only'' works with straight damage -- infecting someone with a disease won't return any vim this way, even if your victim dies from it three rounds later.  Though if you kill something with a Bone Nova, for example, you will get its cost refunded.&lt;br /&gt;
* '''Special Talents:''' Some talents can also restore your vim, such as [[Drain (talent)|Drain]] and [[Leech (talent)|Leech]].&lt;/div&gt;</summary>
		<author><name>Ghostbuster</name></author>	</entry>

	</feed>