void Monster::die() { setAttackedCreature(NULL); destroySummons(); clearTargetList(); clearFriendList(); Creature::die(); }
void Actor::die() { setAttackedCreature(NULL); destroySummons(); clearTargetList(); clearFriendList(); onIdleStatus(); Creature::die(); }
bool Monster::convinceCreature(Creature* creature) { Player* player = creature->getPlayer(); if(player && !player->hasFlag(PlayerFlag_CanConvinceAll) && !mType->isConvinceable) return false; Creature* oldMaster = NULL; if(isSummon()) oldMaster = master; if(oldMaster) { if(oldMaster->getPlayer() || oldMaster == creature) return false; oldMaster->removeSummon(this); } setFollowCreature(NULL); setAttackedCreature(NULL); destroySummons(); creature->addSummon(this); updateTargetList(); updateIdleStatus(); //Notify surrounding about the change SpectatorVec list; g_game.getSpectators(list, getPosition(), false, true); g_game.getSpectators(list, creature->getPosition(), true, true); isMasterInRange = true; for(SpectatorVec::iterator it = list.begin(); it != list.end(); ++it) (*it)->onCreatureConvinced(creature, this); if(spawn) { spawn->removeMonster(this); spawn = NULL; masterRadius = -1; } if(raid) { raid->unRef(); raid = NULL; } return true; }
Creature::~Creature() { std::list<Creature*>::iterator cit; destroySummons(); for(ConditionList::iterator it = conditions.begin(); it != conditions.end();){ (*it)->onEnd(this, CONDITIONEND_CLEANUP); delete *it; it = conditions.erase(it); } conditions.clear(); attackedCreature = NULL; //std::cout << "Creature destructor " << this->getID() << std::endl; }
bool Monster::onDeath() { if(!Creature::onDeath()) return false; destroySummons(); clearTargetList(); clearFriendList(); setAttackedCreature(NULL); onIdleStatus(); if(raid) { raid->unRef(); raid = NULL; } g_game.removeCreature(this, false); return true; }
bool Actor::convinceCreature(Creature* creature) { Player* player = creature->getPlayer(); if(player && !player->hasFlag(PlayerFlag_CanConvinceAll)){ if(!cType.isConvinceable()){ return false; } } if(isPlayerSummon()){ return false; } else if(isSummon()){ if(getMaster() != creature){ Creature* oldMaster = getMaster(); oldMaster->removeSummon(this); creature->addSummon(this); setFollowCreature(NULL); setAttackedCreature(NULL); //destroy summons destroySummons(); isMasterInRange = true; updateTargetList(); updateIdleStatus(); //Notify surrounding about the change SpectatorVec list; g_game.getSpectators(list, getPosition(), false, true); g_game.getSpectators(list, creature->getPosition(), true, true); for(SpectatorVec::iterator it = list.begin(); it != list.end(); ++it){ (*it)->onCreatureConvinced(creature, this); } if(spawn){ spawn->removeMonster(this); spawn = NULL; masterRadius = -1; } return true; } } else{ creature->addSummon(this); setFollowCreature(NULL); setAttackedCreature(NULL); destroySummons(); isMasterInRange = true; updateTargetList(); updateIdleStatus(); //Notify surrounding about the change SpectatorVec list; g_game.getSpectators(list, getPosition(), false, true); g_game.getSpectators(list, creature->getPosition(), true, true); for(SpectatorVec::iterator it = list.begin(); it != list.end(); ++it){ (*it)->onCreatureConvinced(creature, this); } if(spawn){ spawn->removeMonster(this); spawn = NULL; masterRadius = -1; } return true; } return false; }