Reduce amount fed to improbable by fight.reach.

This commit is contained in:
asofold 2013-03-09 00:34:04 +01:00
parent de4faa392d
commit 498f23e704

View File

@ -111,17 +111,19 @@ public class Reach extends Check {
// Execute whatever actions are associated with this check and the violation level and find out if we should // Execute whatever actions are associated with this check and the violation level and find out if we should
// cancel the event. // cancel the event.
cancel = executeActions(player, data.reachVL, violation, cc.reachActions); cancel = executeActions(player, data.reachVL, violation, cc.reachActions);
if (Improbable.check(player, (float) violation, System.currentTimeMillis(), "fight.reach")) if (Improbable.check(player, (float) violation / 2f, System.currentTimeMillis(), "fight.reach")){
cancel = true; cancel = true;
if (cancel) }
if (cancel){
// If we should cancel, remember the current time too. // If we should cancel, remember the current time too.
data.reachLastViolationTime = System.currentTimeMillis(); data.reachLastViolationTime = System.currentTimeMillis();
}
} }
else if (lenpRel - distanceLimit * reachMod > 0){ else if (lenpRel - distanceLimit * reachMod > 0){
// Silent cancel. // Silent cancel.
data.reachLastViolationTime = Math.max(data.reachLastViolationTime, System.currentTimeMillis() - cc.reachPenalty / 2); data.reachLastViolationTime = Math.max(data.reachLastViolationTime, System.currentTimeMillis() - cc.reachPenalty / 2);
cancel = true; cancel = true;
Improbable.feed(player, (float) (lenpRel - distanceLimit * reachMod) / 2f, System.currentTimeMillis()); Improbable.feed(player, (float) (lenpRel - distanceLimit * reachMod) / 4f, System.currentTimeMillis());
} }
else{ else{
// Player passed the check, reward him. // Player passed the check, reward him.
@ -129,7 +131,9 @@ public class Reach extends Check {
} }
if (!cc.reachReduce) data.reachMod = 1d; if (!cc.reachReduce){
data.reachMod = 1d;
}
else if (lenpRel > distanceLimit - DYNAMIC_RANGE){ else if (lenpRel > distanceLimit - DYNAMIC_RANGE){
data.reachMod = Math.max(distanceMin, data.reachMod - DYNAMIC_STEP); data.reachMod = Math.max(distanceMin, data.reachMod - DYNAMIC_STEP);
} }
@ -148,7 +152,9 @@ public class Reach extends Check {
cancelByPenalty = !cancel; cancelByPenalty = !cancel;
cancel = true; cancel = true;
} }
else cancelByPenalty = false; else{
cancelByPenalty = false;
}
if (cc.debug && player.hasPermission(Permissions.ADMINISTRATION_DEBUG)){ if (cc.debug && player.hasPermission(Permissions.ADMINISTRATION_DEBUG)){
player.sendMessage("NC+: Attack " + (cancel ? (cancelByPenalty ? "(cancel/penalty) ":"(cancel/reach) ") : "") + damaged.getType()+ " height="+ StringUtil.fdec3.format(height) + " dist=" + StringUtil.fdec3.format(lenpRel) +" @" + StringUtil.fdec3.format(reachMod)); player.sendMessage("NC+: Attack " + (cancel ? (cancelByPenalty ? "(cancel/penalty) ":"(cancel/reach) ") : "") + damaged.getType()+ " height="+ StringUtil.fdec3.format(height) + " dist=" + StringUtil.fdec3.format(lenpRel) +" @" + StringUtil.fdec3.format(reachMod));