Fixed iron skin making the player invincible to ice spikes
This commit is contained in:
parent
ae572d966d
commit
85a624c8e7
@ -93,12 +93,6 @@ end)
|
||||
|
||||
|
||||
|
||||
arena_lib.on_disconnect("fantasy_brawl", function(arena, pl_name, is_spectator)
|
||||
if is_spectator or not arena.classes or not arena.classes[pl_name] then return end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
minetest.register_allow_player_inventory_action(function(player, action, inventory, inventory_info)
|
||||
local pl_name = player:get_player_name()
|
||||
local mod = arena_lib.get_mod_by_player(pl_name)
|
||||
|
@ -24,6 +24,9 @@ function fbrawl.out_of_match_operations(pl_name)
|
||||
for skill_name, def in pairs(skillz.get_unlocked_skills(pl_name, "fbrawl")) do
|
||||
pl_name:remove_skill(skill_name)
|
||||
end
|
||||
|
||||
player:set_properties({hp_max = minetest.PLAYER_MAX_HP_DEFAULT})
|
||||
player:set_hp(minetest.PLAYER_MAX_HP_DEFAULT)
|
||||
end
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@ end)
|
||||
|
||||
function fbrawl.spawn_blood_particle(player, damage)
|
||||
minetest.add_particlespawner({
|
||||
amount = damage * 4,
|
||||
amount = damage / 2,
|
||||
time = 0.4,
|
||||
minvel = {x = -1, y = 0.5, z = -1},
|
||||
maxvel = {x = 1, y = -2, z = 1},
|
||||
|
@ -67,6 +67,9 @@ function fbrawl.apply_class(pl_name, class)
|
||||
pl_name:get_skill("fbrawl:hp_regen").data.custom_cast_rate = class.hp_regen_rate
|
||||
pl_name:start_skill("fbrawl:hp_regen")
|
||||
|
||||
player:set_properties({hp_max = 200})
|
||||
player:set_hp(200)
|
||||
|
||||
-- Unlocking the player's skills.
|
||||
for i, skill_name in pairs(class.skills) do
|
||||
pl_name:unlock_skill(skill_name)
|
||||
|
@ -15,7 +15,7 @@ skillz.register_skill("fbrawl:hp_regen", {
|
||||
local seconds_since_last_hit = fbrawl.get_time_in_seconds() - self.data.last_hit_timestamp
|
||||
|
||||
if self.player:get_hp() > 0 and seconds_since_last_hit >= self.out_of_fight_min_seconds then
|
||||
self.player:set_hp(self.player:get_hp() + 1)
|
||||
self.player:set_hp(self.player:get_hp() + 1 * 10)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -34,7 +34,7 @@ local bubble_beam = {
|
||||
initial_sprite_basepos = {x = 0, y = 0},
|
||||
speed = 50,
|
||||
range = 1.8,
|
||||
damage = 1.5
|
||||
damage = 1.5
|
||||
},
|
||||
pl_name = "",
|
||||
hit = false,
|
||||
|
@ -10,9 +10,12 @@ skillz.register_skill("fbrawl:ice_spikes", {
|
||||
},
|
||||
spikes = 7,
|
||||
cast = function(self)
|
||||
local pitch = 0
|
||||
local yaw = self.player:get_look_horizontal()
|
||||
local pl_left_dir = vector.new(math.cos(pitch) * math.cos(yaw), math.sin(pitch), math.cos(pitch) * math.sin(yaw))
|
||||
|
||||
local look_dir = self.player:get_look_dir()
|
||||
look_dir.y = 0
|
||||
local pl_left_dir = vector.rotate_around_axis(look_dir, vector.new(0,1,0), -1.5708)
|
||||
|
||||
local spike_base_pos = vector.subtract(self.player:get_pos(), vector.multiply(pl_left_dir, self.spikes/2))
|
||||
spike_base_pos = vector.add(spike_base_pos, {x=0, y=-1, z=0})
|
||||
|
@ -6,11 +6,11 @@ minetest.register_tool("fantasy_brawl:sword_steel", {
|
||||
inventory_image = "default_tool_steelsword.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.8,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=4},
|
||||
--max_drop_level=1,
|
||||
--groupcaps={
|
||||
-- snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, maxlevel=2},
|
||||
--},
|
||||
damage_groups = {fleshy=2*20},
|
||||
},
|
||||
groups = {sword = 1},
|
||||
on_place = function(itemstack, player, pointed_thing)
|
||||
|
@ -138,7 +138,8 @@ skillz.register_skill("fbrawl:smash", {
|
||||
if fbrawl.is_on_the_ground(self.player) and self.data.started then
|
||||
local range = vector.new(self.range, 2, self.range)
|
||||
|
||||
fbrawl.damage_players_near(self.player, self.player:get_pos(), range, self.damage, nil, function(hit_pl)
|
||||
fbrawl.damage_players_near(self.player, self.player:get_pos(), range, self.damage, nil, function(hit_pl_name)
|
||||
local hit_pl = minetest.get_player_by_name(hit_pl_name)
|
||||
local pl_speed = hit_pl:get_physics_override().speed
|
||||
|
||||
-- Slow the hit player down
|
||||
|
37
utils.lua
37
utils.lua
@ -19,14 +19,18 @@ end
|
||||
|
||||
|
||||
|
||||
function fbrawl.hit_player(puncher, player, damage)
|
||||
player:set_hp(player:get_hp() - damage, {
|
||||
type = "punch",
|
||||
object = puncher,
|
||||
from = "mod"
|
||||
})
|
||||
function fbrawl.hit_player(puncher, hit_pl, damage, knockback)
|
||||
--player:set_hp(player:get_hp() - damage, {
|
||||
-- type = "punch",
|
||||
-- object = puncher,
|
||||
-- from = "mod"
|
||||
--})
|
||||
|
||||
player:punch(puncher, 2, {damage_groups = {fleshy = damage}})
|
||||
hit_pl:punch(puncher, 2, {damage_groups = {fleshy = damage*20}})
|
||||
|
||||
if knockback then
|
||||
hit_pl:add_velocity(knockback)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -178,7 +182,6 @@ function fbrawl.damage_players_near(puncher, pos, range, damage, knockback, call
|
||||
local hit_pl = get_pl_by_name(pl_name)
|
||||
local hit_pl_pos = vector.add({x=0, y=1, z=0}, hit_pl:get_pos())
|
||||
|
||||
|
||||
local is_close_enough = true
|
||||
if
|
||||
math.abs(pos.x - hit_pl_pos.x) > range.x
|
||||
@ -191,12 +194,8 @@ function fbrawl.damage_players_near(puncher, pos, range, damage, knockback, call
|
||||
if hit_pl == puncher then is_close_enough = false end
|
||||
|
||||
if is_close_enough then
|
||||
fbrawl.hit_player(puncher, hit_pl, damage)
|
||||
fbrawl.hit_player(puncher, hit_pl, damage, knockback)
|
||||
|
||||
if knockback then
|
||||
hit_pl:add_velocity(knockback)
|
||||
end
|
||||
|
||||
if callback then
|
||||
callback(hit_pl:get_player_name())
|
||||
end
|
||||
@ -206,6 +205,18 @@ end
|
||||
|
||||
|
||||
|
||||
local calculate_knockback = minetest.calculate_knockback
|
||||
function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, distance, damage)
|
||||
local mod = arena_lib.get_mod_by_player(player:get_player_name())
|
||||
|
||||
if mod == "fantasy_brawl" then return 0 end
|
||||
|
||||
calculate_knockback(player, hitter, time_from_last_punch,
|
||||
tool_capabilities, dir, distance, damage)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function random_2dvectors(amount, strength)
|
||||
local rnd = PcgRandom(os.time())
|
||||
local vectors = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user