I can damage bots, then sometimes I can't. Bots can't even damage. (I was in a minigame)
This is also packaged. But I can't seem to get it right. Please help.
function Armor::Damage( %this, %obj, %src, %pos, %dmg, %type )
{
%strength = %dmg;
if(%obj.getClassName() $= "Player" && %src.getClassName() $= "Player")
{
//If the person has bad karma, anyone can kill him (Or if the 2 players can PvP)
if((%obj.PvP && %src.PvP) || %obj.client.LUKarma < 351)
{
if(%obj.client.LUDefense > (%src.client.LUStrength + %src.client.LUArrowDamage + %strength)) //Is the defense higher than the damage?
{
%rDamage = getRandom(1,5);
%obj.client.LUHealth = %obj.client.LUHealth - %rDamage;
}
else if(%obj.LUDefense < (%src.client.LUStrength + %src.client.LUArrowDamage + %strength)) //Is the defense lower than the damage?
{
%obj.client.LUHealth = %obj.client.LUHealth - ((%src.client.LUStrength + %src.client.LUArrowDamage + %strength) - (%obj.client.LUDefense - (getRandom(mFloor(%obj.client.LUDefense/2),%obj.client.LUDefense))));
}
}
}
if(%obj.getClassName() $= "AIPlayer" && %src.getClassName() $= "Player")
{
if(%obj.LUDefense > (%src.client.LUStrength + %src.client.LUArrowDamage + %strength)) //Is the defense higher than the damage?
{
%rDamage = getRandom(1,5);
%obj.LUHealth = %obj.LUHealth - %rDamage;
}
else if(%obj.LUDefense < (%src.client.LUStrength + %src.client.LUArrowDamage + %strength)) //Is the defense lower than the damage?
{
%obj.LUHealth = %obj.LUHealth - ((%src.client.LUStrength + %src.client.LUArrowDamage + %strength) - (%obj.LUDefense - (getRandom(mFloor(%obj.LUDefense/2),%obj.LUDefense))));
%obj.LUHits++;
}
if(%obj.LUHealth < 1)
{
//Look Check
%randomGold = getRandom(1,%obj.LUHits * 1.75);
%randomExp = getRandom(1,%obj.LUHits * 2);
%src.client.LUGold = %src.client.LUGold + %randomGold;
%src.client.LUExp = %src.client.LUExp + %randomExp;
messageClient(%src.client,'',"\c6+\c3 " @ %randomGold @ " Gold");
messageClient(%src.client,'',"\c6+\c2 " @ %randomExp @ " Notoriety");
%obj.LUHits = 0;
%obj.setHealth(0);
return;
}
%obj.addHealth(10000);
}
if(%obj.getClassName() $= "Player" && %src.getClassName() $= "AIPlayer")
{
if(%obj.client.LUDefense > (%src.LUStrength + %src.LUArrowDamage + %strength)) //If the damage is more, their level must be too high
{
%obj.client.LUHealth = %obj.client.LUHealth - getRandom(1,5);
}
else if(%obj.client.LUDefense < (%src.LUStrength + %src.LUArrowDamage + %strength))
{
%obj.client.LUHealth = %obj.client.LUHealth - ((%src.LUStrength + %src.LUArrowDamage + %strength) - (%obj.client.LUDefense - (getRandom(mFloor(%obj.client.LUDefense/2),%obj.client.LUDefense))));
}
}
if(!%obj.LUBot && isObject(%obj.client))
{
cancel(%obj.client.LUHealSch);
%objClient.LUHealSch = %obj.client.schedule(%obj.client.LULevel * 400 + 4000, LUreHeal);
%objClient.LUHeal = false;
}
return Parent::Damage( %this, %obj, %src, %pos, %dmg, %type );
}