本文整理汇总了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);
}
示例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;
}