• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
add iterator enemiesByTypeAndInstallationAndBoss (a shorter name might be used...)
Line 192: Line 192:  
     return Iterator.enemiesBy(context, n, function(e)
 
     return Iterator.enemiesBy(context, n, function(e)
 
         return e:type() == type
 
         return e:type() == type
 +
    end)
 +
end
 +
 +
function Iterator.enemiesByTypeAndInstallationAndBoss(context, n)
 +
    local type = numberKey('type', context, n, 0)
 +
   
 +
    local selectInstallation = stringKey('installation', context, n):lower()
 +
    local predInstallation = function(e)
 +
        if selectInstallation == 'yes' then
 +
            return e._speed == 0
 +
        elseif selectInstallation == 'no' then
 +
            return e._speed ~= 0
 +
        else
 +
            return true
 +
        end
 +
    end
 +
   
 +
    local selectBoss = stringKey('boss', context, n):lower()
 +
    local predBoss = function(e)
 +
        if selectBoss == 'yes' then
 +
            return e._back <= -11
 +
        elseif selectBoss == 'no' then
 +
            return e._back >= -10
 +
        else
 +
            return true
 +
        end
 +
    end
 +
   
 +
    return Iterator.enemiesBy(context, n, function(e)
 +
        return (e:type() == type or type == 0)
 +
        and e._hp -- skip unimplemented units
 +
        and predInstallation(e)
 +
        and predBoss(e)
 
     end)
 
     end)
 
end
 
end
Anonymous user

Navigation menu