本文整理汇总了C++中P_CHAR::effDex方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::effDex方法的具体用法?C++ P_CHAR::effDex怎么用?C++ P_CHAR::effDex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::effDex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetWeaponTimeout
// Formulas take from OSI's combat formulas
// attack speed should be determined here.
// attack speed = 15000 / ((DEX+100) * weapon speed)
static void SetWeaponTimeout(P_CHAR Attacker, P_ITEM Weapon)
{
int x,j;
if (Weapon)
{
if (Weapon->spd==0) Weapon->spd=35;
x = (15000*MY_CLOCKS_PER_SEC) / ((Attacker->effDex()+100) * Weapon->spd); //Calculate combat delay
}
else
{
if(Attacker->skill[WRESTLING]>200) j = 35;
else if(Attacker->skill[WRESTLING]>400) j = 40;
else if(Attacker->skill[WRESTLING]>600) j = 45;
else if(Attacker->skill[WRESTLING]>800) j = 50;
else j = 30;
x = (15000*MY_CLOCKS_PER_SEC) / ((Attacker->effDex()+100) * j);
}
Attacker->timeout=uiCurrentTime+x;
}
示例2: Add
bool cAllTmpEff::Add(P_CHAR pc_source, P_CHAR pc_dest, int num, unsigned char more1, unsigned char more2, unsigned char more3, short dur)
{
unsigned int ic; // antichrist' changes
int color, color1, color2, socket; //used for incognito spell
int loopexit=0;
if ( pc_source == NULL || pc_dest == NULL )
return false;
if (teffectcount>=cmem*5)
return false;
cTmpEff *pTE;
for (ic=0; ic<teffectcount; ic++) // If there is already an effect of the same or similar kind, reverse it first (Duke)
{
pTE = &teffects[ic];
if (pTE->getDest() == pc_dest->serial)
{
if ((pTE->num==3 && num==3)||
(pTE->num==4 && num==4)||
(pTE->num==5 && num==5)||
(pTE->num==6 && num==6)||
(pTE->num==7 && num==7)||
(pTE->num==8 && num==8)||
(pTE->num==11&& num==11)||
(pTE->num==12&& num==12)||
(pTE->num==18&& num==18)|| //added Poly reverse - AntiChrist (9/99)
(pTE->num==21&& num==21)||
(pTE->num==19&& num==19)|| //added Incognito reverse - AntiChrist (12/99)
(pTE->num==18&& num==19)|| //reverse poly effect if we have to use incognito - AntiChrist (12/99)
(pTE->num==19&& num==18) ) //reverse incognito effect if we have to use poly - AntiChrist (12/99)
{
pTE->Reverse();
AllTmpEff->Remove(pTE);
}
}
}
pTE=new cTmpEff;
pTE->Init();
pTE->setSour(pc_source->serial);
pTE->setDest(pc_dest->serial);
pTE->num=num;
switch (num)
{
case 1:
pc_dest->priv2 |= 0x02;
pTE->setExpiretime_s(pc_source->skill[MAGERY]/100);
pTE->more1=0;
pTE->more2=0;
pTE->dispellable=1;
break;
case 2: // night sight
pc_dest->fixedlight=worldbrightlevel;
dolight(calcSocketFromChar((pc_dest)), worldbrightlevel);
Magic->afterParticles(6, pc_dest); // shows particles for UO:3D clients, like On OSI servers
if(dur > 0) // if a duration is given (potions), use that (Duke, 30.12.2000)
pTE->setExpiretime_s(dur);
else
pTE->setExpiretime_s(pc_source->skill[MAGERY]*10);
pTE->more1=0;
pTE->more2=0;
pTE->dispellable=1;
break;
case 3:
if (pc_dest->effDex()<more1)
more1=pc_dest->effDex();
pc_dest->chgDex(-1 * more1);
pc_dest->stm=min(pc_dest->stm, (int)pc_dest->effDex());
statwindow(calcSocketFromChar(pc_dest), pc_dest);
pTE->setExpiretime_s(pc_source->skill[MAGERY]/10);
pTE->more1=more1;
pTE->more2=0;
pTE->dispellable=1;
break;
case 4:
if (pc_dest->in<more1)
more1=pc_dest->in;
pc_dest->in-=more1;
pc_dest->mn=min(pc_dest->mn, pc_dest->in);
statwindow(calcSocketFromChar(pc_dest), pc_dest);
pTE->setExpiretime_s(pc_source->skill[MAGERY]/10);
pTE->more1=more1;
pTE->more2=0;
pTE->dispellable=1;
break;
case 5:
if (pc_dest->st<more1)
more1=pc_dest->st;
pc_dest->st-=more1;
pc_dest->hp=min(pc_dest->hp, pc_dest->st);
statwindow(calcSocketFromChar(pc_dest), pc_dest);
pTE->setExpiretime_s(pc_source->skill[MAGERY]/10);
pTE->more1=more1;
pTE->more2=0;
pTE->dispellable=1;
break;
case 6:
//.........这里部分代码省略.........
示例3: equipItem
void cDragItems::equipItem( P_CLIENT client )
{
// Get the packet information
SERIAL itemId = LongFromCharPtr( &buffer[ client->socket() ][ 1 ] );
SERIAL playerId = LongFromCharPtr( &buffer[ client->socket() ][ 6 ] );
P_ITEM pItem = FindItemBySerial( itemId );
P_CHAR pWearer = FindCharBySerial( playerId );
if( !pItem || !pWearer )
return;
P_CHAR pChar = client->player();
// We're dead and can't do that
if( pChar->dead )
{
client->sysMessage( "You are dead and can't do that." );
bounceItem( client, pItem );
return;
}
// Our target is dead
if( ( pWearer != pChar ) && pWearer->dead )
{
client->sysMessage( "You can't equip dead players." );
bounceItem( client, pItem );
return;
}
// Get our tile-information
tile_st pTile;
Map->SeekTile( pItem->id(), &pTile );
// Is the item wearable ? ( layer == 0 | equip-flag not set )
// Multis are not wearable are they :o)
if( pTile.layer == 0 || !( pTile.flag3 & 0x40 ) || pItem->isMulti() )
{
client->sysMessage( "This item cannot be equipped." );
bounceItem( client, pItem );
return;
}
// Required Strength
if( pItem->st > pWearer->st )
{
if( pWearer == pChar )
client->sysMessage( "You cannot wear that item, you seem not strong enough" );
else
client->sysMessage( "This person can't wear that armor, it seems not strong enough" );
bounceItem( client, pItem );
return;
}
// Required Dexterity
if( pItem->dx > pWearer->effDex() )
{
if( pWearer == pChar )
client->sysMessage( "You cannot wear that item, you seem not agile enough" );
else
client->sysMessage( "This person can't wear that armor, it seems not agile enough" );
bounceItem( client, pItem );
return;
}
// Required Intelligence
if( pItem->in > pWearer->in )
{
if( pWearer == pChar )
client->sysMessage( "You cannot wear that item, you seem not smart enough" );
else
client->sysMessage( "This person can't wear that armor, it seems not smart enough" );
bounceItem( client, pItem );
return;
}
// Males can't wear female armor
if( ( pChar->id() == 0x0190 ) && ( pItem->id() >= 0x1C00 ) && ( pItem->id() <= 0x1C0D ) )
{
client->sysMessage( "You cannot wear female armor." );
bounceItem( client, pItem );
return;
}
// Needs a check (!)
// Checks for equipment on the same layer
// If there is any it tries to unequip it
// If that fails it cancels
UI08 layer = pItem->layer();
vector< SERIAL > equipment = contsp.getData( pWearer->serial );
for( UI32 i = 0; i < equipment.size(); i++ )
{
P_ITEM pEquip = FindItemBySerial( equipment[ i ] );
if( pEquip )
continue;
//.........这里部分代码省略.........
示例4: DoCombat
void cCombat::DoCombat(P_CHAR pc_attacker, unsigned int currenttime)
{
int x, bowtype=0;// spamanachecking, tmp;
if ( pc_attacker == NULL )
return;
if (pc_attacker->free) return;
P_ITEM pWeapon=pc_attacker->getWeapon();
P_CHAR pc_defender = FindCharBySerial(pc_attacker->targ);
/*if (pc_attacker->priv2&2) //The char is paralyzed
{
sysmessage(calcSocketFromChar(pc_attacker), "You are frozen and cannot attack.");
return;
}*/
if ((pc_defender == NULL) || (pc_defender->isPlayer() && !online(pc_defender) || pc_defender->isHidden()) && pc_attacker->war)
{
pc_attacker->war=false; // LB
pc_attacker->timeout=0;
pc_attacker->attacker = INVALID_SERIAL;
pc_attacker->resetAttackFirst();
return;
}
if (( pc_attacker->isNpc() || online(pc_attacker) ) && pc_defender != NULL )
{
if (pc_defender == NULL) return;
if (pc_defender->free) return;
if (pc_attacker->dispz > (pc_defender->dispz +10)) return;//FRAZAI
if (pc_attacker->dispz < (pc_defender->dispz -10)) return;//FRAZAI
if ((pc_defender->isNpc() && pc_defender->npcaitype!=17) || (online(pc_defender) && !pc_defender->dead) ) // ripper
{
if (chardist( pc_attacker, pc_defender ) > SrvParams->attack_distance())
{
if (pc_attacker->npcaitype==4 && pc_attacker->inGuardedArea()) // changed from 0x40 to 4, LB
{
pc_attacker->moveTo(pc_defender->pos);
teleport(pc_attacker);
soundeffect2(pc_attacker, 0x01FE); // crashfix, LB
staticeffect(pc_attacker, 0x37, 0x2A, 0x09, 0x06);
npctalkall(pc_attacker,"Halt, scoundrel!",1);
}
else
{ // else -> npcaityes != 4
pc_attacker->targ = INVALID_SERIAL;
pc_attacker->timeout=0;
P_CHAR pc = FindCharBySerial(pc_attacker->attacker);
if (pc != NULL)
{
pc->resetAttackFirst();
pc->attacker = INVALID_SERIAL; // lb crashfix
}
pc_attacker->attacker=INVALID_SERIAL;
pc_attacker->resetAttackFirst();
if (pc_attacker->isNpc() && pc_attacker->npcaitype!=17 && !pc_attacker->dead && pc_attacker->war)
npcToggleCombat(pc_attacker); // ripper
}
}
else
{
if (pc_attacker->targ == INVALID_SERIAL)
{
npcsimpleattacktarget(pc_attacker, pc_defender);
x=(((100-pc_attacker->effDex())*MY_CLOCKS_PER_SEC)/25)+(1*MY_CLOCKS_PER_SEC); //Yet another attempt.
pc_attacker->timeout=currenttime+x;
return;
}
if (Combat->TimerOk(pc_attacker))
{
int los = line_of_sight(-1, pc_attacker->pos, pc_defender->pos, WALLS_CHIMNEYS+DOORS+FLOORS_FLAT_ROOFING);
UOXSOCKET s1 = calcSocketFromChar(pc_attacker);
int fightskill=Skills->GetCombatSkill(pc_attacker);
x=0;
if (fightskill==ARCHERY)
{
if (los)
{
int arrowsquant;
bowtype=Combat->GetBowType(pc_attacker);
if (bowtype==1)
arrowsquant=getamount(pc_attacker, 0x0F3F);
else
arrowsquant=getamount(pc_attacker, 0x1BFB);
if (arrowsquant>0)
x=1;
//else
// sysmessage(s1, "You are out of ammunitions!"); //-Fraz- this message can cause problems removed
}
}
if ( chardist( pc_attacker, pc_defender )<2 && fightskill!=ARCHERY ) x=1;
if (x)
{
// - Do stamina maths - AntiChrist (6) -
if(abs(SrvParams->attackstamina())>0 && !pc_attacker->isGM())
{
if((SrvParams->attackstamina()<0)&&(pc_attacker->stm<abs(SrvParams->attackstamina())))
{
sysmessage(s1, tr("You are too tired to attack."));
SetWeaponTimeout(pc_attacker, pWeapon);
//.........这里部分代码省略.........
示例5: CombatHit
// CombatHit now expects that LineOfSight has been checked before (Duke, 10.7.2001)
void cCombat::CombatHit(P_CHAR pc_attacker, P_CHAR pc_deffender, unsigned int currenttime, short los)
{
char hit;
if (pc_deffender == NULL || pc_attacker == NULL)
return;
UOXSOCKET s1=calcSocketFromChar(pc_attacker), s2=calcSocketFromChar(pc_deffender);
unsigned short fightskill = Skills->GetCombatSkill(pc_attacker), bowtype = Combat->GetBowType(pc_attacker),splitnum,splitcount,hitin;
unsigned int basedamage;
int damage; // removed from unsigne by Magius(CHE)
signed int x;
// Magius(CHE) - For armour absorbtion system
int maxabs, maxnohabs, tmpj;
P_ITEM pWeapon=pc_attacker->getWeapon();// get the weapon item only once
if (pWeapon && !(rand()%50) // a 2 percent chance (Duke, 07.11.2000)
&& pWeapon->type !=9) // but not for spellbooks (Duke, 09/10/00)
{
pWeapon->hp--; //Take off a hit point
if(pWeapon->hp<=0)
{
sysmessage(s1, tr("Your weapon has been destroyed"));
if ((pWeapon->trigon==1) && (pWeapon->layer>0))// -Frazurbluu- Trigger Type 2 is my new trigger type *-
{
Trig->triggerwitem(s1, pWeapon, 1); // trigger is fired when item destroyed
}
Items->DeleItem(pWeapon);
}
}
// End here - Magius(CHE) - For armour absorbtion system
pc_attacker->swingtarg=-1;
if((chardist(pc_attacker, pc_deffender)>1 && fightskill!=ARCHERY) || !los) return;
if(pc_deffender->isNpc() && pc_deffender->isInvul()) return; // ripper
hit=Skills->CheckSkill(pc_attacker, fightskill, 0, 1000); // increase fighting skill for attacker and defender
if (!hit)
{
if (pc_attacker->isPlayer())
doMissedSoundEffect(pc_attacker);
if ((fightskill==ARCHERY)&&(los))
{
if (rand()%3-1)//-1 0 or 1
{
short id=0x1BFB; // bolts
if (bowtype==1)
id=0x0F3F; // arrows
P_ITEM pAmmo=Items->SpawnItem(pc_deffender,1,"#",1,id,0,0);
if(pAmmo)
{
pAmmo->moveTo(pc_deffender->pos);
pAmmo->priv=1;
RefreshItem(pAmmo);
}
}
}
}
else
{
if (!pc_deffender->isInvul())
{
if (pc_deffender->xid==0x0191) soundeffect2(pc_deffender,0x014b);
else if (pc_deffender->xid==0x0190) soundeffect2(pc_deffender,0x0156);
playmonstersound(pc_deffender, pc_deffender->id(), SND_DEFEND);
//AntiChrist -- for poisoned weapons
if((pWeapon) && (pWeapon->poisoned>0))
{
pc_deffender->poisoned=pWeapon->poisoned;
pc_deffender->poisontime=uiCurrentTime+(MY_CLOCKS_PER_SEC*(40/pc_deffender->poisoned)); // a lev.1 poison takes effect after 40 secs, a deadly pois.(lev.4) takes 40/4 secs - AntiChrist
pc_deffender->poisonwearofftime=pc_deffender->poisontime+(MY_CLOCKS_PER_SEC*SrvParams->poisonTimer()); //wear off starts after poison takes effect - AntiChrist
}
CheckPoisoning(s2, pc_attacker, pc_deffender); // attacker poisons defender
CheckPoisoning(s1, pc_deffender, pc_attacker); // and vice versa
if ((pc_deffender->effDex()>0)) pc_deffender->priv2&=0xFD; // unfreeze
if (fightskill!=WRESTLING && los)
Combat->ItemSpell(pc_attacker, pc_deffender);
if (fightskill!=WRESTLING || pc_attacker->isNpc())
basedamage=Combat->CalcAtt(pc_attacker); // Calc base damage
else
{
if ((pc_attacker->skill[WRESTLING]/100) > 0)
{
if (pc_attacker->skill[WRESTLING]/100!=0)
basedamage=rand()%(pc_attacker->skill[WRESTLING]/100);
else basedamage=0;
}
else basedamage=rand()%2;
//.........这里部分代码省略.........