Increase sword damage dealt by knights (#684)
* Extra sword damage for knights * Make steel sword craftable
This commit is contained in:
parent
037eb8ba96
commit
9666b03ea3
4 changed files with 17 additions and 1 deletions
|
@ -2,12 +2,13 @@ ctf_classes.default_class = "knight"
|
||||||
|
|
||||||
ctf_classes.register("knight", {
|
ctf_classes.register("knight", {
|
||||||
description = "Knight",
|
description = "Knight",
|
||||||
pros = { "+50% health points" },
|
pros = { "Skilled with swords", "+50% health points" },
|
||||||
cons = { "-10% speed" },
|
cons = { "-10% speed" },
|
||||||
color = "#ccc",
|
color = "#ccc",
|
||||||
properties = {
|
properties = {
|
||||||
max_hp = 30,
|
max_hp = 30,
|
||||||
speed = 0.90,
|
speed = 0.90,
|
||||||
|
melee_bonus = 1,
|
||||||
|
|
||||||
initial_stuff = {
|
initial_stuff = {
|
||||||
"default:sword_steel",
|
"default:sword_steel",
|
||||||
|
|
|
@ -7,6 +7,7 @@ dofile(minetest.get_modpath("ctf_classes") .. "/api.lua")
|
||||||
dofile(minetest.get_modpath("ctf_classes") .. "/gui.lua")
|
dofile(minetest.get_modpath("ctf_classes") .. "/gui.lua")
|
||||||
dofile(minetest.get_modpath("ctf_classes") .. "/medic.lua")
|
dofile(minetest.get_modpath("ctf_classes") .. "/medic.lua")
|
||||||
dofile(minetest.get_modpath("ctf_classes") .. "/ranged.lua")
|
dofile(minetest.get_modpath("ctf_classes") .. "/ranged.lua")
|
||||||
|
dofile(minetest.get_modpath("ctf_classes") .. "/melee.lua")
|
||||||
dofile(minetest.get_modpath("ctf_classes") .. "/items.lua")
|
dofile(minetest.get_modpath("ctf_classes") .. "/items.lua")
|
||||||
dofile(minetest.get_modpath("ctf_classes") .. "/flags.lua")
|
dofile(minetest.get_modpath("ctf_classes") .. "/flags.lua")
|
||||||
dofile(minetest.get_modpath("ctf_classes") .. "/classes.lua")
|
dofile(minetest.get_modpath("ctf_classes") .. "/classes.lua")
|
||||||
|
|
13
mods/ctf/ctf_classes/melee.lua
Normal file
13
mods/ctf/ctf_classes/melee.lua
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
||||||
|
if reason.type ~= "punch" or not reason.object or not reason.object:is_player() then
|
||||||
|
return hp_change
|
||||||
|
end
|
||||||
|
|
||||||
|
local class = ctf_classes.get(reason.object)
|
||||||
|
|
||||||
|
if class.properties.melee_bonus and reason.object:get_wielded_item():get_name():find("sword") then
|
||||||
|
return hp_change - class.properties.melee_bonus
|
||||||
|
end
|
||||||
|
|
||||||
|
return hp_change
|
||||||
|
end, true)
|
|
@ -7,6 +7,7 @@ local full_ores = {
|
||||||
}
|
}
|
||||||
|
|
||||||
local sword_materials = {
|
local sword_materials = {
|
||||||
|
steel = "default:steel_ingot",
|
||||||
mese = "default:mese_crystal",
|
mese = "default:mese_crystal",
|
||||||
diamond = "default:diamond",
|
diamond = "default:diamond",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue