Пример #1
0
void cNewMagic::castSpell( P_PLAYER pMage, UINT8 spell )
{
	P_PLAYER pp = dynamic_cast<P_PLAYER>(pMage);

	if( !pp || !pp->socket() )
		return;

	stNewSpell *sInfo = findSpell( spell );

	if( !sInfo )
	{
		pp->socket()->sysMessage( tr( "This spell is either not implemented or invalid" ) );
		return;
	}

	// Check if we can cast this spell
	if( !hasSpell( pMage, spell ) )
	{
		pp->socket()->sysMessage( tr( "You don't know this spell." ) );
		return;
	}

	// Check for required mana and required reagents, if not present: cancel casting
	if( !checkMana( pMage, spell ) )
	{
		pp->message( tr( "You don't have enough mana to cast this spell." ) );
		return;
	}
	
	if( !pp->isGM() && !checkReagents( pMage, spell ) )
		return;

	if( pMage->isCasting() )
		disturb( pMage, true );

	// We start casting here
	pMage->setCasting( true );

	// We get frozen here too
	pMage->setFrozen( true );

	// Say the mantra
	// Type 0x0A : Spell
	pMage->talk( sInfo->mantra, pMage->saycolor() );

	// This is a very interesting move of OSI 
	// They send all action-packets the character has to perform in a row. 
	// But they use the action 0xE9 instead of 0x10, maybe it's a bitmask 
	// of 0xD9 but i am unsure. 
	// This will repeat the animation until
	// We are done casting or until we are being
	// disturbed.
	//pMage->startRepeatedAction( sInfo->action, sInfo->actiondelay ); // Repeat every 1250 ms
	// I *do* know that this is a drawback but for now a single animation is exactly what we need.
	pMage->action( sInfo->action );

	// Now we have to do the following: 
	// We show the target cursor after a given amount of time (set in the scripts)
	// So what we are adding here is cEndCasting() supplying the Serial of our Mage 
	// And the ID of our Spell.
	TempEffects::instance()->insert( new cEndCasting( pMage, spell, CT_BOOK, sInfo->delay ) );
}
Пример #2
0
	else GET_PROPERTY( "fz1", wanderRadius() )
	else GET_PROPERTY( "totame", tamingMinSkill_ )
	else GET_PROPERTY( "summontime", (int)summonTime_)
	else GET_PROPERTY( "summontimer", (int)summonTime_)
	else GET_PROPERTY( "owner", owner_ )
	else GET_PROPERTY( "ai", aiid_ )
	else GET_PROPERTY( "fleeat", criticalHealth_ )
	else GET_PROPERTY( "criticalhealth", criticalHealth_ )
	else GET_PROPERTY( "spellslow", (int)spellsLow_ )
	else GET_PROPERTY( "spellshigh", (int)spellsHigh_ )
	else GET_PROPERTY( "summoned", (int)(summoned() ? 1 : 0))
	else if(name == "spell" )
	{
		UINT8 spell = name.right( name.length() - 6 ).toShort();

		value = cVariant( hasSpell( spell ) );
		return 0;
	}

	return cBaseChar::getProperty( name, value );
}

Coord_cl cNPC::nextMove()
{
	Coord_cl ret;
	if( !path_.empty() )
	{
		ret = path_.front();
	}
	else
		ret = Coord_cl( 0xFFFF, 0xFFFF, 0xFF, 0 );
Пример #3
0
 bool Spells::hasSpell(const std::string &spell) const
 {
     return hasSpell(getSpell(spell));
 }