2020-12-14 15:08:55 +02:00
local S = minetest.get_translator ( " mcl_enchanting " )
2020-11-01 14:44:05 +02:00
-- Taken from https://minecraft.gamepedia.com/Enchanting
2020-11-13 13:21:36 +02:00
local function increase_damage ( damage_group , factor )
return function ( itemstack , level )
local tool_capabilities = itemstack : get_tool_capabilities ( )
tool_capabilities.damage_groups [ damage_group ] = ( tool_capabilities.damage_groups [ damage_group ] or 0 ) + level * factor
itemstack : get_meta ( ) : set_tool_capabilities ( tool_capabilities )
end
end
2020-11-01 18:24:57 +02:00
-- requires engine change
--[[mcl_enchanting.enchantments.aqua_affinity = {
2020-12-14 15:08:55 +02:00
name = S ( " Aqua Affinity " ) ,
2020-11-01 14:44:05 +02:00
max_level = 1 ,
primary = { armor_head = true } ,
secondary = { } ,
disallow = { non_combat_armor = true } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases underwater mining speed. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 1 , 41 } } ,
2020-11-01 18:24:57 +02:00
} ] ] --
2020-11-01 14:44:05 +02:00
2020-11-09 19:59:08 +02:00
-- implemented via on_enchant and additions in mobs_mc; Slowness IV part unimplemented
mcl_enchanting.enchantments . bane_of_arthropods = {
2020-12-14 15:08:55 +02:00
name = S ( " Bane of Arthropods " ) ,
2020-11-01 14:44:05 +02:00
max_level = 5 ,
primary = { sword = true } ,
secondary = { axe = true } ,
disallow = { } ,
2021-01-06 20:04:04 +02:00
incompatible = { smite = true , sharpness = true } ,
2020-11-01 14:44:05 +02:00
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites). " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
2020-11-09 19:59:08 +02:00
on_enchant = increase_damage ( " anthropod " , 2.5 ) ,
2020-11-01 14:44:05 +02:00
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 5 , 25 } , { 13 , 33 } , { 21 , 41 } , { 29 , 49 } , { 37 , 57 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-13 13:21:36 +02:00
-- implemented in mcl_armor
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . blast_protection = {
2020-12-14 15:08:55 +02:00
name = S ( " Blast Protection " ) ,
2020-11-01 14:44:05 +02:00
max_level = 4 ,
primary = { armor_head = true , armor_torso = true , armor_legs = true , armor_feet = true } ,
secondary = { } ,
disallow = { non_combat_armor = true } ,
incompatible = { fire_protection = true , protection = true , projectile_protection = true } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Reduces explosion damage and knockback. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 5 , 13 } , { 13 , 21 } , { 21 , 29 } , { 29 , 37 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-25 13:47:27 +02:00
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.channeling = {
2020-12-14 15:08:55 +02:00
name = S ( " Channeling " ) ,
2020-11-25 13:47:27 +02:00
max_level = 1 ,
primary = { trident = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { riptide = true } ,
weight = 1 ,
2020-12-14 15:08:55 +02:00
description = S ( " Channels a bolt of lightning toward a target. Works only during thunderstorms and if target is unobstructed with opaque blocks. " ) ,
2020-11-25 13:47:27 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
treasure = false ,
power_range_table = { { 25 , 50 } } ,
} ] ] --
2020-11-01 18:24:57 +02:00
-- implemented in mcl_armor
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . curse_of_binding = {
2020-12-14 15:08:55 +02:00
name = S ( " Curse of Binding " ) ,
2020-11-01 14:44:05 +02:00
max_level = 1 ,
primary = { } ,
secondary = { armor_head = true , armor_torso = true , armor_legs = true , armor_feet = true } ,
disallow = { } ,
incompatible = { } ,
weight = 1 ,
2020-12-14 15:08:55 +02:00
description = S ( " Item cannot be removed from armor slots except due to death, breaking or in Creative Mode. " ) ,
2020-11-01 14:44:05 +02:00
curse = true ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = true ,
power_range_table = { { 25 , 50 } } ,
2020-11-01 14:44:05 +02:00
}
-- implemented in mcl_death_drop
mcl_enchanting.enchantments . curse_of_vanishing = {
2020-12-14 15:08:55 +02:00
name = S ( " Curse of Vanishing " ) ,
2020-11-01 14:44:05 +02:00
max_level = 1 ,
primary = { } ,
secondary = { armor_head = true , armor_torso = true , armor_legs = true , armor_feet = true , tool = true , weapon = true } ,
2020-11-25 13:47:27 +02:00
disallow = { } ,
2020-11-01 14:44:05 +02:00
incompatible = { } ,
weight = 1 ,
2020-12-14 15:08:55 +02:00
description = S ( " Item destroyed on death. " ) ,
2020-11-01 14:44:05 +02:00
curse = true ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = true ,
power_range_table = { { 25 , 50 } } ,
2020-11-01 14:44:05 +02:00
}
-- unimplemented
2020-11-25 13:47:27 +02:00
--[[mcl_enchanting.enchantments.depth_strider = {
2020-12-14 15:08:55 +02:00
name = S ( " Depth Strider " ) ,
2020-11-01 14:44:05 +02:00
max_level = 3 ,
primary = { } ,
secondary = { armor_feet = true } ,
disallow = { non_combat_armor = true } ,
incompatible = { frost_walker = true } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases underwater movement speed. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 10 , 25 } , { 20 , 35 } , { 30 , 45 } } ,
} ] ] --
2020-11-01 14:44:05 +02:00
2020-11-02 14:38:17 +02:00
-- implemented via on_enchant
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . efficiency = {
2020-12-14 15:08:55 +02:00
name = S ( " Efficiency " ) ,
2020-11-01 14:44:05 +02:00
max_level = 5 ,
primary = { pickaxe = true , shovel = true , axe = true , hoe = true } ,
secondary = { shears = true } ,
disallow = { } ,
incompatible = { } ,
weight = 10 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases mining speed. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
2020-11-02 18:58:13 +02:00
on_enchant = function ( itemstack , level )
2020-11-02 14:38:17 +02:00
local tool_capabilities = itemstack : get_tool_capabilities ( )
local groupcaps = { }
for group , capability in pairs ( tool_capabilities.groupcaps ) do
local groupname = group .. " _efficiency_ " .. level
capability.times = mcl_autogroup.digtimes [ groupname ]
groupcaps [ groupname ] = capability
end
tool_capabilities.groupcaps = groupcaps
itemstack : get_meta ( ) : set_tool_capabilities ( tool_capabilities )
end ,
2020-11-01 14:44:05 +02:00
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 1 , 61 } , { 11 , 71 } , { 21 , 81 } , { 31 , 91 } , { 41 , 101 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-13 13:21:36 +02:00
-- implemented in mcl_armor
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . feather_falling = {
2020-12-14 15:08:55 +02:00
name = S ( " Feather Falling " ) ,
2020-11-01 14:44:05 +02:00
max_level = 4 ,
primary = { armor_feet = true } ,
secondary = { } ,
disallow = { non_combat_armor = true } ,
incompatible = { } ,
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Reduces fall damage. " ) , curse = false ,
2020-11-01 14:44:05 +02:00
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 5 , 11 } , { 11 , 17 } , { 17 , 23 } , { 23 , 29 } } ,
2020-11-01 14:44:05 +02:00
}
2021-01-02 11:56:40 +02:00
-- implemented in mcl_mobs and via register_on_punchplayer callback
2021-01-01 20:51:31 +02:00
mcl_enchanting.enchantments . fire_aspect = {
2020-12-14 15:08:55 +02:00
name = S ( " Fire Aspect " ) ,
2020-11-01 14:44:05 +02:00
max_level = 2 ,
primary = { sword = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Sets target on fire. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 10 , 61 } , { 30 , 71 } } ,
2021-01-01 20:51:31 +02:00
}
minetest.register_on_punchplayer ( function ( player , hitter , time_from_last_punch , tool_capabilities , dir , damage )
if hitter and hitter : is_player ( ) then
local wielditem = hitter : get_wielded_item ( )
if wielditem then
local fire_aspect_level = mcl_enchanting.get_enchantment ( wielditem , " fire_aspect " )
if fire_aspect_level > 0 then
2021-01-10 15:16:00 +02:00
mcl_burning.set_on_fire ( player , fire_aspect_level * 4 - 1 , 1 , hitter : get_player_name ( ) )
2021-01-01 20:51:31 +02:00
end
end
end
end )
2020-11-01 14:44:05 +02:00
2020-11-13 13:21:36 +02:00
-- implemented in mcl_armor
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . fire_protection = {
2020-12-14 15:08:55 +02:00
name = S ( " Fire Protection " ) ,
2020-11-01 14:44:05 +02:00
max_level = 4 ,
primary = { armor_head = true , armor_torso = true , armor_legs = true , armor_feet = true } ,
secondary = { } ,
disallow = { non_combat_armor = true } ,
incompatible = { blast_protection = true , protection = true , projectile_protection = true } ,
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Reduces fire damage. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 10 , 18 } , { 18 , 26 } , { 26 , 34 } , { 34 , 42 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-02 18:58:13 +02:00
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.flame = {
2020-12-14 15:08:55 +02:00
name = S ( " Flame " ) ,
2020-11-01 14:44:05 +02:00
max_level = 1 ,
primary = { bow = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Arrows set target on fire. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 20 , 50 } } ,
2020-11-02 18:58:13 +02:00
} ] ] --
2020-11-01 14:44:05 +02:00
2020-11-06 16:05:31 +02:00
-- implemented in mcl_item_entity
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . fortune = {
2020-12-14 15:08:55 +02:00
name = S ( " Fortune " ) ,
2020-11-25 13:47:27 +02:00
max_level = 3 ,
2020-11-01 14:44:05 +02:00
primary = { pickaxe = true , shovel = true , axe = true , hoe = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { silk_touch = true } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases certain block drops. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 15 , 61 } , { 24 , 71 } , { 33 , 81 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-06 14:46:52 +02:00
-- implemented via walkover.register_global
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . frost_walker = {
2020-12-14 15:08:55 +02:00
name = S ( " Frost Walker " ) ,
2020-11-01 14:44:05 +02:00
max_level = 2 ,
primary = { } ,
secondary = { armor_feet = true } ,
disallow = { non_combat_armor = true } ,
incompatible = { depth_strider = true } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Turns water beneath the player into frosted ice and prevents the damage from magma blocks. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = true ,
power_range_table = { { 10 , 25 } , { 20 , 35 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-05 17:05:42 +02:00
walkover.register_global ( function ( pos , _ , player )
local boots = player : get_inventory ( ) : get_stack ( " armor " , 5 )
local frost_walker = mcl_enchanting.get_enchantment ( boots , " frost_walker " )
if frost_walker <= 0 then
return
end
local radius = frost_walker + 2
local minp = { x = pos.x - radius , y = pos.y , z = pos.z - radius }
local maxp = { x = pos.x + radius , y = pos.y , z = pos.z + radius }
local positions = minetest.find_nodes_in_area_under_air ( minp , maxp , " mcl_core:water_source " )
for _ , p in ipairs ( positions ) do
if vector.distance ( pos , p ) <= radius then
minetest.set_node ( p , { name = " mcl_core:frosted_ice_0 " } )
end
end
end )
2020-11-25 13:47:27 +02:00
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.impaling = {
2020-12-14 15:08:55 +02:00
name = S ( " Impaling " ) ,
2020-11-25 13:47:27 +02:00
max_level = 5 ,
primary = { trident = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Trident deals additional damage to ocean mobs. " ) ,
2020-11-25 13:47:27 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
treasure = false ,
power_range_table = { { 1 , 21 } , { 9 , 29 } , { 17 , 37 } , { 25 , 45 } , { 33 , 53 } } ,
} ] ] --
2020-11-01 14:44:05 +02:00
-- implemented in mcl_bows
mcl_enchanting.enchantments . infinity = {
2020-12-14 15:08:55 +02:00
name = S ( " Infinity " ) ,
2020-11-01 14:44:05 +02:00
max_level = 1 ,
primary = { bow = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { mending = true } ,
weight = 1 ,
2020-12-14 15:08:55 +02:00
description = S ( " Shooting consumes no regular arrows. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 20 , 50 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-04 13:00:42 +02:00
-- implemented via minetest.calculate_knockback
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . knockback = {
2020-12-14 15:08:55 +02:00
name = S ( " Knockback " ) ,
2020-11-01 14:44:05 +02:00
max_level = 2 ,
primary = { sword = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { } ,
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases knockback. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 5 , 61 } , { 25 , 71 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-04 13:00:42 +02:00
local old_calculate_knockback = minetest.calculate_knockback
function minetest . calculate_knockback ( player , hitter , time_from_last_punch , tool_capabilities , dir , distance , damage )
local knockback = old_calculate_knockback ( player , hitter , time_from_last_punch , tool_capabilities , dir , distance , damage )
2020-11-06 16:05:31 +02:00
local luaentity
if hitter then
luaentity = hitter : get_luaentity ( )
end
2020-11-04 13:00:42 +02:00
if hitter and hitter : is_player ( ) then
local wielditem = hitter : get_wielded_item ( )
knockback = knockback + 3 * mcl_enchanting.get_enchantment ( wielditem , " knockback " )
2020-11-06 16:05:31 +02:00
elseif luaentity and luaentity._knockback then
knockback = knockback + luaentity._knockback
2020-11-04 13:00:42 +02:00
end
return knockback
end
2021-01-02 22:42:07 +02:00
-- implemented in mcl_mobs and mobs_mc
2020-12-23 18:41:42 +02:00
mcl_enchanting.enchantments . looting = {
2020-12-14 15:08:55 +02:00
name = S ( " Looting " ) ,
2020-11-01 14:44:05 +02:00
max_level = 3 ,
primary = { sword = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases mob loot. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 15 , 61 } , { 24 , 71 } , { 33 , 81 } } ,
2020-12-23 18:41:42 +02:00
}
2020-11-25 13:47:27 +02:00
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.loyalty = {
2020-12-14 15:08:55 +02:00
name = S ( " Loyalty " ) ,
2020-11-25 13:47:27 +02:00
max_level = 3 ,
primary = { trident = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { riptide = true } ,
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Trident returns after being thrown. Higher levels reduce return time. " ) ,
2020-11-25 13:47:27 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
treasure = false ,
power_range_table = { { 12 , 50 } , { 19 , 50 } , { 26 , 50 } } ,
} ] ] --
2020-11-01 14:44:05 +02:00
2020-12-23 18:41:42 +02:00
-- implemented in mcl_fishing
2020-12-23 16:18:20 +02:00
mcl_enchanting.enchantments . luck_of_the_sea = {
2020-12-14 15:08:55 +02:00
name = S ( " Luck of the Sea " ) ,
2020-11-01 14:44:05 +02:00
max_level = 3 ,
primary = { fishing_rod = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases rate of good loot (enchanting books, etc.) " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 15 , 61 } , { 24 , 71 } , { 33 , 81 } } ,
2020-12-23 16:18:20 +02:00
}
2020-11-01 14:44:05 +02:00
2020-11-09 19:59:08 +02:00
-- implemented in mcl_fishing
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . lure = {
2020-12-14 15:08:55 +02:00
name = S ( " Lure " ) ,
2020-11-01 14:44:05 +02:00
max_level = 3 ,
primary = { fishing_rod = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Decreases time until rod catches something. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 15 , 61 } , { 24 , 71 } , { 33 , 81 } } ,
2020-11-01 14:44:05 +02:00
}
2020-12-21 16:12:24 +02:00
-- implemented in mcl_experience
mcl_enchanting.enchantments . mending = {
2020-12-14 15:08:55 +02:00
name = S ( " Mending " ) ,
2020-11-01 14:44:05 +02:00
max_level = 1 ,
primary = { } ,
secondary = { armor_head = true , armor_torso = true , armor_legs = true , armor_feet = true , tool = true , weapon = true } ,
2020-11-01 15:23:43 +02:00
disallow = { } ,
2020-11-01 14:44:05 +02:00
incompatible = { infinity = true } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Repair the item while gaining XP orbs. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = true ,
2020-11-25 13:47:27 +02:00
treasure = true ,
power_range_table = { { 25 , 75 } } ,
2020-12-21 16:12:24 +02:00
}
2020-11-25 13:47:27 +02:00
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.multishot = {
2020-12-14 15:08:55 +02:00
name = S ( " Multishot " ) ,
2020-11-25 13:47:27 +02:00
max_level = 1 ,
primary = { crossbow = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { piercing = true } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Shoot 3 arrows at the cost of one. " ) ,
2020-11-25 13:47:27 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
treasure = false ,
power_range_table = { { 20 , 50 } } ,
} ] ] --
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.piercing = {
2020-12-14 15:08:55 +02:00
name = S ( " Piercing " ) ,
2020-11-25 13:47:27 +02:00
max_level = 4 ,
primary = { crossbow = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { multishot = true } ,
weight = 10 ,
2020-12-14 15:08:55 +02:00
description = S ( " Arrows passes through multiple objects. " ) ,
2020-11-25 13:47:27 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
treasure = false ,
power_range_table = { { 1 , 50 } , { 11 , 50 } , { 21 , 50 } , { 31 , 50 } } ,
} ] ] --
2020-11-01 14:44:05 +02:00
2020-11-05 16:25:44 +02:00
-- implemented in mcl_bows
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . power = {
2020-12-14 15:08:55 +02:00
name = S ( " Power " ) ,
2020-11-01 14:44:05 +02:00
max_level = 5 ,
2020-11-25 13:47:27 +02:00
primary = { bow = true } ,
secondary = { } ,
2020-11-01 14:44:05 +02:00
disallow = { } ,
incompatible = { } ,
weight = 10 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases arrow damage. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 1 , 16 } , { 11 , 26 } , { 21 , 36 } , { 31 , 46 } , { 41 , 56 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-13 13:21:36 +02:00
-- implemented in mcl_armor
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . projectile_protection = {
2020-12-14 15:08:55 +02:00
name = S ( " Projectile Protection " ) ,
2020-11-01 14:44:05 +02:00
max_level = 4 ,
primary = { armor_head = true , armor_torso = true , armor_legs = true , armor_feet = true } ,
secondary = { } ,
disallow = { non_combat_armor = true } ,
incompatible = { blast_protection = true , fire_protection = true , protection = true } ,
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Reduces projectile damage. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 1 , 16 } , { 11 , 26 } , { 21 , 36 } , { 31 , 46 } , { 41 , 56 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-10 14:58:39 +02:00
-- implemented in mcl_armor
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . protection = {
2020-12-14 15:08:55 +02:00
name = S ( " Protection " ) ,
2020-11-01 14:44:05 +02:00
max_level = 4 ,
primary = { armor_head = true , armor_torso = true , armor_legs = true , armor_feet = true } ,
secondary = { } ,
disallow = { non_combat_armor = true } ,
incompatible = { blast_protection = true , fire_protection = true , projectile_protection = true } ,
weight = 10 ,
2020-12-14 15:08:55 +02:00
description = S ( " Reduces most types of damage by 4% for each level. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 1 , 12 } , { 12 , 23 } , { 23 , 34 } , { 34 , 45 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-06 16:05:31 +02:00
-- implemented via minetest.calculate_knockback (together with the Knockback enchantment) and mcl_bows
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . punch = {
2020-12-14 15:08:55 +02:00
name = S ( " Punch " ) ,
2020-11-01 14:44:05 +02:00
max_level = 2 ,
primary = { } ,
secondary = { bow = true } ,
disallow = { } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases arrow knockback. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 12 , 37 } , { 32 , 57 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-25 13:47:27 +02:00
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.quick_charge = {
2020-12-14 15:08:55 +02:00
name = S ( " Quick Charge " ) ,
2020-11-25 13:47:27 +02:00
max_level = 3 ,
primary = { crossbow = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { } ,
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Decreases crossbow charging time. " ) ,
2020-11-25 13:47:27 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
treasure = false ,
power_range_table = { { 12 , 50 } , { 32 , 50 } , { 52 , 50 } } ,
} ] ] --
2020-11-01 14:44:05 +02:00
-- unimplemented
2020-11-25 13:47:27 +02:00
--[[mcl_enchanting.enchantments.respiration = {
2020-12-14 15:08:55 +02:00
name = S ( " Respiration " ) ,
2020-11-01 14:44:05 +02:00
max_level = 3 ,
primary = { armor_head = true } ,
secondary = { } ,
disallow = { non_combat_armor = true } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Extends underwater breathing time. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 10 , 40 } , { 20 , 50 } , { 30 , 60 } } ,
} ] ] --
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.riptide = {
2020-12-14 15:08:55 +02:00
name = S ( " Riptide " ) ,
2020-11-25 13:47:27 +02:00
max_level = 3 ,
primary = { trident = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { channeling = true , loyalty = true } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Trident launches player with itself when thrown. Works only in water or rain. " ) ,
2020-11-25 13:47:27 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
treasure = false ,
power_range_table = { { 17 , 50 } , { 24 , 50 } , { 31 , 50 } } ,
} ] ] --
2020-11-01 14:44:05 +02:00
2020-11-02 18:58:13 +02:00
-- implemented via on_enchant
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . sharpness = {
2020-12-14 15:08:55 +02:00
name = S ( " Sharpness " ) ,
2020-11-01 14:44:05 +02:00
max_level = 5 ,
primary = { sword = true } ,
secondary = { axe = true } ,
disallow = { } ,
2020-11-09 19:59:08 +02:00
incompatible = { bane_of_arthropods = true , smite = true } ,
2020-11-01 14:44:05 +02:00
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases damage. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
2020-11-09 19:59:08 +02:00
on_enchant = increase_damage ( " fleshy " , 0.5 ) ,
2020-11-01 14:44:05 +02:00
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 1 , 21 } , { 12 , 32 } , { 23 , 43 } , { 34 , 54 } , { 45 , 65 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-02 20:09:23 +02:00
-- implemented in mcl_item_entity
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . silk_touch = {
2020-12-14 15:08:55 +02:00
name = S ( " Silk Touch " ) ,
2020-11-01 14:44:05 +02:00
max_level = 1 ,
primary = { pickaxe = true , shovel = true , axe = true , hoe = true } ,
secondary = { shears = true } ,
disallow = { } ,
incompatible = { fortune = true } ,
weight = 1 ,
2020-12-14 15:08:55 +02:00
description = S ( " Mined blocks drop themselves. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 15 , 61 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-09 19:59:08 +02:00
-- implemented via on_enchant and additions in mobs_mc
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . smite = {
2020-12-14 15:08:55 +02:00
name = S ( " Smite " ) ,
2020-11-01 14:44:05 +02:00
max_level = 5 ,
primary = { sword = true } ,
secondary = { axe = true } ,
disallow = { } ,
2020-11-09 19:59:08 +02:00
incompatible = { bane_of_arthropods = true , sharpness = true } ,
2020-11-01 14:44:05 +02:00
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases damage to undead mobs. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
2020-11-09 19:59:08 +02:00
on_enchant = increase_damage ( " undead " , 2.5 ) ,
2020-11-01 14:44:05 +02:00
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 5 , 25 } , { 13 , 33 } , { 21 , 41 } , { 29 , 49 } , { 37 , 57 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-09 11:50:27 +02:00
-- implemented in mcl_playerplus
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . soul_speed = {
2020-12-14 15:08:55 +02:00
name = S ( " Soul Speed " ) ,
2020-11-01 14:44:05 +02:00
max_level = 3 ,
primary = { } ,
secondary = { armor_feet = true } ,
disallow = { non_combat_armor = true } ,
incompatible = { frost_walker = true } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases walking speed on soul sand. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = true ,
power_range_table = { { 10 , 25 } , { 20 , 35 } , { 30 , 45 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-02 18:58:13 +02:00
-- requires missing MineClone2 feature
--[[mcl_enchanting.enchantments.sweeping_edge = {
2020-12-14 15:08:55 +02:00
name = S ( " Sweeping Edge " ) ,
2020-11-01 14:44:05 +02:00
max_level = 3 ,
primary = { sword = true } ,
secondary = { } ,
disallow = { } ,
incompatible = { } ,
weight = 2 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases sweeping attack damage. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 5 , 20 } , { 14 , 29 } , { 23 , 38 } } ,
2020-11-02 18:58:13 +02:00
} ] ] --
2020-11-01 14:44:05 +02:00
2020-11-13 13:21:36 +02:00
-- implemented in mcl_armor
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . thorns = {
2020-12-14 15:08:55 +02:00
name = S ( " Thorns " ) ,
2020-11-01 14:44:05 +02:00
max_level = 3 ,
primary = { armor_head = true } ,
secondary = { armor_torso = true , armor_legs = true , armor_feet = true } ,
disallow = { non_combat_armor = true } ,
2021-01-06 20:41:11 +02:00
incompatible = { } ,
2020-11-01 14:44:05 +02:00
weight = 1 ,
2020-12-14 15:08:55 +02:00
description = S ( " Reflects some of the damage taken when hit, at the cost of reducing durability with each proc. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
on_enchant = function ( ) end ,
requires_tool = false ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 10 , 61 } , { 30 , 71 } , { 50 , 81 } } ,
2020-11-01 14:44:05 +02:00
}
2020-11-02 18:38:51 +02:00
-- for tools & weapons implemented via on_enchant; for bows implemented in mcl_bows; for armor implemented in mcl_armor and mcl_tt; for fishing rods implemented in mcl_fishing
2020-11-01 14:44:05 +02:00
mcl_enchanting.enchantments . unbreaking = {
2020-12-14 15:08:55 +02:00
name = S ( " Unbreaking " ) ,
2020-11-01 14:44:05 +02:00
max_level = 3 ,
primary = { armor_head = true , armor_torso = true , armor_legs = true , armor_feet = true , pickaxe = true , shovel = true , axe = true , hoe = true , sword = true , fishing_rod = true , bow = true } ,
secondary = { tool = true } ,
disallow = { non_combat_armor = true } ,
incompatible = { } ,
weight = 5 ,
2020-12-14 15:08:55 +02:00
description = S ( " Increases item durability. " ) ,
2020-11-01 14:44:05 +02:00
curse = false ,
2021-01-04 18:53:49 +02:00
on_enchant = function ( itemstack , level )
2020-11-02 18:58:13 +02:00
local tool_capabilities = itemstack : get_tool_capabilities ( )
for group , capability in pairs ( tool_capabilities.groupcaps ) do
2020-11-02 14:38:17 +02:00
capability.uses = capability.uses * ( 1 + level )
end
2020-11-02 18:58:13 +02:00
tool_capabilities.punch_attack_uses = tool_capabilities.punch_attack_uses * ( 1 + level )
itemstack : get_meta ( ) : set_tool_capabilities ( tool_capabilities )
2020-11-02 14:38:17 +02:00
end ,
2020-11-01 14:44:05 +02:00
requires_tool = true ,
2020-11-25 13:47:27 +02:00
treasure = false ,
power_range_table = { { 5 , 61 } , { 13 , 71 } , { 21 , 81 } } ,
2020-11-01 14:44:05 +02:00
}