/* $Id: weaponmine.cpp,v 1.7 2005/10/16 17:53:05 pohlt Exp $ */ #include "weaponmine.hpp" #include "world.hpp" #include "avatar.hpp" bool WeaponMine::reallyShoot( World* world, Avatar* avatar, const StationaryGun* gun ) const { // place mine const real power = 1 + 0.25 * world->getRandom().getNormedReal(); const int deadTime = (world->getRandom().getUint32Between( 0, 10 ) == 0 && false ? -1 // dud : static_cast( world->getRandom().getUint32Between( 75, 100 ))); Mine* const mine = dynamic_cast( world->newObject( MINE )); return mine->initialize( avatar->placeBesideCollRect( mine->getCollRectX() + mine->getCollRectWidth() - 1, -mine->getCollRectX(), mine->getCollRectY() + mine->getCollRectHeight() - 1, -mine->getCollRectY() ), avatar->getRandomizedAimingVector( 2 )*power + avatar->getVel(), avatar->getPlayer()->getPlayerID(), deadTime, 150, 40 ); }