From 5b07d3b78c3fbb45108984f2add1cfc8e2139815 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 22 Apr 2023 01:53:27 -0700 Subject: [PATCH] Adjusted balance for Arena weapons --- mods/arena/arena-player.lua | 26 +++++++++++++--------- mods/arena/arena-proj-bobomb.lua | 32 ++++++++++++++++++++++++--- mods/arena/arena-proj-cannon-ball.lua | 2 +- mods/arena/arena-proj-flame.lua | 6 ++--- mods/arena/arena-sparkle.lua | 8 ++++--- 5 files changed, 53 insertions(+), 21 deletions(-) diff --git a/mods/arena/arena-player.lua b/mods/arena/arena-player.lua index 62857c88..3ecf557a 100644 --- a/mods/arena/arena-player.lua +++ b/mods/arena/arena-player.lua @@ -127,21 +127,21 @@ function mario_local_hammer_check(m) local pos = mario_hammer_position(mattacker) local dist = vec3f_dist(pos, cmvictim.pos) if dist <= 165 then - local yOffset = 100 + local yOffset = 0.6 if mattacker.action == ACT_JUMP_KICK then - yOffset = yOffset + 100 + yOffset = 1.0 end local vel = { - x = cmvictim.pos.x - mattacker.pos.x, - y = (cmvictim.pos.y + yOffset) - mattacker.pos.y, - z = cmvictim.pos.z - mattacker.pos.z, + x = sins(mattacker.faceAngle.y), + y = yOffset, + z = coss(mattacker.faceAngle.y), } 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) - m.invincTimer = 30 + m.invincTimer = 20 m.knockbackTimer = 10 m.vel.x = vel.x m.vel.y = vel.y @@ -152,16 +152,18 @@ function mario_local_hammer_check(m) send_arena_hammer_hit(np.globalIndex, npattacker.globalIndex) e.lastDamagedByGlobal = npattacker.globalIndex - if mattacker.action == ACT_PUNCHING or mattacker.action == ACT_MOVE_PUNCHING or mattacker.action == ACT_GROUND_POUND then - m.hurtCounter = 12 + if mattacker.action == ACT_JUMP_KICK or mattacker.action == ACT_DIVE then + m.hurtCounter = 1 else - m.hurtCounter = 8 + m.hurtCounter = 14 end end end end - m.knockbackTimer = savedKb + if savedKb > m.knockbackTimer then + m.knockbackTimer = savedKb + end end ----------------- @@ -243,6 +245,7 @@ function mario_cannon_box_update(m) end 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] if held ~= nil then for i = 0, 2 do @@ -250,6 +253,7 @@ function mario_cannon_box_update(m) held.oPosX, held.oPosY, held.oPosZ, function (obj) obj.oArenaSparkleOwner = m.playerIndex + obj.oArenaSparkleSize = cannonBallSize end) end end diff --git a/mods/arena/arena-proj-bobomb.lua b/mods/arena/arena-proj-bobomb.lua index 0b85601d..a5aa396f 100644 --- a/mods/arena/arena-proj-bobomb.lua +++ b/mods/arena/arena-proj-bobomb.lua @@ -18,7 +18,7 @@ end function bhv_arena_bobomb_intersects_player(obj, m, pos, radius) local ownerNp = network_player_from_global_index(obj.oArenaBobombGlobalOwner) local cm = m - if m.playerIndex == 0 then + if m.playerIndex == 0 and ownerNp.localIndex ~= 0 then cm = lag_compensation_get_local_state(ownerNp) end @@ -45,12 +45,38 @@ function bhv_arena_bobomb_expode(obj) local e = gMarioStateExtras[0] 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 radius = 650 - if np.globalIndex == obj.oArenaBobombGlobalOwner then radius = 200 end + local radius = 500 + 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 obj.oDamageOrCoinValue = 3 interact_damage(m, INTERACT_DAMAGE, obj) 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 diff --git a/mods/arena/arena-proj-cannon-ball.lua b/mods/arena/arena-proj-cannon-ball.lua index 8a10be7c..edc3bad3 100644 --- a/mods/arena/arena-proj-cannon-ball.lua +++ b/mods/arena/arena-proj-cannon-ball.lua @@ -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 } if bhv_arena_cannon_ball_intersects_local(obj, a) or bhv_arena_cannon_ball_intersects_local(obj, b) 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) obj.oArenaCannonBallDamages = 0 end diff --git a/mods/arena/arena-proj-flame.lua b/mods/arena/arena-proj-flame.lua index 18aa46e3..ddf78605 100644 --- a/mods/arena/arena-proj-flame.lua +++ b/mods/arena/arena-proj-flame.lua @@ -134,7 +134,7 @@ function bhv_arena_flame_loop(obj) -- find nearest target local pos = { x = obj.oPosX, y = obj.oPosY, z = obj.oPosZ } local target = nil - local targetDist = 2000 + local targetDist = 2500 for i = 0, (MAX_PLAYERS - 1) do local m = gMarioStates[i] 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 -- aim toward target 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 local floorDiff = obj.oFloorHeight - obj.oPosY @@ -158,7 +158,7 @@ function bhv_arena_flame_loop(obj) end end - cur_obj_move_standard(78) + cur_obj_move_standard(200) obj.oInteractStatus = 0 obj.oIntangibleTimer = 0 diff --git a/mods/arena/arena-sparkle.lua b/mods/arena/arena-sparkle.lua index 46625ab9..7c31b492 100644 --- a/mods/arena/arena-sparkle.lua +++ b/mods/arena/arena-sparkle.lua @@ -3,6 +3,7 @@ define_custom_obj_fields({ oArenaSparkleOffsetX = 'f32', oArenaSparkleOffsetY = 'f32', oArenaSparkleOffsetZ = 'f32', + oArenaSparkleSize = 'f32', }) function bhv_arena_sparkle_init(obj) @@ -25,11 +26,12 @@ function bhv_arena_sparkle_loop(obj) local held = gItemHeld[obj.oArenaSparkleOwner] if held ~= nil then local offset = { - x = held.oPosX + sins(m.faceAngle.y) * 70, + x = held.oPosX + sins(m.faceAngle.y) * 75, 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)) + scalar = scalar * ((1 - obj.oArenaSparkleSize) + 0.25) local offset2 = { x = offset.x + sins(m.faceAngle.y + obj.oArenaSparkleOffsetX) * scalar, y = offset.y + sins(obj.oArenaSparkleOffsetY) * scalar, @@ -42,7 +44,7 @@ function bhv_arena_sparkle_loop(obj) obj.oPosY = offset2.y obj.oPosZ = offset2.z end - obj_scale(obj, (obj.oTimer / 10) * 1) + obj_scale(obj, (obj.oTimer / 10) * (obj.oArenaSparkleSize * 0.5 + 1)) end id_bhvArenaSparkle = hook_behavior(nil, OBJ_LIST_UNIMPORTANT, true, bhv_arena_sparkle_init, bhv_arena_sparkle_loop)