mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Adjusted balance for Arena weapons
This commit is contained in:
parent
619eba7527
commit
5b07d3b78c
5 changed files with 53 additions and 21 deletions
|
@ -127,21 +127,21 @@ function mario_local_hammer_check(m)
|
||||||
local pos = mario_hammer_position(mattacker)
|
local pos = mario_hammer_position(mattacker)
|
||||||
local dist = vec3f_dist(pos, cmvictim.pos)
|
local dist = vec3f_dist(pos, cmvictim.pos)
|
||||||
if dist <= 165 then
|
if dist <= 165 then
|
||||||
local yOffset = 100
|
local yOffset = 0.6
|
||||||
if mattacker.action == ACT_JUMP_KICK then
|
if mattacker.action == ACT_JUMP_KICK then
|
||||||
yOffset = yOffset + 100
|
yOffset = 1.0
|
||||||
end
|
end
|
||||||
|
|
||||||
local vel = {
|
local vel = {
|
||||||
x = cmvictim.pos.x - mattacker.pos.x,
|
x = sins(mattacker.faceAngle.y),
|
||||||
y = (cmvictim.pos.y + yOffset) - mattacker.pos.y,
|
y = yOffset,
|
||||||
z = cmvictim.pos.z - mattacker.pos.z,
|
z = coss(mattacker.faceAngle.y),
|
||||||
}
|
}
|
||||||
vec3f_normalize(vel)
|
vec3f_normalize(vel)
|
||||||
vec3f_mul(vel, 75 + 70 * (1 - mario_health_float(cmvictim)))
|
vec3f_mul(vel, 80 + 10 * (1 - mario_health_float(cmvictim)))
|
||||||
|
|
||||||
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0)
|
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0)
|
||||||
m.invincTimer = 30
|
m.invincTimer = 20
|
||||||
m.knockbackTimer = 10
|
m.knockbackTimer = 10
|
||||||
m.vel.x = vel.x
|
m.vel.x = vel.x
|
||||||
m.vel.y = vel.y
|
m.vel.y = vel.y
|
||||||
|
@ -152,16 +152,18 @@ function mario_local_hammer_check(m)
|
||||||
send_arena_hammer_hit(np.globalIndex, npattacker.globalIndex)
|
send_arena_hammer_hit(np.globalIndex, npattacker.globalIndex)
|
||||||
e.lastDamagedByGlobal = npattacker.globalIndex
|
e.lastDamagedByGlobal = npattacker.globalIndex
|
||||||
|
|
||||||
if mattacker.action == ACT_PUNCHING or mattacker.action == ACT_MOVE_PUNCHING or mattacker.action == ACT_GROUND_POUND then
|
if mattacker.action == ACT_JUMP_KICK or mattacker.action == ACT_DIVE then
|
||||||
m.hurtCounter = 12
|
m.hurtCounter = 1
|
||||||
else
|
else
|
||||||
m.hurtCounter = 8
|
m.hurtCounter = 14
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
m.knockbackTimer = savedKb
|
if savedKb > m.knockbackTimer then
|
||||||
|
m.knockbackTimer = savedKb
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------
|
-----------------
|
||||||
|
@ -243,6 +245,7 @@ function mario_cannon_box_update(m)
|
||||||
end
|
end
|
||||||
|
|
||||||
if (m.controller.buttonDown & Y_BUTTON) ~= 0 and s.charging > 0 then
|
if (m.controller.buttonDown & Y_BUTTON) ~= 0 and s.charging > 0 then
|
||||||
|
local cannonBallSize = clamp((get_network_area_timer() - s.charging) / (30 * 5) + 0.1, 0, 1)
|
||||||
local held = gItemHeld[m.playerIndex]
|
local held = gItemHeld[m.playerIndex]
|
||||||
if held ~= nil then
|
if held ~= nil then
|
||||||
for i = 0, 2 do
|
for i = 0, 2 do
|
||||||
|
@ -250,6 +253,7 @@ function mario_cannon_box_update(m)
|
||||||
held.oPosX, held.oPosY, held.oPosZ,
|
held.oPosX, held.oPosY, held.oPosZ,
|
||||||
function (obj)
|
function (obj)
|
||||||
obj.oArenaSparkleOwner = m.playerIndex
|
obj.oArenaSparkleOwner = m.playerIndex
|
||||||
|
obj.oArenaSparkleSize = cannonBallSize
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ end
|
||||||
function bhv_arena_bobomb_intersects_player(obj, m, pos, radius)
|
function bhv_arena_bobomb_intersects_player(obj, m, pos, radius)
|
||||||
local ownerNp = network_player_from_global_index(obj.oArenaBobombGlobalOwner)
|
local ownerNp = network_player_from_global_index(obj.oArenaBobombGlobalOwner)
|
||||||
local cm = m
|
local cm = m
|
||||||
if m.playerIndex == 0 then
|
if m.playerIndex == 0 and ownerNp.localIndex ~= 0 then
|
||||||
cm = lag_compensation_get_local_state(ownerNp)
|
cm = lag_compensation_get_local_state(ownerNp)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,12 +45,38 @@ function bhv_arena_bobomb_expode(obj)
|
||||||
local e = gMarioStateExtras[0]
|
local e = gMarioStateExtras[0]
|
||||||
local a = { x = obj.oPosX, y = obj.oPosY, z = obj.oPosZ }
|
local a = { x = obj.oPosX, y = obj.oPosY, z = obj.oPosZ }
|
||||||
local validAttack = global_index_hurts_mario_state(obj.oArenaBobombGlobalOwner, m) or np.globalIndex == obj.oArenaBobombGlobalOwner
|
local validAttack = global_index_hurts_mario_state(obj.oArenaBobombGlobalOwner, m) or np.globalIndex == obj.oArenaBobombGlobalOwner
|
||||||
local radius = 650
|
local radius = 500
|
||||||
if np.globalIndex == obj.oArenaBobombGlobalOwner then radius = 200 end
|
if np.globalIndex == obj.oArenaBobombGlobalOwner then radius = 300 end
|
||||||
if validAttack and bhv_arena_bobomb_intersects_player(obj, m, a, radius) and mario_health_float(m) > 0 then
|
if validAttack and bhv_arena_bobomb_intersects_player(obj, m, a, radius) and mario_health_float(m) > 0 then
|
||||||
obj.oDamageOrCoinValue = 3
|
obj.oDamageOrCoinValue = 3
|
||||||
interact_damage(m, INTERACT_DAMAGE, obj)
|
interact_damage(m, INTERACT_DAMAGE, obj)
|
||||||
e.lastDamagedByGlobal = obj.oArenaBobombGlobalOwner
|
e.lastDamagedByGlobal = obj.oArenaBobombGlobalOwner
|
||||||
|
|
||||||
|
-- knockback
|
||||||
|
local ownerNp = network_player_from_global_index(obj.oArenaBobombGlobalOwner)
|
||||||
|
local cm = m
|
||||||
|
if np.globalIndex ~= obj.oArenaBobombGlobalOwner then
|
||||||
|
cm = lag_compensation_get_local_state(ownerNp)
|
||||||
|
end
|
||||||
|
local vel = {
|
||||||
|
x = cm.pos.x - obj.oPosX,
|
||||||
|
y = 0.5,
|
||||||
|
z = cm.pos.z - obj.oPosZ,
|
||||||
|
}
|
||||||
|
vec3f_normalize(vel)
|
||||||
|
vel.y = 0.5
|
||||||
|
vec3f_normalize(vel)
|
||||||
|
vec3f_mul(vel, 40)
|
||||||
|
|
||||||
|
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0)
|
||||||
|
m.invincTimer = 10
|
||||||
|
m.knockbackTimer = 10
|
||||||
|
m.vel.x = vel.x
|
||||||
|
m.vel.y = vel.y
|
||||||
|
m.vel.z = vel.z
|
||||||
|
m.forwardVel = 0
|
||||||
|
m.faceAngle.y = atan2s(vel.z, vel.x) + 0x8000
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ function bhv_arena_cannon_ball_loop(obj)
|
||||||
local b = { x = a.x + dir.x / 2, y = a.y + dir.y / 2, z = a.z + dir.z / 2 }
|
local b = { x = a.x + dir.x / 2, y = a.y + dir.y / 2, z = a.z + dir.z / 2 }
|
||||||
if bhv_arena_cannon_ball_intersects_local(obj, a) or bhv_arena_cannon_ball_intersects_local(obj, b) then
|
if bhv_arena_cannon_ball_intersects_local(obj, a) or bhv_arena_cannon_ball_intersects_local(obj, b) then
|
||||||
if obj.oArenaCannonBallDamages ~= 0 then
|
if obj.oArenaCannonBallDamages ~= 0 then
|
||||||
obj.oDamageOrCoinValue = clamp(obj.oArenaCannonBallSize * 8, 1, 5)
|
obj.oDamageOrCoinValue = clamp(obj.oArenaCannonBallSize * 7, 1, 4)
|
||||||
interact_damage(m, INTERACT_DAMAGE, obj)
|
interact_damage(m, INTERACT_DAMAGE, obj)
|
||||||
obj.oArenaCannonBallDamages = 0
|
obj.oArenaCannonBallDamages = 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -134,7 +134,7 @@ function bhv_arena_flame_loop(obj)
|
||||||
-- find nearest target
|
-- find nearest target
|
||||||
local pos = { x = obj.oPosX, y = obj.oPosY, z = obj.oPosZ }
|
local pos = { x = obj.oPosX, y = obj.oPosY, z = obj.oPosZ }
|
||||||
local target = nil
|
local target = nil
|
||||||
local targetDist = 2000
|
local targetDist = 2500
|
||||||
for i = 0, (MAX_PLAYERS - 1) do
|
for i = 0, (MAX_PLAYERS - 1) do
|
||||||
local m = gMarioStates[i]
|
local m = gMarioStates[i]
|
||||||
if global_index_hurts_mario_state(obj.oArenaFlameGlobalOwner, m) and active_player(m) then
|
if global_index_hurts_mario_state(obj.oArenaFlameGlobalOwner, m) and active_player(m) then
|
||||||
|
@ -149,7 +149,7 @@ function bhv_arena_flame_loop(obj)
|
||||||
if target ~= nil then
|
if target ~= nil then
|
||||||
-- aim toward target
|
-- aim toward target
|
||||||
local targetYaw = atan2s(target.pos.z - pos.z, target.pos.x - pos.x)
|
local targetYaw = atan2s(target.pos.z - pos.z, target.pos.x - pos.x)
|
||||||
obj.oMoveAngleYaw = approach_s16_symmetric(obj.oMoveAngleYaw, targetYaw, 0x350)
|
obj.oMoveAngleYaw = approach_s16_symmetric(obj.oMoveAngleYaw, targetYaw, 0x100)
|
||||||
|
|
||||||
-- jump
|
-- jump
|
||||||
local floorDiff = obj.oFloorHeight - obj.oPosY
|
local floorDiff = obj.oFloorHeight - obj.oPosY
|
||||||
|
@ -158,7 +158,7 @@ function bhv_arena_flame_loop(obj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cur_obj_move_standard(78)
|
cur_obj_move_standard(200)
|
||||||
obj.oInteractStatus = 0
|
obj.oInteractStatus = 0
|
||||||
obj.oIntangibleTimer = 0
|
obj.oIntangibleTimer = 0
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ define_custom_obj_fields({
|
||||||
oArenaSparkleOffsetX = 'f32',
|
oArenaSparkleOffsetX = 'f32',
|
||||||
oArenaSparkleOffsetY = 'f32',
|
oArenaSparkleOffsetY = 'f32',
|
||||||
oArenaSparkleOffsetZ = 'f32',
|
oArenaSparkleOffsetZ = 'f32',
|
||||||
|
oArenaSparkleSize = 'f32',
|
||||||
})
|
})
|
||||||
|
|
||||||
function bhv_arena_sparkle_init(obj)
|
function bhv_arena_sparkle_init(obj)
|
||||||
|
@ -25,11 +26,12 @@ function bhv_arena_sparkle_loop(obj)
|
||||||
local held = gItemHeld[obj.oArenaSparkleOwner]
|
local held = gItemHeld[obj.oArenaSparkleOwner]
|
||||||
if held ~= nil then
|
if held ~= nil then
|
||||||
local offset = {
|
local offset = {
|
||||||
x = held.oPosX + sins(m.faceAngle.y) * 70,
|
x = held.oPosX + sins(m.faceAngle.y) * 75,
|
||||||
y = held.oPosY - 25,
|
y = held.oPosY - 25,
|
||||||
z = held.oPosZ + coss(m.faceAngle.y) * 70,
|
z = held.oPosZ + coss(m.faceAngle.y) * 75,
|
||||||
}
|
}
|
||||||
local scalar = (obj.oArenaSparkleOffsetZ * (1 - (obj.oTimer / 10) ^ 3))
|
local scalar = (obj.oArenaSparkleOffsetZ * (1 - (obj.oTimer / 10) ^ 3))
|
||||||
|
scalar = scalar * ((1 - obj.oArenaSparkleSize) + 0.25)
|
||||||
local offset2 = {
|
local offset2 = {
|
||||||
x = offset.x + sins(m.faceAngle.y + obj.oArenaSparkleOffsetX) * scalar,
|
x = offset.x + sins(m.faceAngle.y + obj.oArenaSparkleOffsetX) * scalar,
|
||||||
y = offset.y + sins(obj.oArenaSparkleOffsetY) * scalar,
|
y = offset.y + sins(obj.oArenaSparkleOffsetY) * scalar,
|
||||||
|
@ -42,7 +44,7 @@ function bhv_arena_sparkle_loop(obj)
|
||||||
obj.oPosY = offset2.y
|
obj.oPosY = offset2.y
|
||||||
obj.oPosZ = offset2.z
|
obj.oPosZ = offset2.z
|
||||||
end
|
end
|
||||||
obj_scale(obj, (obj.oTimer / 10) * 1)
|
obj_scale(obj, (obj.oTimer / 10) * (obj.oArenaSparkleSize * 0.5 + 1))
|
||||||
end
|
end
|
||||||
|
|
||||||
id_bhvArenaSparkle = hook_behavior(nil, OBJ_LIST_UNIMPORTANT, true, bhv_arena_sparkle_init, bhv_arena_sparkle_loop)
|
id_bhvArenaSparkle = hook_behavior(nil, OBJ_LIST_UNIMPORTANT, true, bhv_arena_sparkle_init, bhv_arena_sparkle_loop)
|
||||||
|
|
Loading…
Reference in a new issue