本文整理汇总了C++中P_CHAR::getShield方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::getShield方法的具体用法?C++ P_CHAR::getShield怎么用?C++ P_CHAR::getShield使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::getShield方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcDef
int cCombat::CalcDef(P_CHAR pc,int x) // Calculate total defense power
{
P_ITEM pj=NULL;
P_ITEM pShield = pc->getShield();
unsigned int total=pc->def;
if (x==0) // -Fraz- added parrying skill bonuses
{
if (pShield)
total+=(((pc->skill[PARRYING]*pShield->def)/200)+1); // Updated to OSI standars (Skyfire)
} //Displayed AR = ((Parrying Skill * Base AR of Shield) ? 200) + 1
if (pc->skill[PARRYING]==1000)
total+=5; // gm parry bonus.
if (ishuman(pc)) // Added by Magius(CHE)
{
unsigned int ci=0;
P_ITEM pi;
vector<SERIAL> vecContainer = contsp.getData(pc->serial);
for ( ci = 0; ci < vecContainer.size(); ci++)
{
pi = FindItemBySerial(vecContainer[ci]);
if (pi != NULL && pi->layer>1 && pi->layer<25)
{
//blackwinds new stuff
int armordef=0;
if (pi->def>0)
{
float armorhpperc=((float)pi->hp/((float)pi->maxhp/100));
armordef=(int)(((float)pi->def/100)*armorhpperc);
}
if (x==0)
total+=pi->def;
else
{
switch (pi->layer)
{
case 5:
case 13:
case 17:
case 20:
case 22:
if (x==1 && pi->def>total)
{
total=pi->def;
pj=pi;
}
break;
case 19:
if (x==2 && pi->def>total)
{
total=pi->def;
pj=pi;
}
break;
case 6:
if (x==3 && pi->def>total)
{
total=pi->def;
pj=pi;
}
break;
case 3:
case 4:
case 12:
case 23:
case 24:
if (x==4 && pi->def>total)
{
total=pi->def;
pj=pi;
}
break;
case 10:
if (x==5 && pi->def>total)
{
total=pi->def;
pj=pi;
}
break;
case 7:
if (x==6 && pi->def>total)
{
total=pi->def;
pj=pi;
}
break;
default:
break;
}
}
}
}
} else pj=NULL;
UOXSOCKET k=calcSocketFromChar(pc);
if (pj && k!=-1)
{
//AntiChrist - don't damage hairs, beard and backpack
//important! this sometimes cause backpack destroy!
//
//.........这里部分代码省略.........
示例2: CombatHit
//.........这里部分代码省略.........
if((pc_attacker->isPlayer()) && (fightskill!=WRESTLING))
{
if (pWeapon->racehate != 0 && pc_deffender->race != 0)//-Fraz- Racehating combat
{
if (pWeapon->racehate==pc_deffender->race)
{
basedamage *=2;
if(pc_deffender->isPlayer())
{
sysmessage(s2, tr("You scream in agony from being hit by the accursed metal!"));
if (pc_deffender->xid == 0x0191) soundeffect2(pc_deffender,0x0152);
else if (pc_deffender->xid==0x0190) soundeffect2(pc_deffender,0x0157);
}// can add a possible effect below here for npc's being hit
}
}
}
Skills->CheckSkill(pc_attacker, TACTICS, 0, 1000);
damage=(int)(basedamage*((pc_attacker->skill[TACTICS]+500.0)/1000.0)); // Add Tactical bonus
damage=damage+(int)((basedamage*(pc_attacker->st/500.0))); // Add Strength bonus
//Adds a BONUS DAMAGE for ANATOMY
//Anatomy=100 -> Bonus +20% Damage - AntiChrist (11/10/99)
if (Skills->CheckSkill(pc_attacker, ANATOMY, 0, 1000))
{
float multiplier=(((pc_attacker->skill[ANATOMY]*20)/1000.0f)/100.0f)+1;
damage=(int) (damage * multiplier);
}
//Adds a BONUS DEFENCE for TACTICS
//Tactics=100 -> Bonus -20% Damage - AntiChrist (11/10/99)
float multiplier=1-(((pc_deffender->skill[TACTICS]*20)/1000.0f)/100.0f);
damage=(int) (damage * multiplier);
P_ITEM pShield=pc_deffender->getShield();
if(pShield)
{
if (Skills->CheckSkill(pc_deffender, PARRYING, 0, 1000))// chance to block with shield
{
if (pShield->def!=0) damage-=rand()%(pShield->def);// damage absorbed by shield
if(rand()%2) pShield->hp--; //Take off a hit point
if(pShield->hp<=0)
{
sysmessage(s2, tr("Your shield has been destroyed"));
if ((pShield->trigon==1) && (pShield->layer >0))// -Frazurbluu- Trigger Type 2 is my new trigger type *-
{
Trig->triggerwitem(s2, pShield, 1); // trigger is fired when item destroyed
}
Items->DeleItem(pShield);
}
}
}
// Armor destruction and sped up by hitting with maces should go in here somewhere
// According to lacation of body hit Id imagine -Frazurbluu- **NEEDS ADDED**
x=rand()%100;// determine area of body hit
if (!SrvParams->combatHitMessage())
{
if (x<=44) x=1; // body
else if (x<=58) x=2; // arms
else if (x<=72) x=3; // head
else if (x<=86) x=4; // legs
else if (x<=93) x=5; // neck
else x=6; // hands
}
else
{
temp[0] = '\0';