/* $Id: weaponzapper.cpp,v 1.4 2005/06/28 13:55:26 chfreund Exp $ */ #include "weaponzapper.hpp" #include "world.hpp" #include "avatar.hpp" #include "rope.hpp" bool WeaponZapper::reallyShoot( World* world, Avatar* avatar, const StationaryGun* gun ) const { bool damageDone = false; for( int a = 0; a < avatar->getNAttachedObjects(); a++ ) { Rope* rope = dynamic_cast( avatar->getAttachedObject( a )); if( rope ) { for( int d = 0; d < rope->getNAttachedObjects(); d++ ) { Avatar* damagedAvatar = dynamic_cast( rope->getAttachedObject( d )); CollidableObject* damagedCO = dynamic_cast( rope->getAttachedObject( d )); if( damagedAvatar ) { if( damagedAvatar != avatar ) { damagedAvatar->applyDamage( 3500, avatar->getPlayer() ); rope->setCharged( true ); damageDone = true; } } else if( damagedCO && damagedCO->getID() != HOOK ) { damagedCO->applyDamage( 7000, avatar->getPlayer() ); rope->setCharged( true ); damageDone = true; } } } } return damageDone; }