Jump to content

[B41.68] Spear critical bonus modification proposition


Tchernobill

Recommended Posts

Here is my interpretation of the condition for the famous "high spear critical chances" as RE from IsoPlayer::pressedAttack(boolean)

--spear +30% crit: this = IsoPlayer 
 float var8 = IsoUtils.DistanceTo(var11.x, var11.y, this.x, this.y);
 this.setVariable("TargetDist", var8);
 int var9 = this.calculateCritChance(var11);
 if (var11 instanceof IsoZombie) {
    IsoZombie var10 = this.getClosestZombieToOtherZombie((IsoZombie)var11);
    if (!this.attackVars.bAimAtFloor //not aim floor
    && (double)var8 > 1.25D //target must be further than 1.25 "meters"
    && var4 == WeaponType.spear //weapon is spear
    && (var10 == null || (double)IsoUtils.DistanceTo(var11.x, var11.y, var10.x, var10.y) > 1.7D) //closestZombie from targetZombie is further than 1.7 meters from targetZombie
    ) {
       if (!GameClient.bClient || this.isLocalPlayer()) {
          this.setAttackType("overhead"); //go go spear in the head my boy !
       }
       var9 += 30;
    }
 }

 

Here is my proposition for correction modification of the decision algorithm :

Do not take into account the closest Z to my target.

But take into account the closest Z to me that I can detect.

 float var8 = IsoUtils.DistanceTo(var11.x, var11.y, this.x, this.y);
 this.setVariable("TargetDist", var8);
 int var9 = this.calculateCritChance(var11);
 if (var11 instanceof IsoZombie) {
    IsoZombie var10 = this.getClosestZombieThatisNotThatZombie((IsoZombie)var11); //get closestZombie to me, that I can detect, except targetZombie
    if (!this.attackVars.bAimAtFloor //not aim floor
    && (double)var8 > 1.25D //target is further than 1.25 "meters"
    && var4 == WeaponType.spear //weapon is spear
    && (var10 == null || (double)IsoUtils.DistanceTo(this.x, this.y, var10.x, var10.y) > 1.7D) //if that other "closestZombie" is far enough from me I can safely headshot with my spear
    ) {
       if (!GameClient.bClient || this.isLocalPlayer()) {
          this.setAttackType("overhead");
       }
       var9 += 30;
    }
 }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...