/*----------------------------------------------------------------------------*\
|* Mana Channel Code! *|
|* Basically, this alows you to channel mana to another player. *|
|* Syntax: channel <ammount> <player> *|
|* The amount of mana that actually goes through(if any) is based on your wis,*|
|* channel skill, the target's wis, and his/her channel skill, if any.Remember*|
|* to add the gsn, and mods to interp.c, etc. *|
|* *|
|* Please send any comments/suggestions/flames to ulyenthanrealms@hotmail.com.*|
|* Thanks, *|
|* Archan *|
|* Head Coder and Adminstrator *|
|* Ulyenthan Realms *|
\*----------------------------------------------------------------------------*/
/* too lazy to sort it out; I just use them all */
#if defined( macintosh )
#include <types.h>
#include <time.h>
#else
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <sys/time.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "merc.h"
void do_cmana( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
int transfer, mana;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' || arg2[0] == '\0' )
{
send_to_char( "Channel how much to whom?\n\r", ch );
return;
}
if ( ( victim = get_char_room( ch, arg2 ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if(( victim == ch))
{
send_to_char("Don't be cheap.\n\r",ch);
return;
}
if (!is_number( arg1 ) && !strcmp(arg1, "all"))
{
send_to_char( "Argument must be numerical or all.\n\r", ch);
return;
}
if (!strcmp(arg1, "all"))
mana = ch->mana;
else mana = atoi(arg1);
if (mana == 0)
{
send_to_char("You have to channel something!\n\r",ch);
return;
}
if (mana > ch->mana)
{
send_to_char("Hah? You don't have that much!\n\r",ch);
return;
}
/* percent of mana to transfer */
transfer = (number_range(0, get_skill(ch,gsn_cmana)) * mana / 100);
/* skill failure */
if( transfer == 0 )
{
act("{gA beam of {MENERGY{g shoots from your forehead and {RFIZZLES{g!!{x", ch, 0, victim, TO_CHAR);
act("{g$n places $s fingers on $s temples and a beam of {MENERGY{R FIZZLES{g!!{x", ch, 0, victim, TO_ROOM);
check_improve(ch,gsn_cmana,FALSE,5);
return;
}
/* boni etc. (based on practice gain.) */
transfer += wis_app[get_curr_stat(ch,STAT_WIS)].practice * 10;
transfer += wis_app[get_curr_stat(victim,STAT_WIS)].practice * 10;
transfer += number_range(0,get_skill(victim,gsn_cmana))/2;
/* can't let them get to much in battle (concentration loss */
if (ch->position == POS_FIGHTING)
transfer *= 2/3;
/* They can't gain more than they sent! */
if( (mana < transfer) )
transfer = mana;
/* finally, the transfer! */
victim->mana += transfer;
ch->mana -= mana;
check_improve(ch,gsn_cmana,TRUE,5);
act("{g$n places $s fingers on $s temples and a beam of {MENERGY{g shoots to $N!!{x", ch, 0, victim, TO_NOTVICT);
act("{gA beam of {MENERGY{g shoots from your forehead to $N!!{x", ch, 0, victim, TO_CHAR);
act("{gA beam of {MENERGY{g shoots from $n's forehead to yours!!{x", ch, 0, victim, TO_VICT);
send_to_char("{YYou feel energized!!!!{x\n\r",victim);
send_to_char("{bYou feel your energy drop.{x\n\r",ch);
return;
}