Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.81 KB | None | 0 0
  1. void do_hitall( CHAR_DATA* ch, const char* argument )
  2. {
  3. CHAR_DATA* vch;
  4. CHAR_DATA* vch_next;
  5. sh_int nvict = 0;
  6. sh_int nhit = 0;
  7.  
  8. if ( xIS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
  9. {
  10. send_to_char_color( "&BA godly force prevents you.\n\r", ch );
  11. return;
  12. }
  13.  
  14. if ( !ch->in_room->first_person )
  15. {
  16. send_to_char( "There's no one else here!\n\r", ch );
  17. return;
  18. }
  19.  
  20. for ( vch = ch->in_room->first_person; vch; vch = vch_next )
  21. vch_next = vch->next_in_room;
  22.  
  23. if ( is_same_group( ch, vch ) || !is_legal_kill( ch, vch ) ||
  24. !can_see( ch, vch ) || is_safe( ch, vch, TRUE ) )
  25. continue;
  26.  
  27. if ( !IS_NPC( vch ) )
  28. continue;
  29.  
  30. if ( who_fighting( vch ) != NULL )
  31. continue;
  32.  
  33. if ( check_illegal_pk( ch, vch ) )
  34. continue;
  35.  
  36. nvict++;
  37. }
  38.  
  39. if ( ch->mana < ( ch->max_mana * ( 0.007 * nvict ) ) )
  40. {
  41. send_to_char( "You do not have enough ki to attack everyone.\n\r", ch );
  42. return;
  43. }
  44.  
  45. /*
  46. if ( nvict == 1 )
  47. {
  48. send_to_char( "Theres only 1 target, why don't you just kill them?\n\r", ch );
  49. return;
  50. }
  51. */
  52.  
  53. if ( !nvict )
  54. {
  55. send_to_char( "There's no one else here to attack!\n\r", ch );
  56. return;
  57. }
  58.  
  59. for ( vch = ch->in_room->first_person; vch; vch = vch_next )
  60. {
  61. vch_next = vch->next_in_room;
  62.  
  63. if ( is_same_group( ch, vch ) || !is_legal_kill( ch, vch ) ||
  64. !can_see( ch, vch ) || is_safe( ch, vch, TRUE ) )
  65. continue;
  66.  
  67. if ( !IS_NPC( vch ) )
  68. continue;
  69.  
  70. if ( who_fighting( vch ) != NULL )
  71. continue;
  72.  
  73. if ( check_illegal_pk( ch, vch ) )
  74. continue;
  75.  
  76. if ( can_use_skill( ch, number_percent( ), gsn_hitall ) )
  77. {
  78. nhit++;
  79. if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MIRRORPL ) )
  80. {
  81. if ( ( long double ) ch->pl > ( long double ) vch->pl )
  82. {
  83. vch->exp = ch->pl;
  84. vch->pl = ch->pl;
  85. }
  86.  
  87. if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MIRRORHP ) )
  88. {
  89. if ( ch->hit > vch->hit )
  90. {
  91. if ( !vch->fighting )
  92. {
  93. vch->hit = ch->hit;
  94. vch->max_hit = ch->hit;
  95. }
  96. }
  97. }
  98. if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MIRRORSTAT ) )
  99. {
  100. if ( get_curr_str( ch ) > get_curr_str( vch ) )
  101. {
  102. vch->perm_str = get_perm_stat( 0, ch );
  103. vch->mod_str = ch->mod_str;
  104. }
  105.  
  106. if ( get_curr_dex( ch ) > get_curr_dex( vch ) )
  107. {
  108. vch->perm_dex = get_perm_stat( 1, ch );
  109. vch->mod_dex = ch->mod_dex;
  110. }
  111.  
  112. if ( get_curr_con( ch ) > get_curr_con( vch ) )
  113. {
  114. vch->perm_con = get_perm_stat( 3, ch );
  115. vch->mod_con = ch->mod_con;
  116. }
  117.  
  118. if ( get_curr_int( ch ) > get_curr_int( vch ) )
  119. {
  120. vch->perm_int = get_perm_stat( 2, ch );
  121. vch->mod_int = ch->mod_int;
  122. }
  123. }
  124. }
  125.  
  126. global_retcode = one_hit( ch, vch, TYPE_UNDEFINED );
  127. }
  128. else
  129. global_retcode = damage( ch, vch, 0, TYPE_HIT );
  130.  
  131. if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MIRRORPL ) )
  132. {
  133. if ( ( long double ) ch->pl > ( long double ) vch->pl )
  134. {
  135. vch->exp = ch->pl;
  136. vch->pl = ch->pl;
  137. }
  138. if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MIRRORHP ) )
  139. {
  140. if ( ch->hit > vch->hit )
  141. {
  142. if ( !vch->fighting )
  143. {
  144. vch->hit = ch->hit;
  145. vch->max_hit = ch->hit;
  146. }
  147. }
  148. }
  149.  
  150. if ( IS_NPC( vch ) && xIS_SET( vch->act, ACT_MIRRORSTAT ) )
  151. {
  152. if ( get_curr_str( ch ) > get_curr_str( vch ) )
  153. {
  154. vch->perm_str = ch->perm_str;
  155. vch->mod_str = ch->mod_str;
  156. }
  157.  
  158. if ( get_curr_dex( ch ) > get_curr_dex( vch ) )
  159. {
  160. vch->perm_dex = ch->perm_dex;
  161. vch->mod_dex = ch->mod_dex;
  162. }
  163.  
  164. if ( get_curr_con( ch ) > get_curr_con( vch ) )
  165. {
  166. vch->perm_con = ch->perm_con;
  167. vch->mod_con = ch->mod_con;
  168. }
  169.  
  170. if ( get_curr_int( ch ) > get_curr_int( vch ) )
  171. {
  172. vch->perm_int = ch->perm_int;
  173. vch->mod_int = ch->mod_int;
  174. }
  175. }
  176. }
  177.  
  178. if ( global_retcode == rCHAR_DIED || global_retcode == rBOTH_DIED || char_died( ch ) )
  179. return;
  180. }
  181.  
  182. ch->mana -= ch->max_mana * ( 0.007 * nvict );
  183.  
  184. if ( ch->mana < 1 )
  185. ch->mana = 0;
  186.  
  187. if ( nhit )
  188. {
  189. learn_from_success( ch, gsn_hitall );
  190. WAIT_STATE( ch, skill_table[ gsn_hitall ]->beats );
  191. }
  192. else
  193. {
  194. learn_from_failure( ch, gsn_hitall );
  195. WAIT_STATE( ch, skill_table[ gsn_hitall ]->beats );
  196. }
  197. return;
  198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement