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


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

本文整理汇总了C++中ManagedReference::getActionAttackCost方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::getActionAttackCost方法的具体用法?C++ ManagedReference::getActionAttackCost怎么用?C++ ManagedReference::getActionAttackCost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ManagedReference的用法示例。


在下文中一共展示了ManagedReference::getActionAttackCost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: notifyObjectInserted

/**
 * Is called when this object has been inserted with an object
 * @param object object that has been inserted
 */
int SaberInventoryContainerComponent::notifyObjectInserted(SceneObject* sceneObject, SceneObject* object) {
	ManagedReference<WeaponObject*> weao = cast<WeaponObject*>( sceneObject->getParent().get().get());

	Locker locker(weao);

	if (weao->isJediWeapon()) {
		ManagedReference<LightsaberCrystalComponent*> crystal = cast<LightsaberCrystalComponent*>( object);
		if (crystal->getColor() == 31){
			weao->setAttackSpeed(weao->getAttackSpeed() + crystal->getAttackSpeed());
			weao->setMinDamage(weao->getMinDamage() + crystal->getMinimumDamage());
			weao->setMaxDamage(weao->getMaxDamage() + crystal->getMaximumDamage());
			weao->setHealthAttackCost(weao->getHealthAttackCost() + crystal->getSacHealth());
			weao->setActionAttackCost(weao->getActionAttackCost() + crystal->getSacAction());
			weao->setMindAttackCost(weao->getMindAttackCost() + crystal->getSacMind());
			weao->setWoundsRatio(weao->getWoundsRatio() + crystal->getWoundChance());
			weao->setForceCost(weao->getForceCost() + crystal->getForceCost());
		}

		if (crystal->getColor() != 31) {
			int color = crystal->getColor();
			weao->setBladeColor(color);
			weao->setCustomizationVariable("/private/index_color_blade", color, true);
		}
	}

	return sceneObject->notifyObjectInserted(object);
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:31,代码来源:SaberInventoryContainerComponent.cpp

示例2: inflictDamage

int LightsaberCrystalComponentImplementation::inflictDamage(TangibleObject* attacker, int damageType, float damage, bool destroy, bool notifyClient) {
	if (isDestroyed()) {
		return 0;
	}

	TangibleObjectImplementation::inflictDamage(attacker, damageType, damage, destroy, notifyClient);

	if (isDestroyed()) {
		ManagedReference<WeaponObject*> weapon = cast<WeaponObject*>(_this.getReferenceUnsafeStaticCast()->getParent().get()->getParent().get().get());

		if (weapon != NULL) {
			if (getColor() == 31) {
				weapon->setAttackSpeed(weapon->getAttackSpeed() - getAttackSpeed());
				weapon->setMinDamage(weapon->getMinDamage() - getMinimumDamage());
				weapon->setMaxDamage(weapon->getMaxDamage() - getMaximumDamage());
				weapon->setHealthAttackCost(weapon->getHealthAttackCost() - getSacHealth());
				weapon->setActionAttackCost(weapon->getActionAttackCost() - getSacAction());
				weapon->setMindAttackCost(weapon->getMindAttackCost() - getSacMind());
				weapon->setWoundsRatio(weapon->getWoundsRatio() - getWoundChance());
				weapon->setForceCost(weapon->getForceCost() - getForceCost());
			}

			if (getColor() != 31) {
				weapon->setBladeColor(31);
				weapon->setCustomizationVariable("/private/index_color_blade", 31, true);

				if (weapon->isEquipped()) {
					ManagedReference<CreatureObject*> parent = cast<CreatureObject*>(weapon->getParent().get().get());
					ManagedReference<SceneObject*> inventory = parent->getSlottedObject("inventory");
					inventory->transferObject(weapon, -1, true, true);
					parent->sendSystemMessage("@jedi_spam:lightsaber_no_color"); //That lightsaber can not be used until it has a color-modifying Force crystal installed.
				}
			}
		}
	}

	return 0;
}
开发者ID:Nifdoolb,项目名称:Server,代码行数:38,代码来源:LightsaberCrystalComponentImplementation.cpp


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