示例#1
0
文件: pc.C 项目: Methuselas/btbuilder
void BTPc::activateItems(BTDisplay &d)
{
 BTGame *game = BTGame::getGame();
 BTParty &party = game->getParty();
 int pc = party.find(this);
 BTFactory<BTItem> &itemList = game->getItemList();
 BTFactory<BTSpell, BTSpell1> &spellList = game->getSpellList();
 int numItems = 0;
 for (numItems = 0; numItems < BT_ITEMS; ++numItems)
 {
  if (BTITEM_NONE == item[numItems].id)
   break;
  if (BTITEM_EQUIPPED != item[numItems].equipped)
   continue;
  if (BTTIMESUSABLE_CONTINUOUS == item[numItems].charges)
  {
   int spellCast = itemList[item[numItems].id].getSpellCast();
   if (spellCast != BTITEMCAST_NONE)
   {
    int effectID = item[numItems].effectID;
    if ((effectID != BTEFFECTID_NONE) && (!game->hasEffectID(effectID)))
     effectID = BTEFFECTID_NONE;
    if (effectID == BTEFFECTID_NONE)
    {
     item[numItems].effectID = effectID = game->nextEffectID();
     spellList[spellCast].silentActivate(d, pc, effectID, level);
    }
   }
  }
 }
}
示例#2
0
文件: pc.C 项目: Methuselas/btbuilder
void BTPc::deactivateItems(BTDisplay &d)
{
 BTGame *game = BTGame::getGame();
 BTParty &party = game->getParty();
 int pc = party.find(this);
 BTFactory<BTItem> &itemList = game->getItemList();
 BTFactory<BTSpell, BTSpell1> &spellList = game->getSpellList();
 int numItems = 0;
 for (numItems = 0; numItems < BT_ITEMS; ++numItems)
 {
  if (BTITEM_NONE == item[numItems].id)
   break;
  if (BTITEM_EQUIPPED != item[numItems].equipped)
   continue;
  if (BTTIMESUSABLE_CONTINUOUS == item[numItems].charges)
  {
   int effectID = item[numItems].effectID;
   if (effectID != BTEFFECTID_NONE)
   {
    game->clearEffectsByEffectID(d, effectID);
    item[numItems].effectID = BTEFFECTID_NONE;
   }
  }
 }
}