Files
MinecraftConsoles/Minecraft.World/UntouchingEnchantment.cpp
void_17 7074f35e4b shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
2026-03-02 15:58:20 +07:00

34 lines
825 B
C++

#include "stdafx.h"
#include "net.minecraft.world.item.h"
#include "UntouchingEnchantment.h"
UntouchingEnchantment::UntouchingEnchantment(int id, int frequency) : Enchantment(id, frequency, EnchantmentCategory::digger)
{
setDescriptionId(IDS_ENCHANTMENT_UNTOUCHING);
}
int UntouchingEnchantment::getMinCost(int level)
{
return 15;
}
int UntouchingEnchantment::getMaxCost(int level)
{
return Enchantment::getMinCost(level) + 50;
}
int UntouchingEnchantment::getMaxLevel()
{
return 1;
}
bool UntouchingEnchantment::isCompatibleWith(Enchantment *other) const
{
return Enchantment::isCompatibleWith(other) && other->id != resourceBonus->id;
}
bool UntouchingEnchantment::canEnchant(std::shared_ptr<ItemInstance> item)
{
if (item->getItem()->id == Item::shears_Id) return true;
return Enchantment::canEnchant(item);
}