Updated dealDamage function