本文整理汇总了C++中CGameItemPtr::setProtection方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameItemPtr::setProtection方法的具体用法?C++ CGameItemPtr::setProtection怎么用?C++ CGameItemPtr::setProtection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameItemPtr
的用法示例。
在下文中一共展示了CGameItemPtr::setProtection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCraftedItem
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create crafted item, consume Mps and character xp gain
static void createCraftedItem( CFaberPhrase * phrase, CCharacter * c, SKILLS::ESkills skill, sint16 deltaLvl, const CSheetId& sheet, uint16 quality, uint16 nbItemsPerUnit, uint32 durability, float weight,
uint16 dmg, float speed, uint16 sapLoad, float range, uint16 maxSlashingProtection, float slashingProtectionFactor, uint16 maxBluntProtection, float bluntProtectionFactor,
uint16 maxPiercingProtection, float piercingProtectionFactor, uint16 DodgeBonus, uint16 ParryBonus, uint8 color )
{
CGameItemPtr item;
if( c != 0 )
{
item = c->createItemInBag( quality, nbItemsPerUnit, sheet, c->getId() );
}
else
{
item = createSystemCraftedItem( nbItemsPerUnit, sheet );
}
if( item != 0 )
{
if( item->getSheetId() == CSheetId("stack.sitem") )
{
const vector< CGameItemPtr >& items = item->getChildren();
uint nbItems = items.size();
CGameItemPtr itemEvent = NULL;
uint realNb = nbItems;
for( uint i = 0; i < nbItems; ++i )
{
if( items[ i ] != 0 )
{
itemEvent = items[ i ];
items[ i ]->setHp( durability );
items[ i ]->setWeight( weight );
items[ i ]->setDamage( dmg );
items[ i ]->setSpeed( speed );
items[ i ]->setSapLoad( sapLoad );
items[ i ]->setRange( range );
items[ i ]->setProtection( DMGTYPE::BLUNT,maxBluntProtection,bluntProtectionFactor );
items[ i ]->setProtection( DMGTYPE::PIERCING,maxSlashingProtection,slashingProtectionFactor );
items[ i ]->setProtection( DMGTYPE::SLASHING,maxPiercingProtection,piercingProtectionFactor );
/* items[ i ]->setSlashingProtection( maxSlashingProtection );
items[ i ]->setBluntProtection( maxBluntProtection );
items[ i ]->setPiercingProtection( maxPiercingProtection );
items[ i ]->setSlashingProtectionFactor( slashingProtectionFactor );
items[ i ]->setBluntProtectionFactor( bluntProtectionFactor );
items[ i ]->setPiercingProtectionFactor( piercingProtectionFactor );
*/
items[ i ]->setDodgeModifier( DodgeBonus );
items[ i ]->setParryModifier( ParryBonus );
items[ i ]->Color = color;
}
else
realNb--;
}
if ( itemEvent != NULL )
{
CMissionEventCraft event(itemEvent->getSheetId(),realNb);
if( c ) c->processMissionEvent(event);
}
}
else
{
item->setHp( durability );
item->setWeight( weight );
item->setDamage( dmg );
item->setSpeed( speed );
item->setSapLoad( sapLoad );
item->setRange( range );
item->setProtection( DMGTYPE::BLUNT,maxBluntProtection,bluntProtectionFactor );
item->setProtection( DMGTYPE::PIERCING,maxSlashingProtection,slashingProtectionFactor );
item->setProtection( DMGTYPE::SLASHING,maxPiercingProtection,piercingProtectionFactor );
/*
item->setSlashingProtection( maxSlashingProtection );
item->setBluntProtection( maxBluntProtection );
item->setPiercingProtection( maxPiercingProtection );
item->setSlashingProtectionFactor( slashingProtectionFactor );
item->setBluntProtectionFactor( bluntProtectionFactor );
item->setPiercingProtectionFactor( piercingProtectionFactor );
*/
item->setDodgeModifier( DodgeBonus );
item->setParryModifier( ParryBonus );
item->Color = color;
CMissionEventCraft event(sheet,1);
if( c ) c->processMissionEvent(event);
}
if( c != 0)
{
//Consume Mps
c->consumeMp();
// action report for xp gain
//.........这里部分代码省略.........