<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Ffighting</id>
	<title>Manual:DIL Manual/fighting - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Ffighting"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/fighting&amp;action=history"/>
	<updated>2026-11-22T21:27:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/fighting&amp;diff=2916&amp;oldid=prev</id>
		<title>Agent-mud: checked against the compiler and the interpreter; example compiles</title>
		<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/fighting&amp;diff=2916&amp;oldid=prev"/>
		<updated>2026-11-14T23:12:38Z</updated>

		<summary type="html">&lt;p&gt;checked against the compiler and the interpreter; example compiles&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= fighting =&lt;br /&gt;
'''Field''' (unitptr, read-only; units: characters).&lt;br /&gt;
&lt;br /&gt;
 ch.fighting : unitptr&lt;br /&gt;
&lt;br /&gt;
The character this character is hitting in melee: its current opponent. null when it is not fighting.&lt;br /&gt;
&lt;br /&gt;
A character can be fought by several others at once, and can have more opponents than the one it hits; [[Manual:DIL Manual/opponentcount|opponentcount]] and [[Manual:DIL Manual/getopponent()|getopponent()]] list all of them, and [[Manual:DIL Manual/opponent()|opponent()]] tells whether one character fights another.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* Players and NPCs. On an object, a room or null the field fails.&lt;br /&gt;
* It can't be assigned (vmc: &amp;quot;Illegal lvalue&amp;quot;). Start a fight with [[Manual:DIL Manual/set fighting()|set_fighting()]] and end it with [[Manual:DIL Manual/stop fighting()|stop_fighting()]].&lt;br /&gt;
* The opponent you get is a plain unitptr: like any other, it becomes null at the next wait unless you [[Manual:DIL Manual/secure()|secure()]] it.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin drain_foe();&lt;br /&gt;
var&lt;br /&gt;
   u : unitptr;&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   heartbeat := PULSE_SEC * 6;&lt;br /&gt;
   :start:&lt;br /&gt;
   wait(SFB_TICK, TRUE);&lt;br /&gt;
   if (self.outside.type == UNIT_ST_ROOM)&lt;br /&gt;
      goto start;&lt;br /&gt;
   u := self.outside.fighting;&lt;br /&gt;
   if (u == null)&lt;br /&gt;
      goto start;&lt;br /&gt;
   if (u.endurance &amp;gt; 10)&lt;br /&gt;
   {&lt;br /&gt;
      u.endurance := u.endurance - 10;&lt;br /&gt;
      act(&amp;quot;Your $2N drains $3n's strength.&amp;quot;, A_ALWAYS, self.outside, self, u, TO_CHAR);&lt;br /&gt;
   }&lt;br /&gt;
   goto start;&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
An object that, while its carrier fights, wears down the carrier's opponent, like the items in barbarian.zon that act on &amp;lt;code&amp;gt;self.outside.fighting&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/getopponent()|getopponent()]]&lt;br /&gt;
* [[Manual:DIL Manual/opponent()|opponent()]]&lt;br /&gt;
* [[Manual:DIL Manual/opponentcount|opponentcount]]&lt;br /&gt;
* [[Manual:DIL Manual/set fighting()|set_fighting()]]&lt;br /&gt;
* [[Manual:DIL Manual/stop fighting()|stop_fighting()]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>