From 9dca10e32f92c851508e2a24b8128ce68b813478 Mon Sep 17 00:00:00 2001 From: elexis Date: Mon, 14 Nov 2016 01:44:17 +0000 Subject: [PATCH] Remove two pointless references and fix a typo. Patch by fatherbushido, refs #4276. This was SVN commit r18929. --- binaries/data/mods/public/simulation/components/Attack.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/Attack.js b/binaries/data/mods/public/simulation/components/Attack.js index db435d560b..210481f105 100644 --- a/binaries/data/mods/public/simulation/components/Attack.js +++ b/binaries/data/mods/public/simulation/components/Attack.js @@ -312,8 +312,7 @@ Attack.prototype.GetBestAttackAgainst = function(target, allowCapture) if (isTargetClass("Domestic") && this.template.Slaughter) return "Slaughter"; - let attack = this; - let types = this.GetAttackTypes().filter(type => !attack.GetRestrictedClasses(type).some(isTargetClass)); + let types = this.GetAttackTypes().filter(type => !this.GetRestrictedClasses(type).some(isTargetClass)); // check if the target is capturable let captureIndex = types.indexOf("Capture"); @@ -324,11 +323,11 @@ Attack.prototype.GetBestAttackAgainst = function(target, allowCapture) let cmpPlayer = QueryOwnerInterface(this.entity); if (allowCapture && cmpPlayer && cmpCapturable && cmpCapturable.CanCapture(cmpPlayer.GetPlayerID())) return "Capture"; - // not captureable, so remove this attack + // not capturable, so remove this attack types.splice(captureIndex, 1); } - let isPreferred = className => attack.GetPreferredClasses(className).some(isTargetClass); + let isPreferred = className => this.GetPreferredClasses(className).some(isTargetClass); return types.sort((a, b) => (types.indexOf(a) + (isPreferred(a) ? types.length : 0)) -