Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(content): prevent npcs from tick healing non-recoil damage #1402

Merged
merged 5 commits into from
Mar 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(content): $maxhit local var in combat scripts to prevent exponent…
…ial %com_maxhit growth
tannerdino committed Mar 3, 2025
commit 1d98f52cbc27a625e438a7b00f471666a75db873
Original file line number Diff line number Diff line change
@@ -175,7 +175,8 @@ if (%damagestyle = ^style_ranged_rapid) {
// check hit, give combat xp
def_int $damage = 0;
if (~player_npc_hit_roll(%damagetype) = true) {
$damage = randominc(min(%com_maxhit, npc_param(max_dealt)));
def_int $maxhit = %com_maxhit;
$damage = randominc(min($maxhit, npc_param(max_dealt)));
def_int $damage_capped = min($damage, npc_stat(hitpoints));
~give_combat_experience(%damagestyle, $damage_capped, %npc_combat_xp_multiplier);
npc_heropoints($damage_capped);
12 changes: 6 additions & 6 deletions data/src/scripts/skill_combat/scripts/player/player_melee.rs2
Original file line number Diff line number Diff line change
@@ -30,16 +30,16 @@ if (npc_stat(hitpoints) = 0) {
// check hit, give combat xp
def_int $damage = 0;
if (~player_npc_hit_roll(%damagetype) = true) {
def_int $maxhit = %com_maxhit;
if (npc_type = count_draynor & inv_total(inv, garlic) > 0) {
%com_maxhit = add(%com_maxhit, 1);
$maxhit = add($maxhit, 1);
}
if (npc_param(demonbane_vulnerable) = true & inv_total(worn, silverlight) > 0) {
%com_maxhit = divide(multiply(%com_maxhit, 160), 100);
$maxhit = divide(multiply($maxhit, 160), 100);
}
$damage = randominc(min(%com_maxhit, npc_param(max_dealt)));
def_int $damage_capped = min($damage, npc_stat(hitpoints));
~give_combat_experience(%damagestyle, $damage_capped, %npc_combat_xp_multiplier);
npc_heropoints($damage_capped);
$damage = randominc(min($maxhit, npc_param(max_dealt)));
$damage = min($damage, npc_stat(hitpoints));
~give_combat_experience(%damagestyle, $damage, %npc_combat_xp_multiplier);
}

def_obj $weapon = inv_getobj(worn, ^wearpos_rhand);
Original file line number Diff line number Diff line change
@@ -35,10 +35,11 @@ if ($ammo = null) {
// check hit, give combat xp
def_int $damage = 0;
if (~player_npc_hit_roll(%damagetype) = true) {
def_int $maxhit = %com_maxhit;
if (npc_type = count_draynor & inv_total(inv, garlic) > 0) {
%com_maxhit = add(%com_maxhit, 1);
$maxhit = add($maxhit, 1);
}
$damage = randominc(min(%com_maxhit, npc_param(max_dealt)));
$damage = randominc(min($maxhit, npc_param(max_dealt)));
def_int $damage_capped = min($damage, npc_stat(hitpoints));
~give_combat_experience(%damagestyle, $damage_capped, %npc_combat_xp_multiplier);
npc_heropoints($damage_capped);