MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / addSkill

Method addSkill

source/game/Seat.cpp:1284–1307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1282}
1283
1284bool Seat::addSkill(SkillType type)
1285{
1286 if(std::find(mSkillDone.begin(), mSkillDone.end(), type) != mSkillDone.end())
1287 return false;
1288
1289 std::vector<SkillType> skillDone = mSkillDone;
1290 skillDone.push_back(type);
1291 setSkillsDone(skillDone);
1292
1293 // Tells the player a new room/trap/spell is available.
1294 if((getPlayer() != nullptr) &&
1295 getPlayer()->getIsHuman() &&
1296 !getPlayer()->getHasLost())
1297 {
1298 ServerNotification *serverNotification = new ServerNotification(
1299 ServerNotificationType::chatServer, getPlayer());
1300
1301 std::string msg = Skills::skillTypeToPlayerVisibleString(type) + " is now available.";
1302 serverNotification->mPacket << msg << EventShortNoticeType::aboutSkills;
1303 ODServer::getSingleton().queueServerNotification(serverNotification);
1304 }
1305
1306 return true;
1307}
1308
1309bool Seat::isSkillDone(SkillType type) const
1310{

Callers 2

applyEffectMethod · 0.80

Calls 4

getIsHumanMethod · 0.80
getHasLostMethod · 0.80

Tested by

no test coverage detected