Difference between revisions of "Manual:DIL Manual/meleedamage()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import of LLM wiki pages)
(XML import)
 
Line 1: Line 1:
−
 
−
 
 
<span id="bfmeleedamage"></span>
 
<span id="bfmeleedamage"></span>
  
Line 37: Line 35:
  
 
  code
 
  code
−
{
+
dilend
−
    if ((self.type == UNIT_ST_PC) and (self.weapons[WPN_KICK] &lt;= 0))
 
−
    {
 
−
      act("You must practice first.", A_ALWAYS, self, null, null, TO_CHAR);
 
−
      quit;
 
−
    }
 
  
−
    if (arg == "")
+
---~---~---~---~---~---~---~---~---
−
    {
 
−
      if (self.fighting)
 
−
      {
 
−
          targ := self.fighting;
 
−
          goto kick;
 
−
      }
 
  
−
      act("Kick who?", A_SOMEONE, self, null, null, TO_CHAR);
+
</i><!--ENDCODE-->
−
      quit;
+
<span id="bfmeleedamage"></span>
−
    }
 
  
−
    targ := findunit(self, arg, FIND_UNIT_SURRO, null);
+
'''Function: '''
 +
<i><!--CODE-->meleedamage ( c : unitptr, v : unitptr, b : integer, wt : integer );</i><!--ENDCODE-->
  
−
    if ((targ == null) or not visible(self, targ))
+
<!--TERM-->  '''c'''
−
    {
+
<!--DEFINITION-->        the character that should make an additional attack
−
      act("That person is not here!", A_SOMEONE, self, null, null, TO_CHAR);
+
<!--TERM-->  '''v'''
−
      quit;
+
<!--DEFINITION-->        the character being attacked
−
    }
+
<!--TERM-->  '''b'''
 +
<!--DEFINITION-->        any penalty or bonus added to the attack.
 +
<!--TERM-->  '''wt'''
 +
<!--DEFINITION-->        the weapon type of the attack, if a valid type then that is used for the attack purpose, otherwise the default weapon/hand attack is used.
 +
<!--TERM-->  '''returns'''
 +
<!--DEFINITION-->        The amount of damage done or -1 for failed
  
−
    if (not (targ.type &amp; (UNIT_ST_PC | UNIT_ST_NPC)))
+
ch' performs an attack (using whatever weapon is wielded or his bare hands) against 'vict'.
−
    {
+
If wtype is within a valid weapon range (WPN_XXX) any weapon will be bypassed,
−
      act("You can't kick that, silly!", A_SOMEONE, self, null, null,
+
and the value will be used as the attacktype. Good for things like "meleeattack
−
          TO_CHAR);
+
(ch, vict, bonus, WPN_CIRCLE_KICK)"  If you want person to be able to perform an
−
      quit;
+
extra attack even though wielding a weapon or something.  Note that this will
−
    }
+
require BOTH a weapon type WPN_CIRCLE_KICK and a skill "kick" in order for it to
 +
work.
 +
'''Example:'''
 +
<i><!--CODE-->
 +
---~---~---~---~---~---~---~---~---
  
−
    if (targ == self)
+
dilbegin kick(arg : string);
−
     {
+
external
−
      act("You kick yourself.", A_HIDEINV, self, null, null,
+
     provoked_attack (victim : unitptr, ch : unitptr);
−
          TO_CHAR);
 
−
      act("$1n kicks $1mself.", A_HIDEINV, self, null, null,
 
−
          TO_ROOM);
 
−
      quit;
 
−
    }
 
  
−
     if ((targ.type==UNIT_ST_PC) and
+
var
−
     (self.type==UNIT_ST_PC))
+
     bonus : integer;
−
  {
+
     targ : unitptr;
−
  if (not(isset (self.pcflags, PC_PK_RELAXED)))
 
−
  {
 
−
  act ("You are not allowed to do this unless you sign the book of blood.",
 
−
  A_ALWAYS,self,null,null,TO_CHAR);
 
−
  quit;
 
−
  }
 
  
−
  if (not(isset (targ.pcflags, PC_PK_RELAXED)))
+
  code
−
  {
+
dilend
−
  act ("You are not allowed to do this unless $2e signs the book of blood.",
 
−
  A_ALWAYS,self,targ,null,TO_CHAR);
 
−
  quit;
 
−
  }
 
−
  }
 
−
 
 
−
 
 
−
    :kick:
 
−
    /* Penalty for wielding a weapon while kicking! */
 
−
    if (equipment(self, WEAR_WIELD))
 
−
      bonus := -25;
 
−
    else
 
−
      bonus := +25;
 
−
    if (self.endurance &lt; 2)
 
−
      act("You are too exhausted to attempt that.", A_ALWAYS, self, null,
 
−
          null, TO_CHAR);
 
−
    else self.endurance := self.endurance - 2;
 
−
    provoked_attack (targ, self);
 
−
    bonus := meleeattack(self, targ, (bonus+self.level), WPN_KICK);
 
−
    quit;
 
−
}
 
−
dilend
 
  
 
  ---~---~---~---~---~---~---~---~---
 
  ---~---~---~---~---~---~---~---~---
  
 
  </i><!--ENDCODE-->
 
  </i><!--ENDCODE-->

Latest revision as of 22:30, 4 December 2025

Function:  
meleedamage ( c : unitptr, v : unitptr, b : integer, wt : integer );
  c
         the character that should make an additional attack
  v
         the character being attacked
  b
         any penalty or bonus added to the attack.
  wt
         the weapon type of the attack, if a valid type then that is used for the attack purpose, otherwise the default weapon/hand attack is used.
  returns
         The amount of damage done or -1 for failed
ch' performs an attack (using whatever weapon is wielded or his bare hands) against 'vict'.
If wtype is within a valid weapon range (WPN_XXX) any weapon will be bypassed,
and the value will be used as the attacktype.  Good for things like "meleeattack
(ch, vict, bonus, WPN_CIRCLE_KICK)"  If you want person to be able to perform an
extra attack even though wielding a weapon or something.  Note that this will
require BOTH a weapon type WPN_CIRCLE_KICK and a skill "kick" in order for it to
work.
Example:

---~---~---~---~---~---~---~---~---
dilbegin kick(arg : string);
external
   provoked_attack (victim : unitptr, ch : unitptr);
var
   bonus : integer;
   targ  : unitptr;
code

dilend

---~---~---~---~---~---~---~---~---

Function:  
meleedamage ( c : unitptr, v : unitptr, b : integer, wt : integer );
  c
         the character that should make an additional attack
  v
         the character being attacked
  b
         any penalty or bonus added to the attack.
  wt
         the weapon type of the attack, if a valid type then that is used for the attack purpose, otherwise the default weapon/hand attack is used.
  returns
         The amount of damage done or -1 for failed
ch' performs an attack (using whatever weapon is wielded or his bare hands) against 'vict'.
If wtype is within a valid weapon range (WPN_XXX) any weapon will be bypassed,
and the value will be used as the attacktype.  Good for things like "meleeattack
(ch, vict, bonus, WPN_CIRCLE_KICK)"  If you want person to be able to perform an
extra attack even though wielding a weapon or something.  Note that this will
require BOTH a weapon type WPN_CIRCLE_KICK and a skill "kick" in order for it to
work.
Example:

---~---~---~---~---~---~---~---~---
dilbegin kick(arg : string);
external
   provoked_attack (victim : unitptr, ch : unitptr);
var
   bonus : integer;
   targ  : unitptr;
code

dilend

---~---~---~---~---~---~---~---~---