Ticket #4276: 4276_uselessvar.diff

File 4276_uselessvar.diff, 1.6 KB (added by fatherbushido, 7 years ago)

removes a useless variable and fix a typo

  • binaries/data/mods/public/simulation/components/Attack.js

    Attack.prototype.GetBestAttackAgainst =  
    310310
    311311    // Always slaughter domestic animals instead of using a normal attack
    312312    if (isTargetClass("Domestic") && this.template.Slaughter)
    313313        return "Slaughter";
    314314
    315     let attack = this;
    316     let types = this.GetAttackTypes().filter(type => !attack.GetRestrictedClasses(type).some(isTargetClass));
     315    let types = this.GetAttackTypes().filter(type => !this.GetRestrictedClasses(type).some(isTargetClass));
    317316
    318317    // check if the target is capturable
    319318    let captureIndex = types.indexOf("Capture");
    320319    if (captureIndex != -1)
    321320    {
    322321        let cmpCapturable = QueryMiragedInterface(target, IID_Capturable);
    323322
    324323        let cmpPlayer = QueryOwnerInterface(this.entity);
    325324        if (allowCapture && cmpPlayer && cmpCapturable && cmpCapturable.CanCapture(cmpPlayer.GetPlayerID()))
    326325            return "Capture";
    327         // not captureable, so remove this attack
     326        // not capturable, so remove this attack
    328327        types.splice(captureIndex, 1);
    329328    }
    330329
    331     let isPreferred = className => attack.GetPreferredClasses(className).some(isTargetClass);
     330    let isPreferred = className => this.GetPreferredClasses(className).some(isTargetClass);
    332331
    333332    return types.sort((a, b) =>
    334333        (types.indexOf(a) + (isPreferred(a) ? types.length : 0)) -
    335334        (types.indexOf(b) + (isPreferred(b) ? types.length : 0))).pop();
    336335};