Skip to content

Commit

Permalink
fix: buffer health comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
rick-yao committed Sep 26, 2024
1 parent b568b44 commit 4cfdeae
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions l4d2_tank_draw/scripting/l4d2_tank_draw.sp
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,12 @@ Action LuckyDraw(int victim, int attacker)
currentChance += chanceDecreaseHealth;
if (random <= currentChance)
{
int minDecrease = GetConVarInt(MinHealthDecrease);
int maxDecrease = GetConVarInt(MaxHealthDecrease);
int randomHealth = GetRandomInt(minDecrease, maxDecrease);
int health = GetClientHealth(attacker);
float bufferHealth = GetEntPropFloat(attacker, Prop_Send, "m_healthBuffer");
int minDecrease = GetConVarInt(MinHealthDecrease);
int maxDecrease = GetConVarInt(MaxHealthDecrease);
int randomHealth = GetRandomInt(minDecrease, maxDecrease);
int health = GetClientHealth(attacker);

if (float(health) > float(randomHealth) + bufferHealth)
if (health > randomHealth)
{
SDKHooks_TakeDamage(attacker, attacker, attacker, float(randomHealth), DMG_GENERIC);
TankDraw_PrintToChat(0, "玩家 %s 的幸运抽奖结果为:随机受到 %d 伤害", attackerName, randomHealth);
Expand Down

0 comments on commit 4cfdeae

Please sign in to comment.