本文整理汇总了C++中ManagedReference::addDotPotency方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::addDotPotency方法的具体用法?C++ ManagedReference::addDotPotency怎么用?C++ ManagedReference::addDotPotency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagedReference
的用法示例。
在下文中一共展示了ManagedReference::addDotPotency方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addWeaponDots
void CraftingSessionImplementation::addWeaponDots() {
ManagedReference<TangibleObject*> prototype = this->prototype.get();
if (!(prototype->isWeaponObject()))
return;
ManagedReference<WeaponObject*> weapon = cast<WeaponObject*>(prototype.get());
ManagedReference<ManufactureSchematic*> manufactureSchematic = this->manufactureSchematic.get();
ManagedReference<DraftSchematic*> draftSchematic = manufactureSchematic->getDraftSchematic();
Vector<VectorMap<String, int> >* weaponDots = draftSchematic->getDraftSchematicTemplate()->getWeaponDots();
for (int i = 0; i < weaponDots->size(); i++) {
VectorMap<String, int> dot = weaponDots->elementAt(i);
for (int j = 0; j < dot.size(); j++) {
String property = dot.elementAt(j).getKey();
int value = dot.elementAt(j).getValue();
if (property == "type")
weapon->addDotType(value);
else if (property == "attribute")
weapon->addDotAttribute(value);
else if (property == "strength")
weapon->addDotStrength(value);
else if (property == "duration")
weapon->addDotDuration(value);
else if (property == "potency")
weapon->addDotPotency(value);
else if (property == "uses")
weapon->addDotUses(value);
}
}
}
示例2: addRandomDots
//.........这里部分代码省略.........
weapon->addDotType(dotType);
int attMin = randomDotAttribute.elementAt(0);
int attMax = randomDotAttribute.elementAt(1);
float att = 0;
if (attMin != attMax)
att= System::random(attMax - attMin) + attMin;
if (dotType != 2 && (att != 0 && att != 3 && att != 6)) {
int numbers[] = { 0, 3, 6 }; // The main pool attributes.
int choose = System::random(2);
att = numbers[choose];
}
weapon->addDotAttribute(att);
int strMin = randomDotStrength.elementAt(0);
int strMax = randomDotStrength.elementAt(1);
float str = 0;
if (strMax != strMin)
str = calculateDotValue(strMin, strMax, level);
else
str = strMax;
if (excMod == 1.0 && (yellowChance == 0 || System::random(yellowChance) == 0)) {
str *= yellowModifier;
yellow = true;
}
if (dotType == 1)
str = str * 2;
else if (dotType == 3)
str = str * 1.5;
weapon->addDotStrength(str * excMod);
int durMin = randomDotDuration.elementAt(0);
int durMax = randomDotDuration.elementAt(1);
float dur = 0;
if (durMax != durMin)
dur = calculateDotValue(durMin, durMax, level);
else
dur = durMax;
if (excMod == 1.0 && (yellowChance == 0 || System::random(yellowChance) == 0)) {
dur *= yellowModifier;
yellow = true;
}
if (dotType == 2)
dur = dur * 5;
else if (dotType == 3)
dur = dur * 1.5;
weapon->addDotDuration(dur * excMod);
int potMin = randomDotPotency.elementAt(0);
int potMax = randomDotPotency.elementAt(1);
float pot = 0;
if (potMax != potMin)
pot = calculateDotValue(potMin, potMax, level);
else
pot = potMax;
if (excMod == 1.0 && (yellowChance == 0 || System::random(yellowChance) == 0)) {
pot *= yellowModifier;
yellow = true;
}
weapon->addDotPotency(pot * excMod);
int useMin = randomDotUses.elementAt(0);
int useMax = randomDotUses.elementAt(1);
float use = 0;
if (useMax != useMin)
use = calculateDotValue(useMin, useMax, level);
else
use = useMax;
if (excMod == 1.0 && (yellowChance == 0 || System::random(yellowChance) == 0)) {
use *= yellowModifier;
yellow = true;
}
weapon->addDotUses(use * excMod);
}
if (yellow) {
uint32 bitmask = weapon->getOptionsBitmask() | OptionBitmask::YELLOW;
weapon->setOptionsBitmask(bitmask, false);
}
}
}
示例3: addStaticDots
void LootManagerImplementation::addStaticDots(TangibleObject* object, LootItemTemplate* templateObject, int level) {
if (object == NULL)
return;
if (!object->isWeaponObject())
return;
ManagedReference<WeaponObject*> weapon = cast<WeaponObject*>(object);
bool shouldGenerateDots = false;
float dotChance = templateObject->getStaticDotChance();
if (dotChance < 0)
return;
// Apply the Dot if the chance roll equals the number or is zero.
if (dotChance == 0 || System::random(dotChance) == 0) { // Defined in loot item script.
shouldGenerateDots = true;
}
if (shouldGenerateDots) {
int dotType = templateObject->getStaticDotType();
if (dotType < 1 || dotType > 4)
return;
VectorMap<String, SortedVector<int> >* dotValues = templateObject->getStaticDotValues();
int size = dotValues->size();
// Check if they specified correct vals.
if (size > 0) {
weapon->addDotType(dotType);
for (int i = 0; i < size; i++) {
String property = dotValues->elementAt(i).getKey();
SortedVector<int> theseValues = dotValues->elementAt(i).getValue();
int min = theseValues.elementAt(0);
int max = theseValues.elementAt(1);
float value = 0;
if (max != min) {
value = calculateDotValue(min, max, level);
}
else { value = max; }
if(property == "attribute") {
if (min != max)
value = System::random(max - min) + min;
if (dotType != 2 && (value != 0 && value != 3 && value != 6)) {
int numbers[] = { 0, 3, 6 }; // The main pool attributes.
int choose = System::random(2);
value = numbers[choose];
}
weapon->addDotAttribute(value);
} else if (property == "strength") {
weapon->addDotStrength(value);
} else if (property == "duration") {
weapon->addDotDuration(value);
} else if (property == "potency") {
weapon->addDotPotency(value);
} else if (property == "uses") {
weapon->addDotUses(value);
}
}
}
}
}