本文整理汇总了C++中Skill::getXpCap方法的典型用法代码示例。如果您正苦于以下问题:C++ Skill::getXpCap方法的具体用法?C++ Skill::getXpCap怎么用?C++ Skill::getXpCap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skill
的用法示例。
在下文中一共展示了Skill::getXpCap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateXpLimits
void SkillManager::updateXpLimits(PlayerObject* ghost) {
if (ghost == NULL || !ghost->isPlayerObject()) {
return;
}
VectorMap<String, int>* xpTypeCapList = ghost->getXpTypeCapList();
//Clear all xp limits to the default limits.
for (int i = 0; i < defaultXpLimits.size(); ++i) {
String xpType = defaultXpLimits.elementAt(i).getKey();
int xpLimit = defaultXpLimits.elementAt(i).getValue();
if (xpTypeCapList->contains(xpType)) {
xpTypeCapList->get(xpType) = xpLimit;
} else {
xpTypeCapList->put(xpType, xpLimit);
}
}
//Iterate over the player skills and update xp limits accordingly.
ManagedReference<CreatureObject*> player = cast<CreatureObject*>(ghost->getParentRecursively(SceneObjectType::PLAYERCREATURE).get().get());
if(player == NULL)
return;
SkillList* playerSkillBoxList = player->getSkillList();
for(int i = 0; i < playerSkillBoxList->size(); ++i) {
Skill* skillBox = playerSkillBoxList->get(i);
if (skillBox == NULL)
continue;
if (xpTypeCapList->contains(skillBox->getXpType()) && (xpTypeCapList->get(skillBox->getXpType()) < skillBox->getXpCap())) {
xpTypeCapList->get(skillBox->getXpType()) = skillBox->getXpCap();
}
}
//Iterate over the player xp types and cap all xp types to the limits.
DeltaVectorMap<String, int>* experienceList = ghost->getExperienceList();
for (int i = 0; i < experienceList->size(); ++i) {
String xpType = experienceList->getKeyAt(i);
if (experienceList->get(xpType) > xpTypeCapList->get(xpType)) {
ghost->addExperience(xpType, xpTypeCapList->get(xpType) - experienceList->get(xpType), true);
}
}
}