当前位置: 首页>>代码示例>>C++>>正文


C++ ManagedReference::decreaseFactionStanding方法代码示例

本文整理汇总了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);
	}
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:30,代码来源:FactionManager.cpp

示例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;
			}
		}
	}
}
开发者ID:duffstone01,项目名称:duffEMU,代码行数:40,代码来源:MissionObjectiveImplementation.cpp

示例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);
			}
		}
	}
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:30,代码来源:FactionManager.cpp


注:本文中的ManagedReference::decreaseFactionStanding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。