本文整理汇总了C++中ManagedReference::decreaseFactionStanding方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::decreaseFactionStanding方法的具体用法?C++ ManagedReference::decreaseFactionStanding怎么用?C++ ManagedReference::decreaseFactionStanding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagedReference
的用法示例。
在下文中一共展示了ManagedReference::decreaseFactionStanding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: awardFactionStanding
void FactionManager::awardFactionStanding(CreatureObject* player, const String& factionName) {
if (player == NULL)
return;
ManagedReference<PlayerObject*> ghost = player->getPlayerObject();
if (!factionMap.contains(factionName))
return;
float lose = floor((float)75); //TODO: Find the equation for this.
float gain = floor((float)lose / 2); //you gain half of what you lose
Faction faction = factionMap.get(factionName);
SortedVector<String>* enemies = faction.getEnemies();
SortedVector<String>* allies = faction.getAllies();
ghost->decreaseFactionStanding(factionName, lose);
//Lose faction standing to allies of the creature.
for (int i = 0; i < allies->size(); ++i) {
String ally = allies->get(i);
ghost->decreaseFactionStanding(ally, lose);
}
//Gain faction standing to enemies of the creature.
for (int i = 0; i < enemies->size(); ++i) {
String enemy = enemies->get(i);
ghost->increaseFactionStanding(enemy, gain);
}
}
示例2: awardFactionPoints
void MissionObjectiveImplementation::awardFactionPoints() {
ManagedReference<MissionObject* > mission = this->mission.get();
int factionPointsRebel = mission->getRewardFactionPointsRebel();
int factionPointsImperial = mission->getRewardFactionPointsImperial();
if ((factionPointsRebel <= 0 && factionPointsImperial <= 0) || mission->getFaction() == MissionObject::FACTIONNEUTRAL) {
return;
}
//Award faction points for faction delivery missions.
ManagedReference<CreatureObject*> creatureOwner = getPlayerOwner();
if (creatureOwner != NULL) {
ManagedReference<PlayerObject*> ghost = creatureOwner->getPlayerObject();
if (ghost != NULL) {
Locker ghostLocker(creatureOwner);
//Switch to get the correct order.
switch (mission->getFaction()) {
case MissionObject::FACTIONIMPERIAL:
if (factionPointsImperial > 0) {
ghost->increaseFactionStanding("imperial", factionPointsImperial);
}
if (factionPointsRebel < 0) {
ghost->decreaseFactionStanding("rebel", -factionPointsRebel);
}
break;
case MissionObject::FACTIONREBEL:
if (factionPointsRebel > 0) {
ghost->increaseFactionStanding("rebel", factionPointsRebel);
}
if (factionPointsImperial < 0) {
ghost->decreaseFactionStanding("imperial", -factionPointsImperial);
}
break;
}
}
}
}
示例3: awardPvpFactionPoints
void FactionManager::awardPvpFactionPoints(TangibleObject* killer, CreatureObject* destructedObject) {
if (killer->isPlayerCreature() && destructedObject->isPlayerCreature()) {
CreatureObject* killerCreature = cast<CreatureObject*>(killer);
ManagedReference<PlayerObject*> ghost = killerCreature->getPlayerObject();
ManagedReference<PlayerObject*> killedGhost = destructedObject->getPlayerObject();
if (killer->isRebel() && destructedObject->isImperial()) {
ghost->increaseFactionStanding("rebel", 75);
ghost->decreaseFactionStanding("imperial", 75);
killedGhost->decreaseFactionStanding("imperial", 75); //TODO: find formulas
} else if (killer->isImperial() && destructedObject->isRebel()) {
ghost->increaseFactionStanding("imperial", 75);
ghost->decreaseFactionStanding("rebel", 75);
killedGhost->decreaseFactionStanding("rebel", 75);
}
} else if (destructedObject->isPlayerCreature()) {
ManagedReference<PlayerObject*> ghost = destructedObject->getPlayerObject();
if (killer->getFaction() != destructedObject->getFaction()) {
if (killer->isRebel() && destructedObject->isImperial()) {
ghost->decreaseFactionStanding("imperial", 75); //TODO: find formulas
} else if (killer->isImperial() && destructedObject->isRebel()) {
ghost->decreaseFactionStanding("rebel", 75);
}
}
}
}