void vMover::RemoveDebuff( DWORD dwState ) { __debugbreak(); //RemoveChrStateBuffs( dwState ); if( dwState & CHS_DARK ) SetDark( FALSE ); if( dwState & CHS_POISON ) SetPoison( FALSE ); if( dwState & CHS_STUN ) SetStun( FALSE ); if( dwState & CHS_BLEEDING ) SetBleeding( FALSE ); SetDestParam( DST_CURECHR, dwState, NULL_CHGPARAM ); }
bool CChar::Use_EatQty( CItem * pFood, short iQty ) { ADDTOCALLSTACK("CChar::Use_EatQty"); // low level eat ASSERT(pFood); if ( iQty <= 0 ) return false; if ( iQty > pFood->GetAmount() ) iQty = pFood->GetAmount(); short iRestore = 0; if ( pFood->m_itFood.m_foodval ) iRestore = static_cast<short>(pFood->m_itFood.m_foodval); else iRestore = pFood->Item_GetDef()->GetVolume(); // some food should have more value than other ! if ( iRestore < 1 ) iRestore = 1; short iSpace = Stat_GetMax(STAT_FOOD) - Stat_GetVal(STAT_FOOD); if ( iSpace <= 0 ) return false; if ( iQty > 1 && (iRestore * iQty > iSpace) ) iQty = maximum(1, iSpace / iRestore); switch ( pFood->GetType() ) { case IT_FRUIT: case IT_FOOD: case IT_FOOD_RAW: case IT_MEAT_RAW: if ( pFood->m_itFood.m_poison_skill ) // was the food poisoned? SetPoison(pFood->m_itFood.m_poison_skill * 10, 1 + (pFood->m_itFood.m_poison_skill / 50), this); default: break; } UpdateDir(pFood); EatAnim(pFood->GetName(), iRestore * iQty); pFood->ConsumeAmount(iQty); return true; }
void CChar::Use_Drink( CItem * pItem ) { ADDTOCALLSTACK("CChar::Use_Drink"); // IT_POTION: // IT_DRINK: // IT_PITCHER: // IT_WATER_WASH: // IT_BOOZE: if ( !CanMove(pItem) ) { SysMessageDefault(DEFMSG_DRINK_CANTMOVE); return; } const CItemBase *pItemDef = pItem->Item_GetDef(); ITEMID_TYPE idbottle = static_cast<ITEMID_TYPE>(RES_GET_INDEX(pItemDef->m_ttDrink.m_idEmpty)); if ( pItem->IsType(IT_BOOZE) ) { // Beer wine and liquor. vary strength of effect. int iAlcohol = Calc_GetRandVal(4); CItem *pDrunkLayer = LayerFind(LAYER_FLAG_Drunk); if ( !pDrunkLayer ) pDrunkLayer = Spell_Effect_Create(SPELL_Liquor, LAYER_FLAG_Drunk, 0, 5 * TICK_PER_SEC, this); pDrunkLayer->m_itSpell.m_spellcharges += iAlcohol; if ( pDrunkLayer->m_itSpell.m_spellcharges > 60 ) pDrunkLayer->m_itSpell.m_spellcharges = 60; } if ( pItem->IsType(IT_POTION) ) { // Time limit on using potions. if ( LayerFind(LAYER_FLAG_PotionUsed) ) { SysMessageDefault(DEFMSG_DRINK_POTION_DELAY); return; } // Convey the effect of the potion. int iSkillQuality = pItem->m_itPotion.m_skillquality; if ( g_Cfg.m_iFeatureAOS & FEATURE_AOS_UPDATE_B ) { int iEnhance = static_cast<int>(GetDefNum("EnhancePotions", false)); if ( iEnhance ) iSkillQuality += IMULDIV(iSkillQuality, iEnhance, 100); } OnSpellEffect(static_cast<SPELL_TYPE>(RES_GET_INDEX(pItem->m_itPotion.m_Type)), this, iSkillQuality, pItem); // Give me the marker that i've used a potion. Spell_Effect_Create(SPELL_NONE, LAYER_FLAG_PotionUsed, iSkillQuality, 15 * TICK_PER_SEC, this); } if ( pItem->IsType(IT_DRINK) && IsSetOF(OF_DrinkIsFood) ) { short iRestore = 0; if ( pItem->m_itDrink.m_foodval ) iRestore = static_cast<short>(pItem->m_itDrink.m_foodval); else iRestore = static_cast<short>(pItem->Item_GetDef()->GetVolume()); if ( iRestore < 1 ) iRestore = 1; if ( Stat_GetVal(STAT_FOOD) >= Stat_GetMax(STAT_FOOD) ) { SysMessageDefault(DEFMSG_DRINK_FULL); return; } Stat_SetVal(STAT_FOOD, Stat_GetVal(STAT_FOOD) + iRestore); if ( pItem->m_itFood.m_poison_skill ) SetPoison(pItem->m_itFood.m_poison_skill * 10, 1 + (pItem->m_itFood.m_poison_skill / 50), this); } //Sound(sm_DrinkSounds[Calc_GetRandVal(COUNTOF(sm_DrinkSounds))]); UpdateAnimate(ANIM_EAT); pItem->ConsumeAmount(); // Create the empty bottle ? if ( idbottle != ITEMID_NOTHING ) ItemBounce(CItem::CreateScript(idbottle, this), false); }