File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed
Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -4164,16 +4164,28 @@ void Player::death(const std::shared_ptr<Creature> &lastHitCreature) {
41644164 bool hasSkull = (playerSkull == Skulls_t::SKULL_RED || playerSkull == Skulls_t::SKULL_BLACK);
41654165 uint8_t maxBlessing = 8 ;
41664166 if (!hasSkull && pvpDeath && hasBlessing (1 )) {
4167- removeBlessing (1 , 1 ); // Remove TOF only
4167+ auto storeCount = getBlessingCount (1 , true );
4168+ if (storeCount > 0 ) {
4169+ auto currentStore = kv ()->scoped (" summary" )->scoped (" blessings" )->scoped (fmt::format (" {}" , 1 ))->get (" amount" );
4170+ if (currentStore) {
4171+ auto newAmount = std::max (0 , static_cast <int >(currentStore->getNumber ()) - 1 );
4172+ kv ()->scoped (" summary" )->scoped (" blessings" )->scoped (fmt::format (" {}" , 1 ))->set (" amount" , newAmount);
4173+ }
4174+ } else {
4175+ removeBlessing (1 , 1 );
4176+ }
41684177 } else {
41694178 for (int i = 2 ; i <= maxBlessing; i++) {
4170- removeBlessing (i, 1 );
4171- }
4172-
4173- const auto &playerAmulet = getThing (CONST_SLOT_NECKLACE);
4174- bool usingAol = (playerAmulet && playerAmulet->getItem ()->getID () == ITEM_AMULETOFLOSS);
4175- if (usingAol) {
4176- removeItemOfType (ITEM_AMULETOFLOSS, 1 , -1 );
4179+ auto storeCount = getBlessingCount (i, true );
4180+ if (storeCount > 0 ) {
4181+ auto currentStore = kv ()->scoped (" summary" )->scoped (" blessings" )->scoped (fmt::format (" {}" , i))->get (" amount" );
4182+ if (currentStore) {
4183+ auto newAmount = std::max (0 , static_cast <int >(currentStore->getNumber ()) - 1 );
4184+ kv ()->scoped (" summary" )->scoped (" blessings" )->scoped (fmt::format (" {}" , i))->set (" amount" , newAmount);
4185+ }
4186+ } else {
4187+ removeBlessing (i, 1 );
4188+ }
41774189 }
41784190 }
41794191 }
You can’t perform that action at this time.
0 commit comments