Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

kick.c

Go to the documentation of this file.
00001 #if defined(macintosh)
00002 #include <types.h>
00003 #else
00004 #include <sys/types.h>
00005 #endif
00006 #include <stdio.h>
00007 #include <string.h>
00008 #include <time.h>
00009 #include "merc.h"
00010 #include "interp.h"
00011 #include "tables.h"
00012 #include "lookup.h"
00013 
00014 void do_side_kick(CHAR_DATA *ch, char *argument) {
00015     CHAR_DATA *victim;
00016     int chance=0;
00017 
00018     if (!IS_NPC(ch) &&   ch->level < 
00019              skill_table[gsn_side_kick].skill_level[ch->class]) 
00020     {
00021         send_to_char("You better leave the martial arts to monks.\n\r", ch);
00022     return;
00023     }
00024 
00025     if (argument[0] == '\0') 
00026     {
00027         victim = ch->fighting;
00028         if (victim == NULL) 
00029         {
00030             send_to_char("But you aren't fighting anyone!\n\r",ch);
00031             return;
00032         }
00033     }
00034     else if ((victim = get_char_room(ch,argument)) == NULL) 
00035     {
00036         send_to_char("They aren't here.\n\r",ch);
00037         return;
00038     }
00039 
00040     if (victim->position < POS_FIGHTING) 
00041     {
00042         act("You'll have to let $M get back up first.",ch,NULL,victim,TO_CHAR);
00043         return;
00044     }
00045 
00046     if (victim == ch) 
00047     {
00048         send_to_char("You try to kick your own head, but fail.\n\r",ch);
00049         return;
00050     }
00051 
00052     if ( IS_NPC(victim) && victim->fighting != NULL && 
00053             !is_same_group(ch,victim->fighting)) 
00054     {
00055           send_to_char("Kill stealing is not permitted.\n\r",ch);
00056           return;
00057     }
00058 
00059     if (IS_AFFECTED(ch,AFF_CHARM) && ch->master == victim) 
00060     {
00061         act("But $N is your friend!",ch,NULL,victim,TO_CHAR);
00062         return;
00063     }
00064 
00065     WAIT_STATE( ch, skill_table[gsn_side_kick].beats );
00066 
00067     if ((get_skill(ch,gsn_side_kick) > number_percent()) 
00068             && damage(ch,victim,number_range(1,ch->level)*2,gsn_side_kick,DAM_OTHER,TRUE))
00069     {
00070         // changed it so that it does 2 times as much as normal kick
00071 //       damage(ch,victim,number_range(1, ch->level) * 2, 
00072 //               gsn_side_kick,DAM_OTHER,TRUE);
00073          check_improve(ch,gsn_side_kick,TRUE,1);
00074          // ok, we landed the kick, now do we land the stun?
00075          if (ch->size >= victim->size)
00076              //chance += (ch->size - victim->size) * 5;
00077              chance += 10;
00078          else
00079              //chance -= (ch->size - victim->size) * 5;
00080              chance -= 5;
00081          /* stats - str vs dex */
00082              chance += get_curr_stat(ch,STAT_STR) / 2;
00083          
00084          chance -= (get_curr_stat(victim,STAT_DEX))/5;
00085          
00086          //chance += (GET_AC(victim,AC_BASH) / 50);
00087          
00088          /* haste */
00089          if (IS_SET(ch->off_flags,OFF_FAST) || IS_AFFECTED(ch,AFF_HASTE))
00090              chance += 5;
00091          if (IS_SET(victim->off_flags,OFF_FAST) || 
00092                  IS_AFFECTED(victim,AFF_HASTE))
00093              chance -= 5;
00094          /* level */
00095              chance += (ch->level - victim->level);
00096          
00097          if (chance <= 0)
00098              chance =1;
00099 /*       if (!IS_NPC(victim) && chance > (get_skill(victim,gsn_dodge)/2)) 
00100          {
00101              act("$n's kick falls short.",ch,NULL,victim,TO_VICT);
00102              act("$N gracefully turns with the kick.",ch,NULL,victim,TO_CHAR);
00103              return;
00104          }*/
00105          if (number_percent() <= chance) 
00106          {
00107              act("$n knocks you to the ground with a powerful kick!", ch, NULL, victim, TO_VICT);
00108              act("Your leg slams into $N, and knocks $M to the ground!", ch, NULL, victim,TO_CHAR);
00109              act("$n sends $N to the ground with a powerful kick.", ch, NULL, victim, TO_NOTVICT);
00110              check_improve(ch, gsn_side_kick, TRUE, 1);
00111              DAZE_STATE(victim, 1 * PULSE_VIOLENCE);
00112              WAIT_STATE(ch,skill_table[gsn_side_kick].beats);
00113              victim->position = POS_RESTING;
00114          }
00115         //else if (!IS_NPC(victim) && chance > (get_skill(victim,gsn_dodge)/2))
00116         // {
00117         //       act("$n's kick falls short.",ch,NULL,victim,TO_VICT);
00118     //       act("$N gracefully turns with the kick.",ch,NULL,victim,TO_CHAR);
00119       //   }
00120          check_improve(ch, gsn_side_kick, FALSE, 1);
00121 
00122       
00123          
00124     }
00125     else 
00126     {
00127 //      damage(ch, victim, 0, gsn_side_kick,DAM_OTHER,TRUE);
00128         act ("$n's kick falls short.", ch,NULL,victim, TO_VICT);
00129         act("$N gracefully turns with the kick.", ch, NULL, victim, TO_CHAR);
00130         check_improve(ch,gsn_side_kick,FALSE,1);
00131     }
00132 
00133     check_killer(ch,victim);
00134     return;
00135 }
00136 

Generated on Thu Jan 13 21:48:11 2005 for Beyond the Shadows by  doxygen 1.4.0