Improve knight's damage boost code
This commit is contained in:
parent
ecc6858c15
commit
abb463fbd3
3 changed files with 14 additions and 29 deletions
|
@ -1,28 +1,12 @@
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
||||||
if reason.type ~= "punch" or not reason.object or not reason.object:is_player() then
|
if tool_capabilities.damage_groups.nopunch then return end
|
||||||
return hp_change
|
local class = ctf_classes.get(hitter)
|
||||||
end
|
|
||||||
|
|
||||||
local class = ctf_classes.get(reason.object)
|
if class.properties.melee_bonus and hitter:get_wielded_item():get_name():find("sword") then
|
||||||
|
if time_from_last_punch > 0.75 then
|
||||||
if class.properties.melee_bonus and reason.object:get_wielded_item():get_name():find("sword") then
|
time_from_last_punch = 0.75
|
||||||
local change = hp_change - class.properties.melee_bonus
|
|
||||||
|
|
||||||
if player:get_hp() + change <= 0 and player:get_hp() + hp_change > 0 then
|
|
||||||
local wielded_item = reason.object:get_wielded_item()
|
|
||||||
|
|
||||||
for i = 1, #ctf.registered_on_killedplayer do
|
|
||||||
ctf.registered_on_killedplayer[i](
|
|
||||||
player:get_player_name(),
|
|
||||||
reason.object:get_player_name(),
|
|
||||||
wielded_item,
|
|
||||||
wielded_item:get_tool_capabilities()
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return change
|
player:punch(hitter, 1, {damage_groups = {fleshy = time_from_last_punch*2, nopunch = 1}}, dir)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
return hp_change
|
|
||||||
end, true)
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ local latest_updates = minetest.formspec_escape([[
|
||||||
- Prevented knights from using the SMG
|
- Prevented knights from using the SMG
|
||||||
- Gave medic class building tools and prevented them from using SMG/Shotgun
|
- Gave medic class building tools and prevented them from using SMG/Shotgun
|
||||||
- Changed fall damage to use the combat system
|
- Changed fall damage to use the combat system
|
||||||
- Increased damage dealt by knights (+1 hp) when wielding swords
|
- Increased damage dealt by knights (up to +1.5 hp depending on time since last punch) when wielding swords
|
||||||
- Merged the sniper class with the shooter class
|
- Merged the sniper class with the shooter class
|
||||||
- Changed bandages to give two points per heal
|
- Changed bandages to give two points per heal
|
||||||
- Made rifle automatic and doubled damage
|
- Made rifle automatic and doubled damage
|
||||||
|
@ -17,8 +17,9 @@ if minetest.global_exists("sfinv") then
|
||||||
get = function(self, player, context)
|
get = function(self, player, context)
|
||||||
return sfinv.make_formspec(player, context,
|
return sfinv.make_formspec(player, context,
|
||||||
"real_coordinates[true]" ..
|
"real_coordinates[true]" ..
|
||||||
"box[0.1,0.5;10.4,10.25;#222222]" ..
|
"label[3,0.4;"..minetest.colorize("#00aa00", "The latest updates to CTF are listed here").."]" ..
|
||||||
"textarea[0.1,0.5;10.4,10.25;;The latest updates to CTF are listed here;" .. latest_updates .. "]", false)
|
"box[0.1,0.65;10.4,10.1;#222222]" ..
|
||||||
|
"textarea[0.1,0.65;10.4,10.1;;;" .. latest_updates .. "]", false)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,7 +51,7 @@ function random_messages.read_messages()
|
||||||
"To talk to only your team, start your messages with /t. For example, /t Hello team!",
|
"To talk to only your team, start your messages with /t. For example, /t Hello team!",
|
||||||
"Use medkits to gradually restore your health.",
|
"Use medkits to gradually restore your health.",
|
||||||
"Moving or fighting while using medkits will interrupt the healing process.",
|
"Moving or fighting while using medkits will interrupt the healing process.",
|
||||||
"Knights have a slight damage bonus when attacking with swords.",
|
"Knights have a slight damage bonus (up to 1.5 hp) when attacking with swords.",
|
||||||
"Gain more score by killing more than you die, by healing teammates as a medic, or by capturing the flag.",
|
"Gain more score by killing more than you die, by healing teammates as a medic, or by capturing the flag.",
|
||||||
"You gain more score the better the opponent you defeat.",
|
"You gain more score the better the opponent you defeat.",
|
||||||
"Find weapons in chests or mine and use furnaces to make stronger swords.",
|
"Find weapons in chests or mine and use furnaces to make stronger swords.",
|
||||||
|
@ -78,7 +78,7 @@ function random_messages.read_messages()
|
||||||
"Medics cause troops within 10 metres to regenerate health faster.",
|
"Medics cause troops within 10 metres to regenerate health faster.",
|
||||||
"Hitting your enemy does more damage than not hitting them.",
|
"Hitting your enemy does more damage than not hitting them.",
|
||||||
"Press right mouse button or double-tap the screen to activate scope while wielding a sniper rifle.",
|
"Press right mouse button or double-tap the screen to activate scope while wielding a sniper rifle.",
|
||||||
"The 'Updates' tab in your inventory will show some of the latest updates to CTF"
|
"The 'Updates' tab in your inventory will show some of the latest updates to CTF",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue