/*
....[@@@..[@@@..............[@.................. MUD++ is a written from
....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and
....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++.
....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing
....[@......[@..[@@@@@..[@@@@@.................. development project. All
................................................ contributions are welcome.
....Copyright(C).1995.Melvin.Smith.............. Enjoy.
------------------------------------------------------------------------------
Melvin Smith (aka Fusion) msmith@hom.net
MUD++ development mailing list mudpp@van.ml.org
------------------------------------------------------------------------------
pc_combat.cc
*/
#include "config.h"
#include "string.h"
#include "llist.h"
#include "room.h"
#include "random.h"
#include "combat.h"
#include "pc.h"
#include "global.h"
// This is just preliminary crap. Testing of interfaces, etc.
// No real combat code here yet.
void PC::do_wield( const String & arg )
{
Object * obj;
String arg1;
String arg2;
if( ! (bool) arg )
{
out( "Wield what?\n\r" );
return;
}
arg.startArgs();
arg1 = arg.getArg();
if( !( obj = getObjInv( arg1 ) ) )
{
out( "You don't seem to have the '" );
out( arg1 );
out( "'\n\r" );
return;
}
if( !obj->isWeapon() )
{
out( "That's not a weapon, Jack.\n\r" );
return;
}
// Add support for dual wield skill later.
// the code is already in place --Fusion *ZZZZZ*
if( getObjWear( EQ_WIELD_R ) )
{
out( "You are already wielding something in your right hand.\n\r" );
return;
}
if ( !wield( obj, 0 ) )
return;
out( "You grab " );
out( obj->getShort() );
out( " and wield it.\n\r" );
}
void PC::do_kill( const String & arg )
{
Char * victim;
int dt = -1;
if( ! (bool) arg )
{
out( "Kill who?\n\r" );
return;
}
if( !( victim = in_room->getChar( arg ) ) )
{
out( "Nobody here by that name.\n\r" );
return;
}
if ( victim == this )
{
out("If you wanna kill yourself, type 'suicide'.\n\r");
return;
}
if ( victim->TgAttacked( this ) )
return;
String str;
str << shortdesc << " screams 'BANZAII' and attacks " << victim->getShort()
<< "!!\n\r";
in_room->outAllCharExcept( str.chars(), this, victim );
victim->out( shortdesc );
victim->out( " screams 'BANZAII' and attacks you!!!\n\r" );
out( "You scream 'BANZAII' and attack!!!\n\r" );
attack( victim, dt );
// Now check for victim, in case the attack killed him.
if( fighting )
fighting->setFighting( this );
// Add a speed check here.
// Chars with VERY fast speed will do an instant retaliation
}
void PC::makeCorpse()
{
String str;
ObjCorpse *corpse = new ObjCorpse();
// OK - Lets build the corpse Object.
str << "corpse " << getName(); // keywords
corpse->setName( str );
str.clr();
str << "the corpse of " << getShort();
corpse->setShort( str );
str.clr();
str << "The corpse of " << getShort() << " lies here, rotting.";
corpse->setLong( str );
corpse->setWeight( getWeight() );
corpse->setTimer( 2 );
corpse->toWorld();
in_room->addObjInv( corpse );
}