Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int calculateCritChance(IsoGameCharacter target) {
- if (this.bDoShove) {
- int var7 = 35;
- if (target instanceof IsoPlayer) {
- IsoPlayer target_player = (IsoPlayer)target;
- var7 = 20;
- if (GameClient.bClient && !target_player.isLocalPlayer()) {
- var7 = (int)((double)var7 - (double)target_player.remoteStrLvl * 1.5);
- if (target_player.getNutrition().getWeight() < 80.0) {
- var7 = (int)((double)var7 + Math.abs((target_player.getNutrition().getWeight() - 80.0) / 2.0));
- } else {
- var7 = (int)((double)var7 - (target_player.getNutrition().getWeight() - 80.0) / 2.0);
- }
- }
- }
- var7 -= this.getMoodles().getMoodleLevel(MoodleType.Endurance) * 5;
- var7 -= this.getMoodles().getMoodleLevel(MoodleType.HeavyLoad) * 5;
- var7 = (int)((double)var7 - (double)this.getMoodles().getMoodleLevel(MoodleType.Panic) * 1.3);
- var7 += this.getPerkLevel(Perks.Strength) * 2;
- return var7;
- } else if (this.bDoShove && target.getStateMachine().getCurrent() == StaggerBackState.instance() && target instanceof IsoZombie) {
- return 100;
- } else if (this.getPrimaryHandItem() != null && this.getPrimaryHandItem() instanceof HandWeapon) {
- HandWeapon weapon = (HandWeapon)this.getPrimaryHandItem();
- int critChance = (int)weapon.getCriticalChance();
- if (weapon.isAlwaysKnockdown()) {
- return 100;
- } else {
- WeaponType weaponType = WeaponType.getWeaponType(this);
- if (weaponType.isRanged) {
- critChance = (int)((float)critChance + (float)weapon.getAimingPerkCritModifier() * ((float)this.getPerkLevel(Perks.Aiming) / 2.0F));
- if (this.getBeenMovingFor() > (float)(weapon.getAimingTime() + this.getPerkLevel(Perks.Aiming) * 2)) {
- critChance = (int)((float)critChance - (this.getBeenMovingFor() - (float)(weapon.getAimingTime() + this.getPerkLevel(Perks.Aiming) * 2)));
- }
- critChance += this.getPerkLevel(Perks.Aiming) * 3;
- float distance = this.DistToProper(target);
- if (distance < 4.0F) {
- critChance = (int)((float)critChance + (4.0F - distance) * 7.0F);
- } else if (distance >= 4.0F) {
- critChance = (int)((float)critChance - (distance - 4.0F) * 7.0F);
- }
- } else {
- if (weapon.isTwoHandWeapon() && (this.getPrimaryHandItem() != weapon || this.getSecondaryHandItem() != weapon)) {
- critChance -= critChance / 3;
- }
- if (this.chargeTime < 2.0F) {
- critChance -= critChance / 5;
- }
- int var8 = this.getPerkLevel(Perks.Blunt);
- if (weapon.getCategories().contains("Axe")) {
- var8 = this.getPerkLevel(Perks.Axe);
- }
- if (weapon.getCategories().contains("LongBlade")) {
- var8 = this.getPerkLevel(Perks.LongBlade);
- }
- if (weapon.getCategories().contains("Spear")) {
- var8 = this.getPerkLevel(Perks.Spear);
- }
- if (weapon.getCategories().contains("SmallBlade")) {
- var8 = this.getPerkLevel(Perks.SmallBlade);
- }
- if (weapon.getCategories().contains("SmallBlunt")) {
- var8 = this.getPerkLevel(Perks.SmallBlunt);
- }
- critChance += var8 * 3;
- if (target instanceof IsoPlayer) {
- IsoPlayer var6 = (IsoPlayer)target;
- if (GameClient.bClient && !var6.isLocalPlayer()) {
- critChance = (int)((double)critChance - (double)var6.remoteStrLvl * 1.5);
- if (var6.getNutrition().getWeight() < 80.0) {
- critChance = (int)((double)critChance + Math.abs((var6.getNutrition().getWeight() - 80.0) / 2.0));
- } else {
- critChance = (int)((double)critChance - (var6.getNutrition().getWeight() - 80.0) / 2.0);
- }
- }
- }
- }
- critChance -= this.getMoodles().getMoodleLevel(MoodleType.Endurance) * 5;
- critChance -= this.getMoodles().getMoodleLevel(MoodleType.HeavyLoad) * 5;
- critChance = (int)((double)critChance - (double)this.getMoodles().getMoodleLevel(MoodleType.Panic) * 1.3);
- if (SandboxOptions.instance.Lore.Toughness.getValue() == 1) {
- critChance -= 6;
- }
- if (SandboxOptions.instance.Lore.Toughness.getValue() == 3) {
- critChance += 6;
- }
- if (critChance < 10) {
- critChance = 10;
- }
- if (critChance > 90) {
- critChance = 90;
- }
- return critChance;
- }
- } else {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement